Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

servletunit.struts
Class StrutsServletContextWrapper  view StrutsServletContextWrapper download StrutsServletContextWrapper.java

java.lang.Object
  extended byorg.apache.cactus.server.AbstractServletContextWrapper
      extended byorg.apache.cactus.server.ServletContextWrapper
          extended byservletunit.struts.StrutsServletContextWrapper
All Implemented Interfaces:
javax.servlet.ServletContext

public class StrutsServletContextWrapper
extends org.apache.cactus.server.ServletContextWrapper

A wrapper for the ServletContext class. This is used in CactusStrutsTestCase so that we can retrieve the forward processed by the ActionServlet and use absolute paths for Struts resources. This allows us to to use the ActionServlet as a black box, rather than mimic its behavior as was previously the case.


Field Summary
private  java.lang.String dispatchedResource
           
(package private)  boolean processRequest
           
 
Fields inherited from class org.apache.cactus.server.AbstractServletContextWrapper
initParameters, originalContext
 
Constructor Summary
StrutsServletContextWrapper(javax.servlet.ServletContext context)
           
 
Method Summary
 java.lang.String getForward()
           
 javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
          Returns a javax.servlet.RequestDispatcher object that acts as a wrapper for the resource located at the given path.
 java.net.URL getResource(java.lang.String pathname)
          Override the getResource method to look for resources in the file system, allowing the use of absolute paths for Struts configuration files.
 java.io.InputStream getResourceAsStream(java.lang.String pathname)
          Override the getResourceAsStream method to look for resources in the file system, allowing the use of absolute paths for Struts configuration files.
 void setProcessRequest(boolean flag)
           
 
Methods inherited from class org.apache.cactus.server.AbstractServletContextWrapper
getAttribute, getAttributeNames, getContext, getInitParameter, getInitParameterNames, getLogs, getMajorVersion, getMimeType, getMinorVersion, getNamedDispatcher, getOriginalContext, getRealPath, getServerInfo, getServlet, getServletNames, getServlets, log, log, log, removeAttribute, setAttribute, setInitParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.ServletContext
getResourcePaths, getServletContextName
 

Field Detail

processRequest

boolean processRequest

dispatchedResource

private java.lang.String dispatchedResource
Constructor Detail

StrutsServletContextWrapper

public StrutsServletContextWrapper(javax.servlet.ServletContext context)
Method Detail

setProcessRequest

public void setProcessRequest(boolean flag)

getRequestDispatcher

public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
Description copied from interface: javax.servlet.ServletContext
Returns a javax.servlet.RequestDispatcher object that acts as a wrapper for the resource located at the given path. A RequestDispatcher object can be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static.

The pathname must begin with a "/" and is interpreted as relative to the current context root. Use getContext to obtain a RequestDispatcher for resources in foreign contexts. This method returns null if the ServletContext cannot return a RequestDispatcher.


getForward

public java.lang.String getForward()

getResource

public java.net.URL getResource(java.lang.String pathname)
                         throws java.net.MalformedURLException
Override the getResource method to look for resources in the file system, allowing the use of absolute paths for Struts configuration files. If the resource path exists in the file system, this method will return a URL based on the supplied path; otherwise, it defers to the ServletContext loader.


getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String pathname)
Override the getResourceAsStream method to look for resources in the file system, allowing the use of absolute paths for Struts configuration files. If the resource path exists in the file system, this method will return a URL based on the supplied path; otherwise, it defers to the ServletContext loader.