60
60
*/
61
61
public abstract class WebContentGenerator extends WebApplicationObjectSupport {
62
62
63
- /** HTTP method "GET". */
64
- public static final String METHOD_GET = "GET" ;
65
-
66
- /** HTTP method "HEAD". */
67
- public static final String METHOD_HEAD = "HEAD" ;
68
-
69
- /** HTTP method "POST". */
70
- public static final String METHOD_POST = "POST" ;
71
-
72
- protected static final String HEADER_CACHE_CONTROL = "Cache-Control" ;
73
-
74
-
75
63
/** Set of supported HTTP methods. */
76
64
private @ Nullable Set <String > supportedMethods ;
77
65
@@ -103,9 +91,9 @@ public WebContentGenerator() {
103
91
public WebContentGenerator (boolean restrictDefaultSupportedMethods ) {
104
92
if (restrictDefaultSupportedMethods ) {
105
93
this .supportedMethods = CollectionUtils .newLinkedHashSet (3 );
106
- this .supportedMethods .add (METHOD_GET );
107
- this .supportedMethods .add (METHOD_HEAD );
108
- this .supportedMethods .add (METHOD_POST );
94
+ this .supportedMethods .add (HttpMethod . GET . name () );
95
+ this .supportedMethods .add (HttpMethod . HEAD . name () );
96
+ this .supportedMethods .add (HttpMethod . POST . name () );
109
97
}
110
98
initAllowHeader ();
111
99
}
@@ -292,7 +280,7 @@ protected final void prepareResponse(HttpServletResponse response) {
292
280
}
293
281
if (this .varyByRequestHeaders != null ) {
294
282
for (String value : getVaryRequestHeadersToAdd (response , this .varyByRequestHeaders )) {
295
- response .addHeader ("Vary" , value );
283
+ response .addHeader (HttpHeaders . VARY , value );
296
284
}
297
285
}
298
286
}
@@ -307,7 +295,7 @@ protected final void applyCacheControl(HttpServletResponse response, CacheContro
307
295
String ccValue = cacheControl .getHeaderValue ();
308
296
if (ccValue != null ) {
309
297
// Set computed HTTP 1.1 Cache-Control header
310
- response .setHeader (HEADER_CACHE_CONTROL , ccValue );
298
+ response .setHeader (HttpHeaders . CACHE_CONTROL , ccValue );
311
299
}
312
300
}
313
301
0 commit comments