类 DefaultUriBuilderFactory

java.lang.Object
cn.taketoday.web.util.DefaultUriBuilderFactory
所有已实现的接口:
UriBuilderFactory, UriTemplateHandler

public class DefaultUriBuilderFactory extends Object implements UriBuilderFactory
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
另请参阅:
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • setEncodingMode

      public void setEncodingMode(DefaultUriBuilderFactory.EncodingMode encodingMode)
      Set the encoding mode to use.

      By default this is set to EncodingMode.TEMPLATE_AND_VALUES.

      Note: Prior to 5.1 the default was EncodingMode.URI_COMPONENT therefore the WebClient RestTemplate have switched their default behavior.

      参数:
      encodingMode - the encoding mode to use
    • getEncodingMode

      public DefaultUriBuilderFactory.EncodingMode getEncodingMode()
      Return the configured encoding mode.
    • setDefaultUriVariables

      public void setDefaultUriVariables(@Nullable Map<String,?> defaultUriVariables)
      Provide default URI variable values to use when expanding URI templates with a Map of variables.
      参数:
      defaultUriVariables - default URI variable values
    • getDefaultUriVariables

      public Map<String,?> 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 to EncodingMode.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 to EncodingMode.URI_COMPONENT.
    • expand

      public URI expand(String uriTemplate, Map<String,?> uriVars)
      从接口复制的说明: UriTemplateHandler
      Expand the given URI template with a map of URI variables.
      指定者:
      expand 在接口中 UriTemplateHandler
      参数:
      uriTemplate - the URI template
      uriVars - variable values
      返回:
      the created URI instance
    • expand

      public URI expand(String uriTemplate, Object... uriVars)
      从接口复制的说明: UriTemplateHandler
      Expand the given URI template with an array of URI variables.
      指定者:
      expand 在接口中 UriTemplateHandler
      参数:
      uriTemplate - the URI template
      uriVars - variable values
      返回:
      the created URI instance
    • uriString

      public UriBuilder uriString(String uriTemplate)
      从接口复制的说明: UriBuilderFactory
      Initialize a builder with the given URI template.
      指定者:
      uriString 在接口中 UriBuilderFactory
      参数:
      uriTemplate - the URI template to use
      返回:
      the builder instance
    • builder

      public UriBuilder builder()
      从接口复制的说明: UriBuilderFactory
      Create a URI builder with default settings.
      指定者:
      builder 在接口中 UriBuilderFactory
      返回:
      the builder instance