Package jenkins.scm.api
Class SCMUri
java.lang.Object
jenkins.scm.api.SCMUri
Utility class to help with SCM URI related things.
- Since:
- 2.2.5
-
Method Summary
-
Method Details
-
commonDefaultPorts
Returns the common default ports.- Returns:
- the common default ports.
-
normalize
Normalize an URI. Normalization will apply the following changes:- The scheme will be forced to lowercase (scheme is case insensitive, so should not matter)
- For schemes that use a hostname or user authority plus hostname format (such as
ssh
,http
andhttps
The hostname will be converted from IDNA to ASCII if necessary and forced to lowercase and the PCT-encoding of the user authority will be enforced (note that this may affect the case where a username in a user authority contains a:
as theURI
class does not provide a means to destructure and restructure a URI without encoding/decoding the username, consequently the%3A
will be converted to:
and not converted back) - Any redundant path navigation segments will be removed, for example a path of
/foo/../bar
will be normalized to/bar
- Any trailing
/
will be removed
- Parameters:
uri
- the URI.- Returns:
- the normalized api URI.
-
normalize
@CheckForNull public static String normalize(@CheckForNull String uri, Map<String, Integer>... defaultPorts) Normalize an URI. Normalization will apply the following changes:- The scheme will be forced to lowercase (scheme is case insensitive, so should not matter)
- For schemes in the supplied default ports that use a hostname or user authority plus hostname format (such
as
ssh
,http
andhttps
The hostname will be converted from IDNA to ASCII if necessary and forced to lowercase and the PCT-encoding of the user authority will be enforced (note that this may affect the case where a username in a user authority contains a:
as theURI
class does not provide a means to destructure and restructure a URI without encoding/decoding the username, consequently the%3A
will be converted to:
and not converted back) - Any redundant path navigation segments will be removed, for example a path of
/foo/../bar
will be normalized to/bar
- Any trailing
/
will be removed
- Parameters:
uri
- the URIdefaultPorts
- the URI scheme to default port mapping (a varargs list to make combination easier). Normally the caller would usecommonDefaultPorts()
as one of the arguments.- Returns:
- the normalized api URI.
-