servletunit.struts
Class StrutsServletContextWrapper

java.lang.Object
  extended byServletContextWrapper
      extended byservletunit.struts.StrutsServletContextWrapper

public class StrutsServletContextWrapper
extends 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.

See Also:
Serialized Form

Constructor Summary
StrutsServletContextWrapper(ServletContext context)
           
 
Method Summary
 java.lang.String getForward()
           
 RequestDispatcher getRequestDispatcher(java.lang.String 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrutsServletContextWrapper

public StrutsServletContextWrapper(ServletContext context)
Method Detail

setProcessRequest

public void setProcessRequest(boolean flag)

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(java.lang.String path)

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.

Throws:
java.net.MalformedURLException

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.



Copyright Deryl Seale All Rights Reserved.