Class Uris
-
- org.thymeleaf.expression.Uris
-
public final class Uris extends
Expression Object for performing URI/URL operations (esp.escaping/unescaping) inside Thymeleaf Standard Expressions.
An object of this class is usually available in variable evaluation expressions with the name
#uris
.- Since:
- 2.1.4
- Author:
- Daniel Fernández
-
-
Constructor Summary
Constructors Constructor Description Uris()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description text)
Perform am URI fragment identifier escape operation on aString
input usingUTF-8
as encoding.text, encoding)
Perform am URI fragment identifier escape operation on aString
input.text)
Perform am URI path escape operation on aString
input usingUTF-8
as encoding.text, encoding)
Perform am URI path escape operation on aString
input.text)
Perform am URI path segment escape operation on aString
input usingUTF-8
as encoding.text, encoding)
Perform am URI path segment escape operation on aString
input.text)
Perform am URI query parameter (name or value) escape operation on aString
input usingUTF-8
as encoding.text, encoding)
Perform am URI query parameter (name or value) escape operation on aString
input.text)
Perform am URI fragment identifier unescape operation on aString
input usingUTF-8
as encoding.text, encoding)
Perform am URI fragment identifier unescape operation on aString
input.text)
Perform am URI path unescape operation on aString
input usingUTF-8
as encoding.text, encoding)
Perform am URI path unescape operation on aString
input.text)
Perform am URI path segment unescape operation on aString
input usingUTF-8
as encoding.text, encoding)
Perform am URI path segment unescape operation on aString
input.text)
Perform am URI query parameter (name or value) unescape operation on aString
input usingUTF-8
as encoding.text, encoding)
Perform am URI query parameter (name or value) unescape operation on aString
input.
-
-
-
Method Detail
-
escapePath
public escapePath( text)
Perform am URI path escape operation on a
String
input usingUTF-8
as encoding.This method simply calls the equivalent method in the
UriEscape
class from the library.The following are the only allowed chars in an URI path (will not be escaped):
A-Z a-z 0-9
- . _ ~
! $ & ' ( ) * + , ; =
: @
/
All other chars will be escaped by converting them to the sequence of bytes that represents them in the
UTF-8
and then representing each byte in%HH
syntax, beingHH
the hexadecimal representation of the byte.This method is thread-safe.
- Parameters:
text
- theString
to be escaped.- Returns:
- The escaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no escaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
unescapePath
public unescapePath( text)
Perform am URI path unescape operation on a
String
input usingUTF-8
as encoding.This method simply calls the equivalent method in the
UriEscape
class from the library.This method will unescape every percent-encoded (
%HH
) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice).This method will use
UTF-8
in order to determine the characters specified in the percent-encoded byte sequences.This method is thread-safe.
- Parameters:
text
- theString
to be unescaped.- Returns:
- The unescaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no unescaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
escapePath
public escapePath( text, encoding)
Perform am URI path escape operation on a
String
input.This method simply calls the equivalent method in the
UriEscape
class from the library.The following are the only allowed chars in an URI path (will not be escaped):
A-Z a-z 0-9
- . _ ~
! $ & ' ( ) * + , ; =
: @
/
All other chars will be escaped by converting them to the sequence of bytes that represents them in the specified encoding and then representing each byte in
%HH
syntax, beingHH
the hexadecimal representation of the byte.This method is thread-safe.
- Parameters:
text
- theString
to be escaped.encoding
- the encoding to be used for unescaping.- Returns:
- The escaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no escaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
unescapePath
public unescapePath( text, encoding)
Perform am URI path unescape operation on a
String
input.This method simply calls the equivalent method in the
UriEscape
class from the library.This method will unescape every percent-encoded (
%HH
) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice).This method will use the specified
encoding
in order to determine the characters specified in the percent-encoded byte sequences.This method is thread-safe.
- Parameters:
text
- theString
to be unescaped.encoding
- the encoding to be used for unescaping.- Returns:
- The unescaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no unescaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
escapePathSegment
public escapePathSegment( text)
Perform am URI path segment escape operation on a
String
input usingUTF-8
as encoding.This method simply calls the equivalent method in the
UriEscape
class from the library.The following are the only allowed chars in an URI path segment (will not be escaped):
A-Z a-z 0-9
- . _ ~
! $ & ' ( ) * + , ; =
: @
All other chars will be escaped by converting them to the sequence of bytes that represents them in the
UTF-8
and then representing each byte in%HH
syntax, beingHH
the hexadecimal representation of the byte.This method is thread-safe.
- Parameters:
text
- theString
to be escaped.- Returns:
- The escaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no escaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
unescapePathSegment
public unescapePathSegment( text)
Perform am URI path segment unescape operation on a
String
input usingUTF-8
as encoding.This method simply calls the equivalent method in the
UriEscape
class from the library.This method will unescape every percent-encoded (
%HH
) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice).This method will use
UTF-8
in order to determine the characters specified in the percent-encoded byte sequences.This method is thread-safe.
- Parameters:
text
- theString
to be unescaped.- Returns:
- The unescaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no unescaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
escapePathSegment
public escapePathSegment( text, encoding)
Perform am URI path segment escape operation on a
String
input.This method simply calls the equivalent method in the
UriEscape
class from the library.The following are the only allowed chars in an URI path segment (will not be escaped):
A-Z a-z 0-9
- . _ ~
! $ & ' ( ) * + , ; =
: @
All other chars will be escaped by converting them to the sequence of bytes that represents them in the specified encoding and then representing each byte in
%HH
syntax, beingHH
the hexadecimal representation of the byte.This method is thread-safe.
- Parameters:
text
- theString
to be escaped.encoding
- the encoding to be used for escaping.- Returns:
- The escaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no escaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
unescapePathSegment
public unescapePathSegment( text, encoding)
Perform am URI path segment unescape operation on a
String
input.This method simply calls the equivalent method in the
UriEscape
class from the library.This method will unescape every percent-encoded (
%HH
) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice).This method will use specified
encoding
in order to determine the characters specified in the percent-encoded byte sequences.This method is thread-safe.
- Parameters:
text
- theString
to be unescaped.encoding
- the encoding to be used for unescaping.- Returns:
- The unescaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no unescaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
escapeFragmentId
public escapeFragmentId( text)
Perform am URI fragment identifier escape operation on a
String
input usingUTF-8
as encoding.This method simply calls the equivalent method in the
UriEscape
class from the library.The following are the only allowed chars in an URI fragment identifier (will not be escaped):
A-Z a-z 0-9
- . _ ~
! $ & ' ( ) * + , ; =
: @
/ ?
All other chars will be escaped by converting them to the sequence of bytes that represents them in the
UTF-8
and then representing each byte in%HH
syntax, beingHH
the hexadecimal representation of the byte.This method is thread-safe.
- Parameters:
text
- theString
to be escaped.- Returns:
- The escaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no escaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
unescapeFragmentId
public unescapeFragmentId( text)
Perform am URI fragment identifier unescape operation on a
String
input usingUTF-8
as encoding.This method simply calls the equivalent method in the
UriEscape
class from the library.This method will unescape every percent-encoded (
%HH
) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice).This method will use
UTF-8
in order to determine the characters specified in the percent-encoded byte sequences.This method is thread-safe.
- Parameters:
text
- theString
to be unescaped.- Returns:
- The unescaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no unescaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
escapeFragmentId
public escapeFragmentId( text, encoding)
Perform am URI fragment identifier escape operation on a
String
input.This method simply calls the equivalent method in the
UriEscape
class from the library.The following are the only allowed chars in an URI fragment identifier (will not be escaped):
A-Z a-z 0-9
- . _ ~
! $ & ' ( ) * + , ; =
: @
/ ?
All other chars will be escaped by converting them to the sequence of bytes that represents them in the specified encoding and then representing each byte in
%HH
syntax, beingHH
the hexadecimal representation of the byte.This method is thread-safe.
- Parameters:
text
- theString
to be escaped.encoding
- the encoding to be used for escaping.- Returns:
- The escaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no escaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
unescapeFragmentId
public unescapeFragmentId( text, encoding)
Perform am URI fragment identifier unescape operation on a
String
input.This method simply calls the equivalent method in the
UriEscape
class from the library.This method will unescape every percent-encoded (
%HH
) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice).This method will use specified
encoding
in order to determine the characters specified in the percent-encoded byte sequences.This method is thread-safe.
- Parameters:
text
- theString
to be unescaped.encoding
- the encoding to be used for unescaping.- Returns:
- The unescaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no unescaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
escapeQueryParam
public escapeQueryParam( text)
Perform am URI query parameter (name or value) escape operation on a
String
input usingUTF-8
as encoding.This method simply calls the equivalent method in the
UriEscape
class from the library.The following are the only allowed chars in an URI query parameter (will not be escaped):
A-Z a-z 0-9
- . _ ~
! $ ' ( ) * , ;
: @
/ ?
All other chars will be escaped by converting them to the sequence of bytes that represents them in the
UTF-8
and then representing each byte in%HH
syntax, beingHH
the hexadecimal representation of the byte.This method is thread-safe.
- Parameters:
text
- theString
to be escaped.- Returns:
- The escaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no escaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
unescapeQueryParam
public unescapeQueryParam( text)
Perform am URI query parameter (name or value) unescape operation on a
String
input usingUTF-8
as encoding.This method simply calls the equivalent method in the
UriEscape
class from the library.This method will unescape every percent-encoded (
%HH
) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice).This method will use
UTF-8
in order to determine the characters specified in the percent-encoded byte sequences.This method is thread-safe.
- Parameters:
text
- theString
to be unescaped.- Returns:
- The unescaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no unescaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
escapeQueryParam
public escapeQueryParam( text, encoding)
Perform am URI query parameter (name or value) escape operation on a
String
input.This method simply calls the equivalent method in the
UriEscape
class from the library.The following are the only allowed chars in an URI query parameter (will not be escaped):
A-Z a-z 0-9
- . _ ~
! $ ' ( ) * , ;
: @
/ ?
All other chars will be escaped by converting them to the sequence of bytes that represents them in the specified encoding and then representing each byte in
%HH
syntax, beingHH
the hexadecimal representation of the byte.This method is thread-safe.
- Parameters:
text
- theString
to be escaped.encoding
- the encoding to be used for escaping.- Returns:
- The escaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no escaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
unescapeQueryParam
public unescapeQueryParam( text, encoding)
Perform am URI query parameter (name or value) unescape operation on a
String
input.This method simply calls the equivalent method in the
UriEscape
class from the library.This method will unescape every percent-encoded (
%HH
) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice).This method will use specified
encoding
in order to determine the characters specified in the percent-encoded byte sequences.This method is thread-safe.
- Parameters:
text
- theString
to be unescaped.encoding
- the encoding to be used for unescaping.- Returns:
- The unescaped result
String
. As a memory-performance improvement, will return the exact same object as thetext
input argument if no unescaping modifications were required (and no additionalString
objects will be created during processing). Will returnnull
iftext
isnull
.
-
-