Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Jun 8, 2020
1 parent 721fd20 commit c777468
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -61,12 +61,12 @@ public class AopNamespaceHandler extends NamespaceHandlerSupport {
*/
@Override
public void init() {
// In 2.0 XSD as well as in 2.1 XSD.
// In 2.0 XSD as well as in 2.5+ XSDs
registerBeanDefinitionParser("config", new ConfigBeanDefinitionParser());
registerBeanDefinitionParser("aspectj-autoproxy", new AspectJAutoProxyBeanDefinitionParser());
registerBeanDefinitionDecorator("scoped-proxy", new ScopedProxyBeanDefinitionDecorator());

// Only in 2.0 XSD: moved to context namespace as of 2.1
// Only in 2.0 XSD: moved to context namespace in 2.5+
registerBeanDefinitionParser("spring-configured", new SpringConfiguredBeanDefinitionParser());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,62 +40,6 @@
*/
public class DefaultUriBuilderFactory implements UriBuilderFactory {

/**
* Enum to represent multiple URI encoding strategies. The following are
* available:
* <ul>
* <li>{@link #TEMPLATE_AND_VALUES}
* <li>{@link #VALUES_ONLY}
* <li>{@link #URI_COMPONENT}
* <li>{@link #NONE}
* </ul>
* @see #setEncodingMode
*/
public enum EncodingMode {

/**
* Pre-encode the URI template first, then strictly encode URI variables
* when expanded, with the following rules:
* <ul>
* <li>For the URI template replace <em>only</em> non-ASCII and illegal
* (within a given URI component type) characters with escaped octets.
* <li>For URI variables do the same and also replace characters with
* reserved meaning.
* </ul>
* <p>For most cases, this mode is most likely to give the expected
* result because in treats URI variables as opaque data to be fully
* encoded, while {@link #URI_COMPONENT} by comparison is useful only
* if intentionally expanding URI variables with reserved characters.
* @since 5.0.8
* @see UriComponentsBuilder#encode()
*/
TEMPLATE_AND_VALUES,

/**
* Does not encode the URI template and instead applies strict encoding
* to URI variables via {@link UriUtils#encodeUriVariables} prior to
* expanding them into the template.
* @see UriUtils#encodeUriVariables(Object...)
* @see UriUtils#encodeUriVariables(Map)
*/
VALUES_ONLY,

/**
* Expand URI variables first, and then encode the resulting URI
* component values, replacing <em>only</em> non-ASCII and illegal
* (within a given URI component type) characters, but not characters
* with reserved meaning.
* @see UriComponents#encode()
*/
URI_COMPONENT,

/**
* No encoding should be applied.
*/
NONE
}


@Nullable
private final UriComponentsBuilder baseUri;

Expand Down Expand Up @@ -222,6 +166,62 @@ public UriBuilder builder() {
}


/**
* Enum to represent multiple URI encoding strategies. The following are
* available:
* <ul>
* <li>{@link #TEMPLATE_AND_VALUES}
* <li>{@link #VALUES_ONLY}
* <li>{@link #URI_COMPONENT}
* <li>{@link #NONE}
* </ul>
* @see #setEncodingMode
*/
public enum EncodingMode {

/**
* Pre-encode the URI template first, then strictly encode URI variables
* when expanded, with the following rules:
* <ul>
* <li>For the URI template replace <em>only</em> non-ASCII and illegal
* (within a given URI component type) characters with escaped octets.
* <li>For URI variables do the same and also replace characters with
* reserved meaning.
* </ul>
* <p>For most cases, this mode is most likely to give the expected
* result because in treats URI variables as opaque data to be fully
* encoded, while {@link #URI_COMPONENT} by comparison is useful only
* if intentionally expanding URI variables with reserved characters.
* @since 5.0.8
* @see UriComponentsBuilder#encode()
*/
TEMPLATE_AND_VALUES,

/**
* Does not encode the URI template and instead applies strict encoding
* to URI variables via {@link UriUtils#encodeUriVariables} prior to
* expanding them into the template.
* @see UriUtils#encodeUriVariables(Object...)
* @see UriUtils#encodeUriVariables(Map)
*/
VALUES_ONLY,

/**
* Expand URI variables first, and then encode the resulting URI
* component values, replacing <em>only</em> non-ASCII and illegal
* (within a given URI component type) characters, but not characters
* with reserved meaning.
* @see UriComponents#encode()
*/
URI_COMPONENT,

/**
* No encoding should be applied.
*/
NONE
}


/**
* {@link DefaultUriBuilderFactory} specific implementation of UriBuilder.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.web.util;

/**
Expand All @@ -22,13 +23,14 @@
*
* @author Rossen Stoyanchev
* @since 5.0
* @see DefaultUriBuilderFactory
*/
public interface UriBuilderFactory extends UriTemplateHandler {

/**
* Initialize a builder with the given URI template.
* @param uriTemplate the URI template to use
* @return the URI builder instance
* @return the builder instance
*/
UriBuilder uriString(String uriTemplate);

Expand Down

0 comments on commit c777468

Please sign in to comment.