类 DefaultUriBuilderFactory
java.lang.Object
cn.taketoday.web.util.DefaultUriBuilderFactory
- 所有已实现的接口:
UriBuilderFactory,UriTemplateHandler
UriBuilderFactory that relies on UriComponentsBuilder for
the actual building of the URI.
Provides options to create UriBuilder instances with a common
base URI, alternative encoding mode strategies, among others.
- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
- 另请参阅:
-
嵌套类概要
嵌套类修饰符和类型类说明private classDefaultUriBuilderFactoryspecific implementation of UriBuilder.static enumEnum to represent multiple URI encoding strategies. -
字段概要
字段 -
构造器概要
构造器构造器说明Default constructor without a base URI.Variant ofDefaultUriBuilderFactory(String)with aUriComponentsBuilder.DefaultUriBuilderFactory(String baseUriTemplate) Constructor with a base URI. -
方法概要
修饰符和类型方法说明builder()Create a URI builder with default settings.Expand the given URI template with an array of URI variables.Expand the given URI template with a map of URI variables.Return the configured default URI variable values.Return the configured encoding mode.voidsetDefaultUriVariables(Map<String, ?> defaultUriVariables) Provide default URI variable values to use when expanding URI templates with a Map of variables.voidsetEncodingMode(DefaultUriBuilderFactory.EncodingMode encodingMode) Set theencoding modeto use.voidsetParsePath(boolean parsePath) Whether to parse the input path into path segments if the encoding mode is set toEncodingMode.URI_COMPONENT, which ensures that URI variables in the path are encoded according to path segment rules and for example a '/' is encoded.booleanWhether to parse the path into path segments if the encoding mode is set toEncodingMode.URI_COMPONENT.Initialize a builder with the given URI template.
-
字段详细资料
-
baseUri
-
encodingMode
-
defaultUriVariables
-
parsePath
private boolean parsePath
-
-
构造器详细资料
-
DefaultUriBuilderFactory
public DefaultUriBuilderFactory()Default constructor without a base URI.The target address must be specified on each UriBuilder.
-
DefaultUriBuilderFactory
Constructor with a base URI.The given URI template is parsed via
UriComponentsBuilder.fromUriString(java.lang.String)and then applied as a base URI to every UriBuilder viaUriComponentsBuilder.uriComponents(cn.taketoday.web.util.UriComponents)unless the UriBuilder itself was created with a URI template that already has a target address.- 参数:
baseUriTemplate- the URI template to use a base URL
-
DefaultUriBuilderFactory
Variant ofDefaultUriBuilderFactory(String)with aUriComponentsBuilder.
-
-
方法详细资料
-
setEncodingMode
Set theencoding modeto use.By default this is set to
EncodingMode.TEMPLATE_AND_VALUES.Note: Prior to 5.1 the default was
EncodingMode.URI_COMPONENTtherefore theWebClientRestTemplatehave switched their default behavior.- 参数:
encodingMode- the encoding mode to use
-
getEncodingMode
Return the configured encoding mode. -
setDefaultUriVariables
Provide default URI variable values to use when expanding URI templates with a Map of variables.- 参数:
defaultUriVariables- default URI variable values
-
getDefaultUriVariables
Return the configured default URI variable values. -
setParsePath
public void setParsePath(boolean parsePath) Whether to parse the input path into path segments if the encoding mode is set toEncodingMode.URI_COMPONENT, which ensures that URI variables in the path are encoded according to path segment rules and for example a '/' is encoded.By default this is set to
true.- 参数:
parsePath- whether to parse the path into path segments
-
shouldParsePath
public boolean shouldParsePath()Whether to parse the path into path segments if the encoding mode is set toEncodingMode.URI_COMPONENT. -
expand
从接口复制的说明:UriTemplateHandlerExpand the given URI template with a map of URI variables.- 指定者:
expand在接口中UriTemplateHandler- 参数:
uriTemplate- the URI templateuriVars- variable values- 返回:
- the created URI instance
-
expand
从接口复制的说明:UriTemplateHandlerExpand the given URI template with an array of URI variables.- 指定者:
expand在接口中UriTemplateHandler- 参数:
uriTemplate- the URI templateuriVars- variable values- 返回:
- the created URI instance
-
uriString
从接口复制的说明:UriBuilderFactoryInitialize a builder with the given URI template.- 指定者:
uriString在接口中UriBuilderFactory- 参数:
uriTemplate- the URI template to use- 返回:
- the builder instance
-
builder
从接口复制的说明:UriBuilderFactoryCreate a URI builder with default settings.- 指定者:
builder在接口中UriBuilderFactory- 返回:
- the builder instance
-