org.apache.struts2.dispatcher.ng
Class PrepareOperations

java.lang.Object
  extended by org.apache.struts2.dispatcher.ng.PrepareOperations

public class PrepareOperations
extends Object

Contains preparation operations for a request before execution


Field Summary
static String CLEANUP_RECURSION_COUNTER
           
private  Dispatcher dispatcher
           
private  Logger log
           
private  ServletContext servletContext
           
private static String STRUTS_ACTION_MAPPING_KEY
           
 
Constructor Summary
PrepareOperations(ServletContext servletContext, Dispatcher dispatcher)
           
 
Method Summary
 void assignDispatcherToThread()
          Assigns the dispatcher to the dispatcher thread local
 void cleanupDispatcher()
          Cleans up the dispatcher instance
 void cleanupRequest(HttpServletRequest request)
          Cleans up a request of thread locals
 ActionContext createActionContext(HttpServletRequest request, HttpServletResponse response)
          Creates the action context and initializes the thread local
 ActionMapping findActionMapping(HttpServletRequest request, HttpServletResponse response)
          Finds and optionally creates an ActionMapping.
 ActionMapping findActionMapping(HttpServletRequest request, HttpServletResponse response, boolean forceLookup)
          Finds and optionally creates an ActionMapping.
private  String getUri(HttpServletRequest request)
          Gets the uri from the request
 boolean isUrlExcluded(HttpServletRequest request, List<Pattern> excludedPatterns)
          Check whether the request matches a list of exclude patterns.
 void setEncodingAndLocale(HttpServletRequest request, HttpServletResponse response)
          Sets the request encoding and locale on the response
 HttpServletRequest wrapRequest(HttpServletRequest oldRequest)
          Wraps the request with the Struts wrapper that handles multipart requests better
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servletContext

private ServletContext servletContext

dispatcher

private Dispatcher dispatcher

STRUTS_ACTION_MAPPING_KEY

private static final String STRUTS_ACTION_MAPPING_KEY
See Also:
Constant Field Values

CLEANUP_RECURSION_COUNTER

public static final String CLEANUP_RECURSION_COUNTER
See Also:
Constant Field Values

log

private Logger log
Constructor Detail

PrepareOperations

public PrepareOperations(ServletContext servletContext,
                         Dispatcher dispatcher)
Method Detail

createActionContext

public ActionContext createActionContext(HttpServletRequest request,
                                         HttpServletResponse response)
Creates the action context and initializes the thread local


cleanupRequest

public void cleanupRequest(HttpServletRequest request)
Cleans up a request of thread locals


assignDispatcherToThread

public void assignDispatcherToThread()
Assigns the dispatcher to the dispatcher thread local


setEncodingAndLocale

public void setEncodingAndLocale(HttpServletRequest request,
                                 HttpServletResponse response)
Sets the request encoding and locale on the response


wrapRequest

public HttpServletRequest wrapRequest(HttpServletRequest oldRequest)
                               throws ServletException
Wraps the request with the Struts wrapper that handles multipart requests better

Returns:
The new request, if there is one
Throws:
ServletException

findActionMapping

public ActionMapping findActionMapping(HttpServletRequest request,
                                       HttpServletResponse response)
Finds and optionally creates an ActionMapping. It first looks in the current request to see if one has already been found, otherwise, it creates it and stores it in the request. No mapping will be created in the case of static resource requests or unidentifiable requests for other servlets, for example.


findActionMapping

public ActionMapping findActionMapping(HttpServletRequest request,
                                       HttpServletResponse response,
                                       boolean forceLookup)
Finds and optionally creates an ActionMapping. if forceLookup is false, it first looks in the current request to see if one has already been found, otherwise, it creates it and stores it in the request. No mapping will be created in the case of static resource requests or unidentifiable requests for other servlets, for example.

Parameters:
forceLookup - if true, the action mapping will be looked up from the ActionMapper instance, ignoring if there is one in the request or not

cleanupDispatcher

public void cleanupDispatcher()
Cleans up the dispatcher instance


isUrlExcluded

public boolean isUrlExcluded(HttpServletRequest request,
                             List<Pattern> excludedPatterns)
Check whether the request matches a list of exclude patterns.

Parameters:
request - The request to check patterns against
excludedPatterns - list of patterns for exclusion
Returns:
true if the request URI matches one of the given patterns

getUri

private String getUri(HttpServletRequest request)
Gets the uri from the request

Parameters:
request - The request
Returns:
The uri


Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.