|
40 | 40 | */
|
41 | 41 | public class DefaultUriBuilderFactory implements UriBuilderFactory {
|
42 | 42 |
|
43 |
| - /** |
44 |
| - * Enum to represent multiple URI encoding strategies. The following are |
45 |
| - * available: |
46 |
| - * <ul> |
47 |
| - * <li>{@link #TEMPLATE_AND_VALUES} |
48 |
| - * <li>{@link #VALUES_ONLY} |
49 |
| - * <li>{@link #URI_COMPONENT} |
50 |
| - * <li>{@link #NONE} |
51 |
| - * </ul> |
52 |
| - * @see #setEncodingMode |
53 |
| - */ |
54 |
| - public enum EncodingMode { |
55 |
| - |
56 |
| - /** |
57 |
| - * Pre-encode the URI template first, then strictly encode URI variables |
58 |
| - * when expanded, with the following rules: |
59 |
| - * <ul> |
60 |
| - * <li>For the URI template replace <em>only</em> non-ASCII and illegal |
61 |
| - * (within a given URI component type) characters with escaped octets. |
62 |
| - * <li>For URI variables do the same and also replace characters with |
63 |
| - * reserved meaning. |
64 |
| - * </ul> |
65 |
| - * <p>For most cases, this mode is most likely to give the expected |
66 |
| - * result because in treats URI variables as opaque data to be fully |
67 |
| - * encoded, while {@link #URI_COMPONENT} by comparison is useful only |
68 |
| - * if intentionally expanding URI variables with reserved characters. |
69 |
| - * @since 5.0.8 |
70 |
| - * @see UriComponentsBuilder#encode() |
71 |
| - */ |
72 |
| - TEMPLATE_AND_VALUES, |
73 |
| - |
74 |
| - /** |
75 |
| - * Does not encode the URI template and instead applies strict encoding |
76 |
| - * to URI variables via {@link UriUtils#encodeUriVariables} prior to |
77 |
| - * expanding them into the template. |
78 |
| - * @see UriUtils#encodeUriVariables(Object...) |
79 |
| - * @see UriUtils#encodeUriVariables(Map) |
80 |
| - */ |
81 |
| - VALUES_ONLY, |
82 |
| - |
83 |
| - /** |
84 |
| - * Expand URI variables first, and then encode the resulting URI |
85 |
| - * component values, replacing <em>only</em> non-ASCII and illegal |
86 |
| - * (within a given URI component type) characters, but not characters |
87 |
| - * with reserved meaning. |
88 |
| - * @see UriComponents#encode() |
89 |
| - */ |
90 |
| - URI_COMPONENT, |
91 |
| - |
92 |
| - /** |
93 |
| - * No encoding should be applied. |
94 |
| - */ |
95 |
| - NONE |
96 |
| - } |
97 |
| - |
98 |
| - |
99 | 43 | @Nullable
|
100 | 44 | private final UriComponentsBuilder baseUri;
|
101 | 45 |
|
@@ -222,6 +166,62 @@ public UriBuilder builder() {
|
222 | 166 | }
|
223 | 167 |
|
224 | 168 |
|
| 169 | + /** |
| 170 | + * Enum to represent multiple URI encoding strategies. The following are |
| 171 | + * available: |
| 172 | + * <ul> |
| 173 | + * <li>{@link #TEMPLATE_AND_VALUES} |
| 174 | + * <li>{@link #VALUES_ONLY} |
| 175 | + * <li>{@link #URI_COMPONENT} |
| 176 | + * <li>{@link #NONE} |
| 177 | + * </ul> |
| 178 | + * @see #setEncodingMode |
| 179 | + */ |
| 180 | + public enum EncodingMode { |
| 181 | + |
| 182 | + /** |
| 183 | + * Pre-encode the URI template first, then strictly encode URI variables |
| 184 | + * when expanded, with the following rules: |
| 185 | + * <ul> |
| 186 | + * <li>For the URI template replace <em>only</em> non-ASCII and illegal |
| 187 | + * (within a given URI component type) characters with escaped octets. |
| 188 | + * <li>For URI variables do the same and also replace characters with |
| 189 | + * reserved meaning. |
| 190 | + * </ul> |
| 191 | + * <p>For most cases, this mode is most likely to give the expected |
| 192 | + * result because in treats URI variables as opaque data to be fully |
| 193 | + * encoded, while {@link #URI_COMPONENT} by comparison is useful only |
| 194 | + * if intentionally expanding URI variables with reserved characters. |
| 195 | + * @since 5.0.8 |
| 196 | + * @see UriComponentsBuilder#encode() |
| 197 | + */ |
| 198 | + TEMPLATE_AND_VALUES, |
| 199 | + |
| 200 | + /** |
| 201 | + * Does not encode the URI template and instead applies strict encoding |
| 202 | + * to URI variables via {@link UriUtils#encodeUriVariables} prior to |
| 203 | + * expanding them into the template. |
| 204 | + * @see UriUtils#encodeUriVariables(Object...) |
| 205 | + * @see UriUtils#encodeUriVariables(Map) |
| 206 | + */ |
| 207 | + VALUES_ONLY, |
| 208 | + |
| 209 | + /** |
| 210 | + * Expand URI variables first, and then encode the resulting URI |
| 211 | + * component values, replacing <em>only</em> non-ASCII and illegal |
| 212 | + * (within a given URI component type) characters, but not characters |
| 213 | + * with reserved meaning. |
| 214 | + * @see UriComponents#encode() |
| 215 | + */ |
| 216 | + URI_COMPONENT, |
| 217 | + |
| 218 | + /** |
| 219 | + * No encoding should be applied. |
| 220 | + */ |
| 221 | + NONE |
| 222 | + } |
| 223 | + |
| 224 | + |
225 | 225 | /**
|
226 | 226 | * {@link DefaultUriBuilderFactory} specific implementation of UriBuilder.
|
227 | 227 | */
|
|
0 commit comments