类的使用
org.springframework.web.util.UriComponentsBuilder
使用UriComponentsBuilder的程序包 程序包 说明 org.springframework.web.method.annotation Support classes for annotation-based handler method processing.org.springframework.web.method.support Generic support classes for handler method processing.org.springframework.web.servlet.mvc.method.annotation MVC infrastructure for annotation-based handler method processing, building on theorg.springframework.web.method.annotationpackage.org.springframework.web.servlet.support Support classes for Spring's web MVC framework.org.springframework.web.util Miscellaneous web utility classes, such as HTML escaping, Log4j initialization, and cookie handling.org.springframework.web.method.annotation中UriComponentsBuilder的使用
参数类型为UriComponentsBuilder的org.springframework.web.method.annotation中的方法 修饰符和类型 方法 说明 voidRequestParamMethodArgumentResolver. contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String,Object> uriVariables, ConversionService conversionService)org.springframework.web.method.support中UriComponentsBuilder的使用
参数类型为UriComponentsBuilder的org.springframework.web.method.support中的方法 修饰符和类型 方法 说明 voidCompositeUriComponentsContributor. contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String,Object> uriVariables)An overloaded method that uses the ConversionService created at construction.voidCompositeUriComponentsContributor. contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String,Object> uriVariables, ConversionService conversionService)voidUriComponentsContributor. contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String,Object> uriVariables, ConversionService conversionService)Process the given method argument and either update theUriComponentsBuilderor add to the map with URI variables to use to expand the URI after all arguments are processed.org.springframework.web.servlet.mvc.method.annotation中UriComponentsBuilder的使用
返回UriComponentsBuilder的org.springframework.web.servlet.mvc.method.annotation中的方法 修饰符和类型 方法 说明 static UriComponentsBuilderMvcUriComponentsBuilder. fromController(Class<?> controllerType)Create aUriComponentsBuilderfrom the mapping of a controller class and current request information including Servlet mapping.static UriComponentsBuilderMvcUriComponentsBuilder. fromController(UriComponentsBuilder builder, Class<?> controllerType)An alternative toMvcUriComponentsBuilder.fromController(Class)that accepts aUriComponentsBuilderrepresenting the base URL.static UriComponentsBuilderMvcUriComponentsBuilder. fromMethod(Class<?> controllerType, Method method, Object... args)Create aUriComponentsBuilderfrom the mapping of a controller method and an array of method argument values.static UriComponentsBuilderMvcUriComponentsBuilder. fromMethod(UriComponentsBuilder baseUrl, Class<?> controllerType, Method method, Object... args)An alternative toMvcUriComponentsBuilder.fromMethod(Class, Method, Object...)that accepts aUriComponentsBuilderrepresenting the base URL.static UriComponentsBuilderMvcUriComponentsBuilder. fromMethodCall(Object info)Create aUriComponentsBuilderby invoking a "mock" controller method.static UriComponentsBuilderMvcUriComponentsBuilder. fromMethodCall(UriComponentsBuilder builder, Object info)An alternative toMvcUriComponentsBuilder.fromMethodCall(Object)that accepts aUriComponentsBuilderrepresenting the base URL.static UriComponentsBuilderMvcUriComponentsBuilder. fromMethodName(Class<?> controllerType, String methodName, Object... args)Create aUriComponentsBuilderfrom the mapping of a controller method and an array of method argument values.static UriComponentsBuilderMvcUriComponentsBuilder. fromMethodName(UriComponentsBuilder builder, Class<?> controllerType, String methodName, Object... args)An alternative toMvcUriComponentsBuilder.fromMethodName(Class, String, Object...)that accepts aUriComponentsBuilderrepresenting the base URL.UriComponentsBuilderMvcUriComponentsBuilder. withController(Class<?> controllerType)An alternative toMvcUriComponentsBuilder.fromController(Class)for use with an instance of this class created via a call toMvcUriComponentsBuilder.relativeTo(org.springframework.web.util.UriComponentsBuilder).UriComponentsBuilderMvcUriComponentsBuilder. withMethod(Class<?> controllerType, Method method, Object... args)An alternative toMvcUriComponentsBuilder.fromMethod(Class, Method, Object...)for use with an instance of this class created viaMvcUriComponentsBuilder.relativeTo(org.springframework.web.util.UriComponentsBuilder).UriComponentsBuilderMvcUriComponentsBuilder. withMethodCall(Object invocationInfo)An alternative toMvcUriComponentsBuilder.fromMethodCall(Object)for use with an instance of this class created viaMvcUriComponentsBuilder.relativeTo(org.springframework.web.util.UriComponentsBuilder).UriComponentsBuilderMvcUriComponentsBuilder. withMethodName(Class<?> controllerType, String methodName, Object... args)An alternative toMvcUriComponentsBuilder.fromMethodName(Class, String, Object...)} for use with an instance of this class created viaMvcUriComponentsBuilder.relativeTo(org.springframework.web.util.UriComponentsBuilder).参数类型为UriComponentsBuilder的org.springframework.web.servlet.mvc.method.annotation中的方法 修饰符和类型 方法 说明 voidPathVariableMethodArgumentResolver. contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String,Object> uriVariables, ConversionService conversionService)static UriComponentsBuilderMvcUriComponentsBuilder. fromController(UriComponentsBuilder builder, Class<?> controllerType)An alternative toMvcUriComponentsBuilder.fromController(Class)that accepts aUriComponentsBuilderrepresenting the base URL.static MvcUriComponentsBuilder.MethodArgumentBuilderMvcUriComponentsBuilder. fromMappingName(UriComponentsBuilder builder, String name)An alternative toMvcUriComponentsBuilder.fromMappingName(String)that accepts aUriComponentsBuilderrepresenting the base URL.static UriComponentsBuilderMvcUriComponentsBuilder. fromMethod(UriComponentsBuilder baseUrl, Class<?> controllerType, Method method, Object... args)An alternative toMvcUriComponentsBuilder.fromMethod(Class, Method, Object...)that accepts aUriComponentsBuilderrepresenting the base URL.static UriComponentsBuilderMvcUriComponentsBuilder. fromMethodCall(UriComponentsBuilder builder, Object info)An alternative toMvcUriComponentsBuilder.fromMethodCall(Object)that accepts aUriComponentsBuilderrepresenting the base URL.static UriComponentsBuilderMvcUriComponentsBuilder. fromMethodName(UriComponentsBuilder builder, Class<?> controllerType, String methodName, Object... args)An alternative toMvcUriComponentsBuilder.fromMethodName(Class, String, Object...)that accepts aUriComponentsBuilderrepresenting the base URL.static MvcUriComponentsBuilderMvcUriComponentsBuilder. relativeTo(UriComponentsBuilder baseUrl)Create an instance of this class with a base URL.参数类型为UriComponentsBuilder的org.springframework.web.servlet.mvc.method.annotation中的构造器 构造器 说明 MethodArgumentBuilder(UriComponentsBuilder baseUrl, Class<?> controllerType, Method method)Create a newMvcUriComponentsBuilder.MethodArgumentBuilderinstance.MvcUriComponentsBuilder(UriComponentsBuilder baseUrl)Default constructor.org.springframework.web.servlet.support中UriComponentsBuilder的使用
org.springframework.web.servlet.support中UriComponentsBuilder的子类 修饰符和类型 类 说明 classServletUriComponentsBuilderUriComponentsBuilder with additional static factory methods to create links based on the current HttpServletRequest.org.springframework.web.util中UriComponentsBuilder的使用
返回UriComponentsBuilder的org.springframework.web.util中的方法 修饰符和类型 方法 说明 UriComponentsBuilderUriComponentsBuilder. cloneBuilder()Clone thisUriComponentsBuilder.UriComponentsBuilderUriComponentsBuilder. encode()Request to have the URI template pre-encoded at build time, and URI variables encoded separately when expanded.UriComponentsBuilderUriComponentsBuilder. encode(Charset charset)A variant ofencode()with a charset other than "UTF-8".UriComponentsBuilderUriComponentsBuilder. fragment(String fragment)static UriComponentsBuilderUriComponentsBuilder. fromHttpRequest(HttpRequest request)Create a newUriComponentsobject from the URI associated with the given HttpRequest while also overlaying with values from the headers "Forwarded" (RFC 7239), or "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" if "Forwarded" is not found.static UriComponentsBuilderUriComponentsBuilder. fromHttpUrl(String httpUrl)Create a URI components builder from the given HTTP URL String.static UriComponentsBuilderUriComponentsBuilder. fromOriginHeader(String origin)Create an instance by parsing the "Origin" header of an HTTP request.static UriComponentsBuilderUriComponentsBuilder. fromPath(String path)Create a builder that is initialized with the given path.static UriComponentsBuilderUriComponentsBuilder. fromUri(URI uri)Create a builder that is initialized from the givenURI.static UriComponentsBuilderUriComponentsBuilder. fromUriString(String uri)Create a builder that is initialized with the given URI string.UriComponentsBuilderUriComponentsBuilder. host(String host)protected UriComponentsBuilderDefaultUriTemplateHandler. initUriComponentsBuilder(String uriTemplate)已过时。Create aUriComponentsBuilderfrom the URI template string.static UriComponentsBuilderUriComponentsBuilder. newInstance()Create a new, empty builder.UriComponentsBuilderUriComponentsBuilder. path(String path)UriComponentsBuilderUriComponentsBuilder. pathSegment(String... pathSegments)UriComponentsBuilderUriComponentsBuilder. port(int port)UriComponentsBuilderUriComponentsBuilder. port(String port)UriComponentsBuilderUriComponentsBuilder. query(String query)UriComponentsBuilderUriComponentsBuilder. queryParam(String name, Object... values)UriComponentsBuilderUriComponentsBuilder. queryParam(String name, Collection<?> values)UriComponentsBuilderUriComponentsBuilder. queryParams(MultiValueMap<String,String> params)Add multiple query parameters and values.UriComponentsBuilderUriComponentsBuilder. replacePath(String path)UriComponentsBuilderUriComponentsBuilder. replaceQuery(String query)UriComponentsBuilderUriComponentsBuilder. replaceQueryParam(String name, Object... values)UriComponentsBuilderUriComponentsBuilder. replaceQueryParam(String name, Collection<?> values)UriComponentsBuilderUriComponentsBuilder. replaceQueryParams(MultiValueMap<String,String> params)Set the query parameter values after removing all existing ones.UriComponentsBuilderUriComponentsBuilder. scheme(String scheme)UriComponentsBuilderUriComponentsBuilder. schemeSpecificPart(String ssp)Set the URI scheme-specific-part.UriComponentsBuilderUriComponentsBuilder. uri(URI uri)Initialize components of this builder from components of the given URI.UriComponentsBuilderUriComponentsBuilder. uriComponents(UriComponents uriComponents)Set or append individual URI components of this builder from the values of the givenUriComponentsinstance.UriComponentsBuilderUriComponentsBuilder. uriVariables(Map<String,Object> uriVariables)Configure URI variables to be expanded at build time.UriComponentsBuilderUriComponentsBuilder. userInfo(String userInfo)参数类型为UriComponentsBuilder的org.springframework.web.util中的方法 修饰符和类型 方法 说明 protected abstract voidUriComponents. copyToUriComponentsBuilder(UriComponentsBuilder builder)Set all components of the given UriComponentsBuilder.protected UriComponentsDefaultUriTemplateHandler. expandAndEncode(UriComponentsBuilder builder, Object[] uriVariables)已过时。protected UriComponentsDefaultUriTemplateHandler. expandAndEncode(UriComponentsBuilder builder, Map<String,?> uriVariables)已过时。参数类型为UriComponentsBuilder的org.springframework.web.util中的构造器 构造器 说明 DefaultUriBuilderFactory(UriComponentsBuilder baseUri)Variant ofDefaultUriBuilderFactory(String)with aUriComponentsBuilder.UriComponentsBuilder(UriComponentsBuilder other)Create a deep copy of the given UriComponentsBuilder.