The determination of the supercurrent-phase relation of superconducting weak links in static condition