java.lang.Object | |
↳ | org.springframework.web.util.UriUtils |
Utility class for URI encoding and decoding based on RFC 3986. Offers encoding methods for the various URI components.
All encode*(String, String
methods in this class operate in a similar way:
%xy
" format.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Decodes the given encoded source String into an URI.
| |||||||||||
Encodes the given URI fragment.
| |||||||||||
Encodes the given URI host.
| |||||||||||
Encodes the given HTTP URI into an encoded String.
| |||||||||||
Encodes the given URI path.
| |||||||||||
Encodes the given URI path segment.
| |||||||||||
Encodes the given URI port.
| |||||||||||
Encodes the given URI query.
| |||||||||||
Encodes the given URI query parameter.
| |||||||||||
Encodes the given URI scheme.
| |||||||||||
Encodes the given source URI into an encoded String.
| |||||||||||
Encodes the given source URI components into an encoded String.
| |||||||||||
Encodes the given URI user info.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Decodes the given encoded source String into an URI. Based on the following rules:
"a"
through "z"
,
"A"
through "Z"
, and "0"
through "9"
stay the same.
"-"
, "_"
, "."
, and
"*"
stay the same.
%xy
format.
%xy
" is interpreted as a hexadecimal
representation of the character.
source | the source string |
---|---|
encoding | the encoding |
UnsupportedEncodingException | when the given encoding parameter is not supported |
---|
Encodes the given URI fragment.
fragment | the fragment to be encoded |
---|---|
encoding | the character encoding to encode to |
UnsupportedEncodingException | when the given encoding parameter is not supported |
---|
Encodes the given URI host.
host | the host to be encoded |
---|---|
encoding | the character encoding to encode to |
UnsupportedEncodingException | when the given encoding parameter is not supported |
---|
Encodes the given HTTP URI into an encoded String. All various URI components are encoded according to their respective valid character sets.
Note that this method does not support fragments (#
),
as these are not supposed to be sent to the server, but retained by the client.
httpUrl | the HTTP URL to be encoded |
---|---|
encoding | the character encoding to encode to |
IllegalArgumentException | when the given uri parameter is not a valid URI |
---|---|
UnsupportedEncodingException | when the given encoding parameter is not supported |
Encodes the given URI path.
path | the path to be encoded |
---|---|
encoding | the character encoding to encode to |
UnsupportedEncodingException | when the given encoding parameter is not supported |
---|
Encodes the given URI path segment.
segment | the segment to be encoded |
---|---|
encoding | the character encoding to encode to |
UnsupportedEncodingException | when the given encoding parameter is not supported |
---|
Encodes the given URI port.
port | the port to be encoded |
---|---|
encoding | the character encoding to encode to |
UnsupportedEncodingException | when the given encoding parameter is not supported |
---|
Encodes the given URI query.
query | the query to be encoded |
---|---|
encoding | the character encoding to encode to |
UnsupportedEncodingException | when the given encoding parameter is not supported |
---|
Encodes the given URI query parameter.
queryParam | the query parameter to be encoded |
---|---|
encoding | the character encoding to encode to |
UnsupportedEncodingException | when the given encoding parameter is not supported |
---|
Encodes the given URI scheme.
scheme | the scheme to be encoded |
---|---|
encoding | the character encoding to encode to |
UnsupportedEncodingException | when the given encoding parameter is not supported |
---|
Encodes the given source URI into an encoded String. All various URI components are encoded according to their respective valid character sets.
uri | the URI to be encoded |
---|---|
encoding | the character encoding to encode to |
IllegalArgumentException | when the given uri parameter is not a valid URI |
---|---|
UnsupportedEncodingException | when the given encoding parameter is not supported |
Encodes the given source URI components into an encoded String. All various URI components are optional, but encoded according to their respective valid character sets.
scheme | the scheme |
---|---|
authority | the authority |
userinfo | the user info |
host | the host |
port | the port |
path | the path |
query | the query |
fragment | the fragment |
encoding | the character encoding to encode to |
IllegalArgumentException | when the given uri parameter is not a valid URI |
---|---|
UnsupportedEncodingException | when the given encoding parameter is not supported |
Encodes the given URI user info.
userInfo | the user info to be encoded |
---|---|
encoding | the character encoding to encode to |
UnsupportedEncodingException | when the given encoding parameter is not supported |
---|