Class HiddenHttpMethodFilter

  • 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.core.env.EnvironmentCapable, org.springframework.web.context.ServletContextAware

    public class HiddenHttpMethodFilter
    extends org.springframework.web.filter.OncePerRequestFilter
    Based off the Spring implementation, but also supports the X-HTTP-Method-Override HTTP header.
    Since:
    1.2
    See Also:
    HiddenHttpMethodFilter
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  HiddenHttpMethodFilter.HttpMethodRequestWrapper
      Simple HttpServletRequest wrapper that returns the supplied method for HttpServletRequest.getMethod().
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_METHOD_PARAM
      Default method parameter: _method
      static java.lang.String HEADER_X_HTTP_METHOD_OVERRIDE  
      • Fields inherited from class org.springframework.web.filter.OncePerRequestFilter

        ALREADY_FILTERED_SUFFIX
      • Fields inherited from class org.springframework.web.filter.GenericFilterBean

        logger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doFilterInternal​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain)  
      protected java.lang.String getHttpMethodOverride​(javax.servlet.http.HttpServletRequest request)  
      void setMethodParam​(java.lang.String methodParam)
      Set the parameter name to look for HTTP methods.
      • Methods inherited from class org.springframework.web.filter.OncePerRequestFilter

        doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatch
      • Methods inherited from class org.springframework.web.filter.GenericFilterBean

        addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, 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

      • DEFAULT_METHOD_PARAM

        public static final java.lang.String DEFAULT_METHOD_PARAM
        Default method parameter: _method
        See Also:
        Constant Field Values
      • HEADER_X_HTTP_METHOD_OVERRIDE

        public static final java.lang.String HEADER_X_HTTP_METHOD_OVERRIDE
        See Also:
        Constant Field Values
    • Constructor Detail

      • HiddenHttpMethodFilter

        public HiddenHttpMethodFilter()
    • Method Detail

      • setMethodParam

        public void setMethodParam​(java.lang.String methodParam)
        Set the parameter name to look for HTTP methods.
        See Also:
        DEFAULT_METHOD_PARAM
      • doFilterInternal

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

        protected java.lang.String getHttpMethodOverride​(javax.servlet.http.HttpServletRequest request)