org.broadleafcommerce.common.web
Class BroadleafAdminRequestFilter

java.lang.Object
  extended by org.springframework.web.filter.GenericFilterBean
      extended by org.springframework.web.filter.OncePerRequestFilter
          extended by org.broadleafcommerce.common.web.BroadleafAdminRequestFilter
All Implemented Interfaces:
javax.servlet.Filter, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.EnvironmentAware, org.springframework.web.context.ServletContextAware

@Component(value="blAdminRequestFilter")
public class BroadleafAdminRequestFilter
extends org.springframework.web.filter.OncePerRequestFilter

Responsible for setting the necessary attributes on the BroadleafRequestContext

Author:
Andre Azzolini (apazzolini)

Field Summary
protected  BroadleafWebRequestProcessor requestProcessor
           
 
Fields inherited from class org.springframework.web.filter.OncePerRequestFilter
ALREADY_FILTERED_SUFFIX
 
Fields inherited from class org.springframework.web.filter.GenericFilterBean
logger
 
Constructor Summary
BroadleafAdminRequestFilter()
           
 
Method Summary
 void doFilterInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain)
           
protected  Set getIgnoreSuffixes()
          Returns a set of suffixes that can be ignored by content processing.
protected  boolean shouldProcessURL(javax.servlet.http.HttpServletRequest request, String requestURI)
          Determines if the passed in URL should be processed by the content management system.
 
Methods inherited from class org.springframework.web.filter.OncePerRequestFilter
doFilter, getAlreadyFilteredAttributeName, shouldNotFilter
 
Methods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

requestProcessor

protected BroadleafWebRequestProcessor requestProcessor
Constructor Detail

BroadleafAdminRequestFilter

public BroadleafAdminRequestFilter()
Method Detail

doFilterInternal

public void doFilterInternal(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             javax.servlet.FilterChain filterChain)
                      throws IOException,
                             javax.servlet.ServletException
Specified by:
doFilterInternal in class org.springframework.web.filter.OncePerRequestFilter
Throws:
IOException
javax.servlet.ServletException

shouldProcessURL

protected boolean shouldProcessURL(javax.servlet.http.HttpServletRequest request,
                                   String requestURI)
Determines if the passed in URL should be processed by the content management system.

By default, this method returns false for any BLC-Admin URLs and service calls and for all common image/digital mime-types (as determined by an internal call to getIgnoreSuffixes.

This check is called with the doFilterInternal method to short-circuit the content processing which can be expensive for requests that do not require it.

Parameters:
requestURI - - the HttpServletRequest.getRequestURI
Returns:
true if the HttpServletRequest should be processed

getIgnoreSuffixes

protected Set getIgnoreSuffixes()
Returns a set of suffixes that can be ignored by content processing. The following are returned:

List of suffixes ignored: ".aif", ".aiff", ".asf", ".avi", ".bin", ".bmp", ".doc", ".eps", ".gif", ".hqx", ".jpg", ".jpeg", ".mid", ".midi", ".mov", ".mp3", ".mpg", ".mpeg", ".p65", ".pdf", ".pic", ".pict", ".png", ".ppt", ".psd", ".qxd", ".ram", ".ra", ".rm", ".sea", ".sit", ".stk", ".swf", ".tif", ".tiff", ".txt", ".rtf", ".vob", ".wav", ".wmf", ".xls", ".zip";

Returns:
set of suffixes to ignore.


Copyright © 2013. All Rights Reserved.