com.bea.struts.adapter.framework
Class InternalUtils

java.lang.Object
  extended by com.bea.struts.adapter.framework.InternalUtils

public class InternalUtils
extends Object


Field Summary
static String ATTR_PREFIX
           
 
Constructor Summary
InternalUtils()
           
 
Method Summary
static String getActionMappingUrl(String action, javax.servlet.jsp.PageContext pageContext)
           
static ActionServlet getActionServlet(javax.servlet.ServletContext context)
          Get the current ActionServlet.
static ActionForm getCurrentActionForm(javax.servlet.ServletRequest request)
           
static ActionMapping getCurrentActionMapping(javax.servlet.ServletRequest request)
           
static String getDecodedServletPath(javax.servlet.http.HttpServletRequest request)
           
static javax.servlet.http.HttpSession getHttpSession(javax.servlet.ServletRequest request, boolean create)
           
static String getModuleName(String relativePath, javax.servlet.ServletContext context)
           
static String getModulePathForRelativeURI(String uri)
          Get the Struts module path for a URI that is relative to the web application root.
static javax.servlet.ServletContext getServletContext(javax.servlet.ServletRequest req)
           
static boolean ignoreIncludeServletPath(javax.servlet.ServletRequest request)
           
static ModuleConfig selectModule(String prefix, javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)
          Set the given Struts module in the request, and expose its set of MessageResources as request attributes.
static void setIgnoreIncludeServletPath(javax.servlet.ServletRequest request, boolean ignore)
          Tell getDecodedServletPath(javax.servlet.http.HttpServletRequest) (and all that call it) to ignore the attribute that specifies the Servlet Include path, which is set when a Servlet include is done through RequestDispatcher.
static void setServletContext(javax.servlet.ServletRequest request, javax.servlet.ServletContext servletContext)
           
static javax.servlet.ServletRequest unwrapMultipart(javax.servlet.ServletRequest request)
          If the given request is a MultipartRequestWrapper (Struts class that doesn't extend HttpServletRequestWrapper), return the wrapped request; otherwise, return the given request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_PREFIX

public static final String ATTR_PREFIX
See Also
Constants Summary
Constructor Detail

InternalUtils

public InternalUtils()
Method Detail

getDecodedServletPath

public static String getDecodedServletPath(javax.servlet.http.HttpServletRequest request)

setIgnoreIncludeServletPath

public static void setIgnoreIncludeServletPath(javax.servlet.ServletRequest request,
                                               boolean ignore)
Tell getDecodedServletPath(javax.servlet.http.HttpServletRequest) (and all that call it) to ignore the attribute that specifies the Servlet Include path, which is set when a Servlet include is done through RequestDispatcher. Normally, getDecodedServletPath tries the Servlet Include path before falling back to getServletPath() on the request. Note that this is basically a stack of instructions to ignore the include path, and this method expects each call with ignore==true to be balanced by a call with ignore==false.

Parameters
request - the current request
ignore - whether or not to ignore or not

ignoreIncludeServletPath

public static boolean ignoreIncludeServletPath(javax.servlet.ServletRequest request)

selectModule

public static ModuleConfig selectModule(String prefix,
                                        javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.ServletContext servletContext)
Set the given Struts module in the request, and expose its set of MessageResources as request attributes.

Parameters
prefix - the prefix of the desired module.
request - the current HttpServletRequest.
servletContext - the current ServletContext.
Returns
the selected ModuleConfig, or null if there is none for the given module prefix.

getCurrentActionMapping

public static ActionMapping getCurrentActionMapping(javax.servlet.ServletRequest request)

getCurrentActionForm

public static ActionForm getCurrentActionForm(javax.servlet.ServletRequest request)

getHttpSession

public static javax.servlet.http.HttpSession getHttpSession(javax.servlet.ServletRequest request,
                                                            boolean create)

setServletContext

public static void setServletContext(javax.servlet.ServletRequest request,
                                     javax.servlet.ServletContext servletContext)

getServletContext

public static javax.servlet.ServletContext getServletContext(javax.servlet.ServletRequest req)

unwrapMultipart

public static javax.servlet.ServletRequest unwrapMultipart(javax.servlet.ServletRequest request)
If the given request is a MultipartRequestWrapper (Struts class that doesn't extend HttpServletRequestWrapper), return the wrapped request; otherwise, return the given request.

Parameters
request - the current request
Returns
the unwrapped request

getModulePathForRelativeURI

public static String getModulePathForRelativeURI(String uri)
Get the Struts module path for a URI that is relative to the web application root.

Parameters
uri - the URI for which to get the module path.
Returns
the Struts module path for the given URI

getActionServlet

public static ActionServlet getActionServlet(javax.servlet.ServletContext context)
Get the current ActionServlet.

Parameters
context - the current ServletContext
Returns
the ActionServlet that is stored as an attribute in the ServletContext

getActionMappingUrl

public static String getActionMappingUrl(String action,
                                         javax.servlet.jsp.PageContext pageContext)

getModuleName

public static String getModuleName(String relativePath,
                                   javax.servlet.ServletContext context)


Copyright © 2011, Oracle. All rights reserved.