RFC3986
@Deprecated public class URLEncoder extends Object implements Serializable
1.字符"a"-"z","A"-"Z","0"-"9",".","-","*",和"_" 都不会被编码; 2.将空格转换为%20 ; 3.将非文本内容转换成"%xy"的形式,xy是两位16进制的数值;
PercentCodec
,
Serialized FormModifier and Type | Field and Description |
---|---|
static URLEncoder |
ALL
Deprecated.
全编码的URLEncoder
0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to 0x7A as-is '*', '-', ' |
static URLEncoder |
DEFAULT
Deprecated.
默认URLEncoder
默认的编码器针对URI路径编码,定义如下: default = pchar / "/" pchar = unreserved(不处理) / pct-encoded / sub-delims(子分隔符) / ":" / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" |
static URLEncoder |
FRAGMENT
Deprecated.
URL的Fragment URLEncoder
默认的编码器针对Fragment,定义如下: fragment = *( pchar / "/" / "?" |
static URLEncoder |
PATH_SEGMENT
Deprecated.
URL的Path的每一个Segment URLEncoder
默认的编码器针对URI路径编码,定义如下: pchar = unreserved / pct-encoded / sub-delims / ":"(非空segment不包含:) / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" |
static URLEncoder |
QUERY
Deprecated.
用于查询语句的URLEncoder
编码器针对URI路径编码,定义如下: 0x20 ' ' =》 '+' 0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to 0x7A as-is '*', '-', ' |
Constructor and Description |
---|
URLEncoder()
Deprecated.
构造
[a-zA-Z0-9]默认不被编码 |
Modifier and Type | Method and Description |
---|---|
void |
addSafeCharacter(char c)
Deprecated.
增加安全字符
安全字符不被编码 |
static URLEncoder |
createAll()
Deprecated.
创建URLEncoder
编码器针对URI路径编码,定义如下: 0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to 0x7A as-is '*', '-', ' |
static URLEncoder |
createDefault()
Deprecated.
创建默认URLEncoder
默认的编码器针对URI路径编码,定义如下: default = pchar / "/" pchar = unreserved(不处理) / pct-encoded / sub-delims(子分隔符) / ":" / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" |
static URLEncoder |
createFragment()
Deprecated.
URL的Fragment URLEncoder
默认的编码器针对Fragment,定义如下: fragment = *( pchar / "/" / "?" |
static URLEncoder |
createPathSegment()
Deprecated.
URL的Path的每一个Segment URLEncoder
默认的编码器针对URI路径的每一段编码,定义如下: pchar = unreserved / pct-encoded / sub-delims / ":"(非空segment不包含:) / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" |
static URLEncoder |
createQuery()
Deprecated.
创建用于查询语句的URLEncoder
编码器针对URI路径编码,定义如下: 0x20 ' ' =》 '+' 0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to 0x7A as-is '*', '-', ' |
String |
encode(String path,
Charset charset)
Deprecated.
将URL中的字符串编码为%形式
|
void |
removeSafeCharacter(char c)
Deprecated.
移除安全字符
安全字符不被编码 |
void |
setEncodeSpaceAsPlus(boolean encodeSpaceAsPlus)
Deprecated.
是否将空格编码为+
|
public static final URLEncoder DEFAULT
default = pchar / "/" pchar = unreserved(不处理) / pct-encoded / sub-delims(子分隔符) / ":" / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
public static final URLEncoder PATH_SEGMENT
pchar = unreserved / pct-encoded / sub-delims / ":"(非空segment不包含:) / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="定义见:https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
public static final URLEncoder FRAGMENT
fragment = *( pchar / "/" / "?" ) pchar = unreserved / pct-encoded / sub-delims / ":" / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="具体见:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5
public static final URLEncoder QUERY
0x20 ' ' =》 '+' 0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to 0x7A as-is '*', '-', '.', '0' to '9', 'A' to 'Z', '_', 'a' to 'z' Also '=' and '&' 不编码 其它编码为 %nn 形式
详细见:https://www.w3.org/TR/html5/forms.html#application/x-www-form-urlencoded-encoding-algorithm
public static final URLEncoder ALL
0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to 0x7A as-is '*', '-', '.', '0' to '9', 'A' to 'Z', '_', 'a' to 'z' 不编码 其它编码为 %nn 形式
public static URLEncoder createDefault()
default = pchar / "/" pchar = unreserved(不处理) / pct-encoded / sub-delims(子分隔符) / ":" / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
public static URLEncoder createPathSegment()
pchar = unreserved / pct-encoded / sub-delims / ":"(非空segment不包含:) / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="定义见:https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
public static URLEncoder createFragment()
fragment = *( pchar / "/" / "?" ) pchar = unreserved / pct-encoded / sub-delims / ":" / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="具体见:https://datatracker.ietf.org/doc/html/rfc3986#section-3.5
public static URLEncoder createQuery()
0x20 ' ' =》 '+' 0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to 0x7A as-is '*', '-', '.', '0' to '9', 'A' to 'Z', '_', 'a' to 'z' Also '=' and '&' 不编码 其它编码为 %nn 形式
详细见:https://www.w3.org/TR/html5/forms.html#application/x-www-form-urlencoded-encoding-algorithm
public static URLEncoder createAll()
0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to 0x7A as-is '*', '-', '.', '0' to '9', 'A' to 'Z', '_', 'a' to 'z' 不编码 其它编码为 %nn 形式
详细见:https://www.w3.org/TR/html5/forms.html#application/x-www-form-urlencoded-encoding-algorithm
public void addSafeCharacter(char c)
c
- 字符public void removeSafeCharacter(char c)
c
- 字符public void setEncodeSpaceAsPlus(boolean encodeSpaceAsPlus)
encodeSpaceAsPlus
- 是否将空格编码为+Copyright © 2024. All rights reserved.