Class Uri$
java.lang.Object
org.apache.pekko.http.scaladsl.model.Uri$
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionParses a valid URI string into a normalized URI reference as defined by http://tools.ietf.org/html/rfc3986#section-4.1.apply(String scheme, Uri.Authority authority, Uri.Path path, scala.Option<String> queryString, scala.Option<String> fragment) Creates a new Uri instance from the given components.apply(org.parboiled2.ParserInput input) Parses a valid URI string into a normalized URI reference as defined by http://tools.ietf.org/html/rfc3986#section-4.1.apply(org.parboiled2.ParserInput input, Charset charset, Uri.ParsingMode mode) Parses a valid URI string into a normalized URI reference as defined by http://tools.ietf.org/html/rfc3986#section-4.1.apply(org.parboiled2.ParserInput input, Uri.ParsingMode mode) Parses a valid URI string into a normalized URI reference as defined by http://tools.ietf.org/html/rfc3986#section-4.1.collapseDotSegments(Uri.Path path) create(String scheme, String userinfo, Uri.Host host, int port, Uri.Path path, scala.Option<String> queryString, scala.Option<String> fragment) create(String scheme, Uri.Authority authority, Uri.Path path, scala.Option<String> queryString, scala.Option<String> fragment) createUnsafe(String scheme, Uri.Authority authority, Uri.Path path, scala.Option<String> queryString, scala.Option<String> fragment) 'Unsafe' in the sense that queryString validation must already have been done.decode(String string, Charset charset, int ix, StringBuilder sb) effectiveHttpRequestUri(String scheme, Uri.Host host, int port, Uri.Path path, scala.Option<String> query, scala.Option<String> fragment, boolean securedConnection, Uri.Host hostHeaderHost, int hostHeaderPort, Uri.Authority defaultAuthority) Converts a set of URI components to an "effective HTTP request URI" as defined by http://tools.ietf.org/html/rfc7230#section-5.5.effectiveRequestUri(String scheme, Uri.Host host, int port, Uri.Path path, scala.Option<String> query, scala.Option<String> fragment, String defaultScheme, Uri.Host hostHeaderHost, int hostHeaderPort, Uri.Authority defaultAuthority) Converts a set of URI components to an "effective request URI" as defined by http://tools.ietf.org/html/rfc7230#section-5.5.scala.runtime.Nothing$from(String scheme, String userinfo, String host, int port, String path, scala.Option<String> queryString, scala.Option<String> fragment, Uri.ParsingMode mode) Creates a new Uri instance from the given components.httpScheme(boolean securedConnection) normalize(org.parboiled2.ParserInput uri, Charset charset, Uri.ParsingMode mode) Normalizes the given URI string by performing the following normalizations: - theschemeandhostcomponents are converted to lowercase - a potentially existingportcomponent is removed if it matches one of the defined default ports for the scheme - percent-encoded octets are decoded if allowed, otherwise they are converted to uppercase hex notation -.and..path segments are resolved as far as possibleintnormalizePort(int port, String scheme) normalizeScheme(String scheme) parseAbsolute(org.parboiled2.ParserInput input, Charset charset, Uri.ParsingMode mode) Parses a string into a normalized absolute URI as defined by http://tools.ietf.org/html/rfc3986#section-4.3.parseAndResolve(org.parboiled2.ParserInput string, Uri base, Charset charset, Uri.ParsingMode mode) Parses a string into a normalized URI reference that is immediately resolved against the given base URI as defined by http://tools.ietf.org/html/rfc3986#section-5.2.parseHttp2AuthorityPseudoHeader(org.parboiled2.ParserInput headerValue, Charset charset, Uri.ParsingMode mode) Parses the given string as if it were the value of an HTTP/2 ":authority" pseudo-header.parseHttp2PathPseudoHeader(org.parboiled2.ParserInput headerValue, Charset charset, Uri.ParsingMode mode) Parses the given string as if it were the value of an HTTP/2 ":path" pseudo-header.parseHttpRequestTarget(org.parboiled2.ParserInput requestTarget, Charset charset, Uri.ParsingMode mode) Parses the given string into an HTTP request target URI as defined by http://tools.ietf.org/html/rfc7230#section-5.3.resolveUnsafe(String scheme, String userinfo, Uri.Host host, int port, Uri.Path path, scala.Option<String> query, scala.Option<String> fragment, Uri base) https://tools.ietf.org/html/rfc3986#section-5.2.2verifyPath(Uri.Path path, String scheme, Uri.Host host) websocketScheme(boolean securedConnection)
-
Field Details
-
MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Constructor Details
-
Uri$
public Uri$()
-
-
Method Details
-
apply
Parses a valid URI string into a normalized URI reference as defined by http://tools.ietf.org/html/rfc3986#section-4.1. Percent-encoded octets are UTF-8 decoded. Accepts unencoded visible 7-bit ASCII characters in addition to the RFC. If the given string is not a valid URI the method throws anIllegalUriException.- Parameters:
input- (undocumented)- Returns:
- (undocumented)
-
apply
Parses a valid URI string into a normalized URI reference as defined by http://tools.ietf.org/html/rfc3986#section-4.1. Percent-encoded octets are decoded using the given charset (where specified by the RFC). Accepts unencoded visible 7-bit ASCII characters in addition to the rfc. If the given string is not a valid URI the method throws anIllegalUriException.- Parameters:
input- (undocumented)- Returns:
- (undocumented)
-
apply
Parses a valid URI string into a normalized URI reference as defined by http://tools.ietf.org/html/rfc3986#section-4.1. Percent-encoded octets are decoded using the given charset (where specified by the RFC). If the given string is not a valid URI the method throws anIllegalUriException.- Parameters:
mode- ifRelaxed, accepts unencoded visible 7-bit ASCII characters in addition to the RFC.input- (undocumented)- Returns:
- (undocumented)
-
apply
Parses a valid URI string into a normalized URI reference as defined by http://tools.ietf.org/html/rfc3986#section-4.1. Percent-encoded octets are decoded using the given charset (where specified by the RFC). If the given string is not a valid URI the method throws anIllegalUriException.- Parameters:
mode- ifRelaxed, accepts unencoded visible 7-bit ASCII characters in addition to the RFC.input- (undocumented)charset- (undocumented)- Returns:
- (undocumented)
-
apply
public Uri apply(String scheme, Uri.Authority authority, Uri.Path path, scala.Option<String> queryString, scala.Option<String> fragment) Creates a new Uri instance from the given components. All components are verified and normalized except the authority which is kept as provided. If the given combination of components does not constitute a valid URI as defined by http://tools.ietf.org/html/rfc3986 the method throws anIllegalUriException.- Parameters:
queryString- percent-encoded query string. When characters are encountered that are outside of the RFC3986 range they are automatically percent-encodedscheme- (undocumented)authority- (undocumented)path- (undocumented)fragment- (undocumented)- Returns:
- (undocumented)
-
from
public Uri from(String scheme, String userinfo, String host, int port, String path, scala.Option<String> queryString, scala.Option<String> fragment, Uri.ParsingMode mode) Creates a new Uri instance from the given components. All components are verified and normalized. If the given combination of components does not constitute a valid URI as defined by http://tools.ietf.org/html/rfc3986 the method throws anIllegalUriException.- Parameters:
scheme- (undocumented)userinfo- (undocumented)host- (undocumented)port- (undocumented)path- (undocumented)queryString- (undocumented)fragment- (undocumented)mode- (undocumented)- Returns:
- (undocumented)
-
parseAbsolute
Parses a string into a normalized absolute URI as defined by http://tools.ietf.org/html/rfc3986#section-4.3. Percent-encoded octets are decoded using the given charset (where specified by the RFC). If the given string is not a valid URI the method throws anIllegalUriException.- Parameters:
mode- ifRelaxed, accepts unencoded visible 7-bit ASCII characters in addition to the RFC.input- (undocumented)charset- (undocumented)- Returns:
- (undocumented)
-
parseAndResolve
public Uri parseAndResolve(org.parboiled2.ParserInput string, Uri base, Charset charset, Uri.ParsingMode mode) Parses a string into a normalized URI reference that is immediately resolved against the given base URI as defined by http://tools.ietf.org/html/rfc3986#section-5.2. Note that the given base Uri must be absolute (i.e. define a scheme). Percent-encoded octets are decoded using the given charset (where specified by the RFC). If the given string is not a valid URI the method throws anIllegalUriException.- Parameters:
mode- ifRelaxed, accepts unencoded visible 7-bit ASCII characters in addition to the RFC.string- (undocumented)base- (undocumented)charset- (undocumented)- Returns:
- (undocumented)
-
parseHttpRequestTarget
public Uri parseHttpRequestTarget(org.parboiled2.ParserInput requestTarget, Charset charset, Uri.ParsingMode mode) Parses the given string into an HTTP request target URI as defined by http://tools.ietf.org/html/rfc7230#section-5.3. If the given string is not a valid URI the method throws anIllegalUriException.- Parameters:
mode- ifRelaxed, accepts unencoded visible 7-bit ASCII characters in addition to the RFC.requestTarget- (undocumented)charset- (undocumented)- Returns:
- (undocumented)
-
parseHttp2PathPseudoHeader
public scala.Tuple2<Uri.Path,scala.Option<String>> parseHttp2PathPseudoHeader(org.parboiled2.ParserInput headerValue, Charset charset, Uri.ParsingMode mode) Parses the given string as if it were the value of an HTTP/2 ":path" pseudo-header. The result is a path and a query string as defined in https://tools.ietf.org/html/rfc7540#section-8.1.2.3 If the given string is not a valid path or query string the method throws anIllegalUriException.- Parameters:
mode- ifRelaxed, accepts unencoded visible 7-bit ASCII characters in addition to the RFC.headerValue- (undocumented)charset- (undocumented)- Returns:
- path and percent-encoded query string. When in in 'relaxed' mode, characters not permitted by https://tools.ietf.org/html/rfc3986#section-3.4 are already automatically percent-encoded here
-
parseHttp2AuthorityPseudoHeader
public Uri.Authority parseHttp2AuthorityPseudoHeader(org.parboiled2.ParserInput headerValue, Charset charset, Uri.ParsingMode mode) Parses the given string as if it were the value of an HTTP/2 ":authority" pseudo-header. The result is an authority object. https://tools.ietf.org/html/rfc7540#section-8.1.2.3 If the given string is not a valid path or query string the method throws anIllegalUriException.- Parameters:
mode- ifRelaxed, accepts unencoded visible 7-bit ASCII characters in addition to the RFC.headerValue- (undocumented)charset- (undocumented)- Returns:
- (undocumented)
-
normalize
Normalizes the given URI string by performing the following normalizations: - theschemeandhostcomponents are converted to lowercase - a potentially existingportcomponent is removed if it matches one of the defined default ports for the scheme - percent-encoded octets are decoded if allowed, otherwise they are converted to uppercase hex notation -.and..path segments are resolved as far as possibleIf the given string is not a valid URI the method throws an
IllegalUriException.- Parameters:
mode- ifRelaxed, accepts unencoded visible 7-bit ASCII characters in addition to the RFC.uri- (undocumented)charset- (undocumented)- Returns:
- (undocumented)
-
effectiveHttpRequestUri
public Uri effectiveHttpRequestUri(String scheme, Uri.Host host, int port, Uri.Path path, scala.Option<String> query, scala.Option<String> fragment, boolean securedConnection, Uri.Host hostHeaderHost, int hostHeaderPort, Uri.Authority defaultAuthority) Converts a set of URI components to an "effective HTTP request URI" as defined by http://tools.ietf.org/html/rfc7230#section-5.5.- Parameters:
scheme- (undocumented)host- (undocumented)port- (undocumented)path- (undocumented)query- (undocumented)fragment- (undocumented)securedConnection- (undocumented)hostHeaderHost- (undocumented)hostHeaderPort- (undocumented)defaultAuthority- (undocumented)- Returns:
- (undocumented)
-
effectiveRequestUri
public Uri effectiveRequestUri(String scheme, Uri.Host host, int port, Uri.Path path, scala.Option<String> query, scala.Option<String> fragment, String defaultScheme, Uri.Host hostHeaderHost, int hostHeaderPort, Uri.Authority defaultAuthority) Converts a set of URI components to an "effective request URI" as defined by http://tools.ietf.org/html/rfc7230#section-5.5.- Parameters:
scheme- (undocumented)host- (undocumented)port- (undocumented)path- (undocumented)query- (undocumented)fragment- (undocumented)defaultScheme- (undocumented)hostHeaderHost- (undocumented)hostHeaderPort- (undocumented)defaultAuthority- (undocumented)- Returns:
- (undocumented)
-
httpScheme
-
websocketScheme
-
resolveUnsafe
public Uri resolveUnsafe(String scheme, String userinfo, Uri.Host host, int port, Uri.Path path, scala.Option<String> query, scala.Option<String> fragment, Uri base) https://tools.ietf.org/html/rfc3986#section-5.2.2'Unsafe' in the sense that queryString validation must already have been done.
- Parameters:
query- percent-encoded query string that must be guaranteed not to contain invalid percent-encodings or characters not allowed by the RFC.scheme- (undocumented)userinfo- (undocumented)host- (undocumented)port- (undocumented)path- (undocumented)fragment- (undocumented)base- (undocumented)- Returns:
- (undocumented)
-
decode
-
decode
-
normalizeScheme
-
normalizePort
-
verifyPath
-
collapseDotSegments
-
fail
-
create
public Uri create(String scheme, String userinfo, Uri.Host host, int port, Uri.Path path, scala.Option<String> queryString, scala.Option<String> fragment) - Parameters:
queryString- percent-encoded query string. When characters are encountered that are outside of the RFC3986 range they are automatically percent-encodedscheme- (undocumented)userinfo- (undocumented)host- (undocumented)port- (undocumented)path- (undocumented)fragment- (undocumented)- Returns:
- (undocumented)
-
create
public Uri create(String scheme, Uri.Authority authority, Uri.Path path, scala.Option<String> queryString, scala.Option<String> fragment) - Parameters:
queryString- percent-encoded query string. When characters are encountered that are outside of the RFC3986 range they are automatically percent-encodedscheme- (undocumented)authority- (undocumented)path- (undocumented)fragment- (undocumented)- Returns:
- (undocumented)
-
createUnsafe
public Uri createUnsafe(String scheme, Uri.Authority authority, Uri.Path path, scala.Option<String> queryString, scala.Option<String> fragment) 'Unsafe' in the sense that queryString validation must already have been done.- Parameters:
queryString- percent-encoded query string that must be guaranteed not to contain invalid percent-encodings or characters not allowed by the RFC.scheme- (undocumented)authority- (undocumented)path- (undocumented)fragment- (undocumented)- Returns:
- (undocumented)
-