Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
54636b3f
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
54636b3f
编写于
5月 20, 2014
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Further UriComponentsBuilder javadoc revision
上级
545c28fd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
51 deletion
+49
-51
spring-web/src/main/java/org/springframework/web/util/UriComponents.java
...main/java/org/springframework/web/util/UriComponents.java
+20
-20
spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java
...va/org/springframework/web/util/UriComponentsBuilder.java
+29
-31
未找到文件。
spring-web/src/main/java/org/springframework/web/util/UriComponents.java
浏览文件 @
54636b3f
...
...
@@ -30,10 +30,10 @@ import org.springframework.util.Assert;
import
org.springframework.util.MultiValueMap
;
/**
* Represents an immutable collection of URI components, mapping component type to
String
*
values. Contains convenience getters for all components. Effectively similar to {@link
*
java.net.URI}, but with more powerful encoding options and support for URI template
* variables.
* Represents an immutable collection of URI components, mapping component type to
*
String values. Contains convenience getters for all components. Effectively similar
*
to {@link java.net.URI}, but with more powerful encoding options and support for
*
URI template
variables.
*
* @author Arjen Poutsma
* @since 3.1
...
...
@@ -135,17 +135,17 @@ public abstract class UriComponents implements Serializable {
* Encode all URI components using their specific encoding rules, and
* returns the result as a new {@code UriComponents} instance.
* @param encoding the encoding of the values contained in this map
* @return the encoded
uri
components
* @return the encoded
URI
components
* @throws UnsupportedEncodingException if the given encoding is not supported
*/
public
abstract
UriComponents
encode
(
String
encoding
)
throws
UnsupportedEncodingException
;
/**
* Replace all URI template variables with the values from a given map.
The map keys
*
represent variable names; the values variable values. The order of variables is not
* significant.
* Replace all URI template variables with the values from a given map.
*
<p>The given map keys represent variable names; the corresponding values
*
represent variable values. The order of variables is not
significant.
* @param uriVariables the map of URI variables
* @return the expanded
uri
components
* @return the expanded
URI
components
*/
public
final
UriComponents
expand
(
Map
<
String
,
?>
uriVariables
)
{
Assert
.
notNull
(
uriVariables
,
"'uriVariables' must not be null"
);
...
...
@@ -153,10 +153,10 @@ public abstract class UriComponents implements Serializable {
}
/**
* Replace all URI template variables with the values from a given array.
The array
*
represent
variable values. The order of variables is significant.
* @param uriVariableValues URI variable values
* @return the expanded
uri
components
* Replace all URI template variables with the values from a given array.
*
<p>The given array represents
variable values. The order of variables is significant.
* @param uriVariableValues
the
URI variable values
* @return the expanded
URI
components
*/
public
final
UriComponents
expand
(
Object
...
uriVariableValues
)
{
Assert
.
notNull
(
uriVariableValues
,
"'uriVariableValues' must not be null"
);
...
...
@@ -164,14 +164,14 @@ public abstract class UriComponents implements Serializable {
}
/**
* Replace all URI template variables with the values
obtained through the
*
given {@link UriTemplateVariables} instance
.
* @param uri
TemplateVars resolves URI template variabl
e values
* @return the expanded
uri
components
* Replace all URI template variables with the values
from the given
*
{@link UriTemplateVariables}
.
* @param uri
Variables the URI templat
e values
* @return the expanded
URI
components
*/
public
final
UriComponents
expand
(
UriTemplateVariables
uri
TemplateVar
s
)
{
Assert
.
notNull
(
uri
TemplateVars
,
"'uriTemplateVar
s' must not be null"
);
return
expandInternal
(
uri
TemplateVar
s
);
public
final
UriComponents
expand
(
UriTemplateVariables
uri
Variable
s
)
{
Assert
.
notNull
(
uri
Variables
,
"'uriVariable
s' must not be null"
);
return
expandInternal
(
uri
Variable
s
);
}
/**
...
...
spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java
浏览文件 @
54636b3f
...
...
@@ -34,15 +34,15 @@ import org.springframework.web.util.HierarchicalUriComponents.PathComponent;
/**
* Builder for {@link UriComponents}.
*
* <p>
</p>
Typical usage involves:
* <p>Typical usage involves:
* <ol>
*
<li>Create a {@code UriComponentsBuilder} with one of the static factory methods (such a
s
*
{@link #fromPath(String)} or {@link #fromUri(URI)})</li>
*
<li>Set the various URI components through the respective methods ({@link #scheme(String)},
*
{@link #userInfo(String)}, {@link #host(String)}, {@link #port(int)}, {@link #path(String)},
*
{@link #pathSegment(String...)}, {@link #queryParam(String, Object...)}, and
*
{@link #fragment(String)}.</li>
*
<li>Build the {@link UriComponents} instance with the {@link #build()} method.</li>
*
<li>Create a {@code UriComponentsBuilder} with one of the static factory method
s
*
(such as
{@link #fromPath(String)} or {@link #fromUri(URI)})</li>
* <li>Set the various URI components through the respective methods ({@link #scheme(String)},
* {@link #userInfo(String)}, {@link #host(String)}, {@link #port(int)}, {@link #path(String)},
* {@link #pathSegment(String...)}, {@link #queryParam(String, Object...)}, and
* {@link #fragment(String)}.</li>
* <li>Build the {@link UriComponents} instance with the {@link #build()} method.</li>
* </ol>
*
* @author Arjen Poutsma
...
...
@@ -303,7 +303,7 @@ public class UriComponentsBuilder {
// URI components methods
/**
* Initialize
s
all components of this URI builder with the components of the given URI.
* Initialize all components of this URI builder with the components of the given URI.
* @param uri the URI
* @return this UriComponentsBuilder
*/
...
...
@@ -352,7 +352,7 @@ public class UriComponentsBuilder {
}
/**
* Set
s
the URI scheme. The given scheme may contain URI template variables,
* Set the URI scheme. The given scheme may contain URI template variables,
* and may also be {@code null} to clear the scheme of this builder.
* @param scheme the URI scheme
* @return this UriComponentsBuilder
...
...
@@ -421,9 +421,8 @@ public class UriComponentsBuilder {
}
/**
* Sets the URI user info. The given user info may contain URI template
* variables, and may also be {@code null} to clear the user info of this
* builder.
* Set the URI user info. The given user info may contain URI template variables,
* and may also be {@code null} to clear the user info of this builder.
* @param userInfo the URI user info
* @return this UriComponentsBuilder
*/
...
...
@@ -434,8 +433,8 @@ public class UriComponentsBuilder {
}
/**
* Set
s the URI host. The given host may contain URI template variables, and
* may also be {@code null} to clear the host of this builder.
* Set
the URI host. The given host may contain URI template variables,
*
and
may also be {@code null} to clear the host of this builder.
* @param host the URI host
* @return this UriComponentsBuilder
*/
...
...
@@ -446,7 +445,7 @@ public class UriComponentsBuilder {
}
/**
* Set
s
the URI port. Passing {@code -1} will clear the port of this builder.
* Set the URI port. Passing {@code -1} will clear the port of this builder.
* @param port the URI port
* @return this UriComponentsBuilder
*/
...
...
@@ -458,8 +457,8 @@ public class UriComponentsBuilder {
}
/**
* Append
s the given path to the existing path of this builder. The given
* path may contain URI template variables.
* Append
the given path to the existing path of this builder.
*
The given
path may contain URI template variables.
* @param path the URI path
* @return this UriComponentsBuilder
*/
...
...
@@ -470,7 +469,7 @@ public class UriComponentsBuilder {
}
/**
* Set
s
the path of this builder overriding all existing path and path segment values.
* Set the path of this builder overriding all existing path and path segment values.
* @param path the URI path; a {@code null} value results in an empty path.
* @return this UriComponentsBuilder
*/
...
...
@@ -481,8 +480,8 @@ public class UriComponentsBuilder {
}
/**
* Append
s the given path segments to the existing path of this builder. Each given
*
path segments
may contain URI template variables.
* Append
the given path segments to the existing path of this builder.
*
Each given path segment
may contain URI template variables.
* @param pathSegments the URI path segments
* @return this UriComponentsBuilder
*/
...
...
@@ -494,7 +493,7 @@ public class UriComponentsBuilder {
}
/**
* Append
s
the given query to the existing query of this builder.
* Append the given query to the existing query of this builder.
* The given query may contain URI template variables.
* <p><strong>Note:</strong> The presence of reserved characters can prevent
* correct parsing of the URI string. For example if a query parameter
...
...
@@ -527,7 +526,7 @@ public class UriComponentsBuilder {
}
/**
* Set
s
the query of this builder overriding all existing query parameters.
* Set the query of this builder overriding all existing query parameters.
* @param query the query string; a {@code null} value removes all query parameters.
* @return this UriComponentsBuilder
*/
...
...
@@ -539,7 +538,7 @@ public class UriComponentsBuilder {
}
/**
* Append
s
the given query parameter to the existing query parameters. The
* Append the given query parameter to the existing query parameters. The
* given name or any of the values may contain URI template variables. If no
* values are given, the resulting URI will contain the query parameter name
* only (i.e. {@code ?foo} instead of {@code ?foo=bar}.
...
...
@@ -563,7 +562,7 @@ public class UriComponentsBuilder {
}
/**
* Add
s
the given query parameters.
* Add the given query parameters.
* @param params the params
* @return this UriComponentsBuilder
*/
...
...
@@ -574,9 +573,8 @@ public class UriComponentsBuilder {
}
/**
* Sets the query parameter values overriding all existing query values for
* the same parameter. If no values are given, the query parameter is
* removed.
* Set the query parameter values overriding all existing query values for
* the same parameter. If no values are given, the query parameter is removed.
* @param name the query parameter name
* @param values the query parameter values
* @return this UriComponentsBuilder
...
...
@@ -592,9 +590,8 @@ public class UriComponentsBuilder {
}
/**
* Sets the URI fragment. The given fragment may contain URI template
* variables, and may also be {@code null} to clear the fragment of this
* builder.
* Set the URI fragment. The given fragment may contain URI template variables,
* and may also be {@code null} to clear the fragment of this builder.
* @param fragment the URI fragment
* @return this UriComponentsBuilder
*/
...
...
@@ -615,6 +612,7 @@ public class UriComponentsBuilder {
PathComponent
build
();
}
private
static
class
CompositePathComponentBuilder
implements
PathComponentBuilder
{
private
final
LinkedList
<
PathComponentBuilder
>
componentBuilders
=
new
LinkedList
<
PathComponentBuilder
>();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录