Java Code Examples for org.springframework.http.CacheControl#getHeaderValue()

The following examples show how to use org.springframework.http.CacheControl#getHeaderValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebContentGenerator.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Set the HTTP Cache-Control header according to the given settings.
 * @param response current HTTP response
 * @param cacheControl the pre-configured cache control settings
 * @since 4.2
 */
protected final void applyCacheControl(HttpServletResponse response, CacheControl cacheControl) {
	String ccValue = cacheControl.getHeaderValue();
	if (ccValue != null) {
		// Set computed HTTP 1.1 Cache-Control header
		response.setHeader(HEADER_CACHE_CONTROL, ccValue);

		if (response.containsHeader(HEADER_PRAGMA)) {
			// Reset HTTP 1.0 Pragma header if present
			response.setHeader(HEADER_PRAGMA, "");
		}
		if (response.containsHeader(HEADER_EXPIRES)) {
			// Reset HTTP 1.0 Expires header if present
			response.setHeader(HEADER_EXPIRES, "");
		}
	}
}
 
Example 2
Source File: WebContentGenerator.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Set the HTTP Cache-Control header according to the given settings.
 * @param response current HTTP response
 * @param cacheControl the pre-configured cache control settings
 * @since 4.2
 */
protected final void applyCacheControl(HttpServletResponse response, CacheControl cacheControl) {
	String ccValue = cacheControl.getHeaderValue();
	if (ccValue != null) {
		// Set computed HTTP 1.1 Cache-Control header
		response.setHeader(HEADER_CACHE_CONTROL, ccValue);

		if (response.containsHeader(HEADER_PRAGMA)) {
			// Reset HTTP 1.0 Pragma header if present
			response.setHeader(HEADER_PRAGMA, "");
		}
		if (response.containsHeader(HEADER_EXPIRES)) {
			// Reset HTTP 1.0 Expires header if present
			response.setHeader(HEADER_EXPIRES, "");
		}
	}
}
 
Example 3
Source File: WebContentGenerator.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Set the HTTP Cache-Control header according to the given settings.
 * @param response current HTTP response
 * @param cacheControl the pre-configured cache control settings
 * @since 4.2
 */
protected final void applyCacheControl(HttpServletResponse response, CacheControl cacheControl) {
	String ccValue = cacheControl.getHeaderValue();
	if (ccValue != null) {
		// Set computed HTTP 1.1 Cache-Control header
		response.setHeader(HEADER_CACHE_CONTROL, ccValue);

		if (response.containsHeader(HEADER_PRAGMA)) {
			// Reset HTTP 1.0 Pragma header if present
			response.setHeader(HEADER_PRAGMA, "");
		}
		if (response.containsHeader(HEADER_EXPIRES)) {
			// Reset HTTP 1.0 Expires header if present
			response.setHeader(HEADER_EXPIRES, "");
		}
	}
}
 
Example 4
Source File: WebContentGenerator.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Set the HTTP Cache-Control header according to the given settings.
 * @param response current HTTP response
 * @param cacheControl the pre-configured cache control settings
 * @since 4.2
 */
protected final void applyCacheControl(HttpServletResponse response, CacheControl cacheControl) {
	String ccValue = cacheControl.getHeaderValue();
	if (ccValue != null) {
		// Set computed HTTP 1.1 Cache-Control header
		response.setHeader(HEADER_CACHE_CONTROL, ccValue);

		if (response.containsHeader(HEADER_PRAGMA)) {
			// Reset HTTP 1.0 Pragma header if present
			response.setHeader(HEADER_PRAGMA, "");
		}
	}
}