Spring Framework WebContentInterceptor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework WebContentInterceptor class.

This code example shows how to use the following methods:setCacheSeconds, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader
This code example shows how to use the following methods:
 * Additionally, for requests for files that are known bundles, we will cache for a full 10 years, as we are generating 
 * unique filenames that will make this acceptable. 
 *  
 * @author Andre Azzolini (apazzolini) 
 */ 
public class NonResourceWebContentInterceptor extends WebContentInterceptor { 
     
    protected static final int TEN_YEARS_SECONDS = 60 * 60 * 24 * 365 * 10; 
     
    @Override 
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)  
            throws ServletException { 
        if (BroadleafResourceHttpRequestHandler.class.isAssignableFrom(handler.getClass())) { 
            // Bundle resources are cached for ten years 
            BroadleafResourceHttpRequestHandler h = (BroadleafResourceHttpRequestHandler) handler; 
            if (h.isBundleRequest(request)) { 
                applyCacheSeconds(response, TEN_YEARS_SECONDS); 
            } 
            return true; 
        } else if (ResourceHttpRequestHandler.class.isAssignableFrom(handler.getClass())) { 
5
CodeRank
This code example shows how to use the following methods:setCacheSeconds
This code example shows how to use the following methods:
package org.datacite.mds.web; 
 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
 
import org.springframework.web.servlet.mvc.WebContentInterceptor; 
 
public class BrowserCachingInterceptor extends WebContentInterceptor { 
 
    @Override 
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) 
            throws ServletException { 
        // fix to stop tomcat from adding "Pragma: No-Cache" for CONFIDENTIAL resources (HTTPS) 
        response.setHeader("Pragma", ""); 
        return super.preHandle(request, response, handler); 
    } 
 
} 

4
CodeRank
This code example shows how to use the following methods:
 * The 'preHandle' method intercepts every non-GET call to the '/api/xxxx' endpoints 
 * and then checks the license. If expired, it will return HTTP 420 code. 
 * 
 * @author levans 
 */ 
public class AfWebHandlerInterceptor 
   extends WebContentInterceptor 
{ 
   private static final String EULA_URL = "/admin/eula"; 
   private static final String STATIC_URL = "/static"; 
 
   private final Logger _log = LoggerFactory.getLogger(AfWebHandlerInterceptor.class); 
 
   @Resource 
   private ConfigRegistry _config; 
 
   @Resource 
   private LicenseStatus _licenseStatus; 
 
   @Resource 
2
CodeRank
See Code Examples for Spring Framework WebContentInterceptor Methods: