org.apache.struts2.dispatcher.filter

## Class StrutsPrepareFilter

- java.lang.Object
- - org.apache.struts2.dispatcher.filter.StrutsPrepareFilter

- All Implemented Interfaces:
    javax.servlet.Filter, StrutsStatics

      public class StrutsPrepareFilter
      extends Object
      implements StrutsStatics, javax.servlet.Filter

  Prepares the request for execution by a later `StrutsExecuteFilter` filter instance.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected List<Pattern>` | `excludedPatterns` Deprecated. since 6.4.0, use `Dispatcher.getActionExcludedPatterns()` or `PrepareOperations.isUrlExcluded(HttpServletRequest)` instead.
    `protected PrepareOperations` | `prepare`
    `protected static String` | `REQUEST_EXCLUDED_FROM_ACTION_MAPPING`

    - ### Fields inherited from interface org.apache.struts2.StrutsStatics

      `ACTION_MAPPING, HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StrutsPrepareFilter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected InitOperations` | `createInitOperations()` Creates a new instance of `InitOperations` to be used during initialising `Dispatcher`
    `protected PrepareOperations` | `createPrepareOperations(Dispatcher dispatcher)` Creates a new instance of `PrepareOperations` to be used during initialising `Dispatcher`
    `void` | `destroy()`
    `void` | `doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain)`
    `void` | `init(javax.servlet.FilterConfig filterConfig)`
    `protected void` | `postInit(Dispatcher dispatcher, javax.servlet.FilterConfig filterConfig)` Callback for post initialization

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### REQUEST_EXCLUDED_FROM_ACTION_MAPPING

          protected static final String REQUEST_EXCLUDED_FROM_ACTION_MAPPING

    - #### prepare

          protected PrepareOperations prepare

    - #### excludedPatterns

          @Deprecated
          protected List<Pattern> excludedPatterns

      Deprecated. since 6.4.0, use `Dispatcher.getActionExcludedPatterns()` or `PrepareOperations.isUrlExcluded(HttpServletRequest)` instead.

  - ### Constructor Detail

    - #### StrutsPrepareFilter

          public StrutsPrepareFilter()

  - ### Method Detail

    - #### init

          public void init(javax.servlet.FilterConfig filterConfig)
                    throws javax.servlet.ServletException

      Specified by:
        `init` in interface `javax.servlet.Filter`
      Throws:
        `javax.servlet.ServletException`

    - #### createInitOperations

          protected InitOperations createInitOperations()

      Creates a new instance of `InitOperations` to be used during initialising `Dispatcher`
      Returns:
        instance of `InitOperations`

    - #### createPrepareOperations

          protected PrepareOperations createPrepareOperations(Dispatcher dispatcher)

      Creates a new instance of `PrepareOperations` to be used during initialising `Dispatcher`
      Returns:
        instance of `PrepareOperations`

    - #### postInit

          protected void postInit(Dispatcher dispatcher,
                                  javax.servlet.FilterConfig filterConfig)

      Callback for post initialization
      Parameters:
        `dispatcher` - the dispatcher
        `filterConfig` - the filter config

    - #### doFilter

          public void doFilter(javax.servlet.ServletRequest req,
                               javax.servlet.ServletResponse res,
                               javax.servlet.FilterChain chain)
                        throws IOException,
                               javax.servlet.ServletException

      Specified by:
        `doFilter` in interface `javax.servlet.Filter`
      Throws:
        `IOException`
        `javax.servlet.ServletException`

    - #### destroy

          public void destroy()

      Specified by:
        `destroy` in interface `javax.servlet.Filter`

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.