|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.http.client.utils.URIUtils
public class URIUtils
A collection of utilities for URIs
, to workaround
bugs within the class or for ease-of-use features.
Nested Class Summary | |
---|---|
static class |
URIUtils.UriFlag
Flags that control how URI is being rewritten. |
Field Summary | |
---|---|
static EnumSet<URIUtils.UriFlag> |
DROP_FRAGMENT
Set of uri flags containing URIUtils.UriFlag.DROP_FRAGMENT . |
static EnumSet<URIUtils.UriFlag> |
DROP_FRAGMENT_AND_NORMALIZE
Set of uri flags containing URIUtils.UriFlag.DROP_FRAGMENT and URIUtils.UriFlag.NORMALIZE . |
static EnumSet<URIUtils.UriFlag> |
NO_FLAGS
Empty set of uri flags. |
static EnumSet<URIUtils.UriFlag> |
NORMALIZE
Set of uri flags containing URIUtils.UriFlag.NORMALIZE . |
Method Summary | |
---|---|
static URI |
createURI(String scheme,
String host,
int port,
String path,
String query,
String fragment)
Deprecated. (4.2) use URIBuilder . |
static org.apache.http.HttpHost |
extractHost(URI uri)
Extracts target host from the given URI . |
static URI |
normalizeSyntax(URI uri)
Removes dot segments according to RFC 3986, section 5.2.4 and Syntax-Based Normalization according to RFC 3986, section 6.2.2. |
static URI |
resolve(URI originalURI,
org.apache.http.HttpHost target,
List<URI> redirects)
Derives the interpreted (absolute) URI that was used to generate the last request. |
static URI |
resolve(URI baseURI,
String reference)
Resolves a URI reference against a base URI. |
static URI |
resolve(URI baseURI,
URI reference)
Resolves a URI reference against a base URI. |
static URI |
rewriteURI(URI uri)
A convenience method that creates a new URI whose scheme, host, port, path,
query are taken from the existing URI, dropping any fragment or user-information. |
static URI |
rewriteURI(URI uri,
org.apache.http.HttpHost target)
A convenience method for rewriteURI(URI, HttpHost, EnumSet) that always keeps the
fragment. |
static URI |
rewriteURI(URI uri,
org.apache.http.HttpHost target,
boolean dropFragment)
Deprecated. (4.5.8) Use rewriteURI(URI, HttpHost, EnumSet) |
static URI |
rewriteURI(URI uri,
org.apache.http.HttpHost target,
EnumSet<URIUtils.UriFlag> flags)
A convenience method for creating a new URI whose scheme, host
and port are taken from the target host, but whose path, query and
fragment are taken from the existing URI. |
static URI |
rewriteURIForRoute(URI uri,
RouteInfo route)
A convenience method that optionally converts the original URI either
to a relative or an absolute form as required by the specified route. |
static URI |
rewriteURIForRoute(URI uri,
RouteInfo route,
boolean normalizeUri)
A convenience method that optionally converts the original URI either
to a relative or an absolute form as required by the specified route. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final EnumSet<URIUtils.UriFlag> NO_FLAGS
public static final EnumSet<URIUtils.UriFlag> DROP_FRAGMENT
URIUtils.UriFlag.DROP_FRAGMENT
.
public static final EnumSet<URIUtils.UriFlag> NORMALIZE
URIUtils.UriFlag.NORMALIZE
.
public static final EnumSet<URIUtils.UriFlag> DROP_FRAGMENT_AND_NORMALIZE
URIUtils.UriFlag.DROP_FRAGMENT
and URIUtils.UriFlag.NORMALIZE
.
Method Detail |
---|
@Deprecated public static URI createURI(String scheme, String host, int port, String path, String query, String fragment) throws URISyntaxException
URIBuilder
.
URI
using all the parameters. This should be
used instead of
URI.URI(String, String, String, int, String, String, String)
or any of the other URI multi-argument URI constructors.
scheme
- Scheme namehost
- Host nameport
- Port numberpath
- Pathquery
- Queryfragment
- Fragment
URISyntaxException
- If both a scheme and a path are given but the path is
relative, if the URI string constructed from the given
components violates RFC 2396, or if the authority
component of the string is present but cannot be parsed
as a server-based authority@Deprecated public static URI rewriteURI(URI uri, org.apache.http.HttpHost target, boolean dropFragment) throws URISyntaxException
rewriteURI(URI, HttpHost, EnumSet)
URI
whose scheme, host
and port are taken from the target host, but whose path, query and
fragment are taken from the existing URI. The fragment is only used if
dropFragment is false. The path is set to "/" if not explicitly specified.
uri
- Contains the path, query and fragment to use.target
- Contains the scheme, host and port to use.dropFragment
- True if the fragment should not be copied.
URISyntaxException
- If the resulting URI is invalid.public static URI rewriteURI(URI uri, org.apache.http.HttpHost target, EnumSet<URIUtils.UriFlag> flags) throws URISyntaxException
URI
whose scheme, host
and port are taken from the target host, but whose path, query and
fragment are taken from the existing URI. What exactly is used and how
is driven by the passed in flags. The path is set to "/" if not explicitly specified.
uri
- Contains the path, query and fragment to use.target
- Contains the scheme, host and port to use.flags
- True if the fragment should not be copied.
URISyntaxException
- If the resulting URI is invalid.public static URI rewriteURI(URI uri, org.apache.http.HttpHost target) throws URISyntaxException
rewriteURI(URI, HttpHost, EnumSet)
that always keeps the
fragment.
URISyntaxException
public static URI rewriteURI(URI uri) throws URISyntaxException
URI
whose scheme, host, port, path,
query are taken from the existing URI, dropping any fragment or user-information.
The path is set to "/" if not explicitly specified. The existing URI is returned
unmodified if it has no fragment or user-information and has a path.
uri
- original URI.
URISyntaxException
- If the resulting URI is invalid.public static URI rewriteURIForRoute(URI uri, RouteInfo route) throws URISyntaxException
URI
either
to a relative or an absolute form as required by the specified route.
uri
- original URI.
URISyntaxException
- If the resulting URI is invalid.public static URI rewriteURIForRoute(URI uri, RouteInfo route, boolean normalizeUri) throws URISyntaxException
URI
either
to a relative or an absolute form as required by the specified route.
uri
- original URI.
URISyntaxException
- If the resulting URI is invalid.public static URI resolve(URI baseURI, String reference)
baseURI
- the base URIreference
- the URI reference
public static URI resolve(URI baseURI, URI reference)
baseURI
- the base URIreference
- the URI reference
public static URI normalizeSyntax(URI uri) throws URISyntaxException
uri
- the original URI
URISyntaxException
public static org.apache.http.HttpHost extractHost(URI uri)
URI
.
uri
-
null
if the URI is
relative or does not contain a valid host name.public static URI resolve(URI originalURI, org.apache.http.HttpHost target, List<URI> redirects) throws URISyntaxException
URI
.
originalURI
- original request before any redirectstarget
- if the last URI is relative, it is resolved against this target,
or null
if not available.redirects
- collection of redirect locations since the original request
or null
if not available.
URISyntaxException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |