| Method from org.apache.cactus.server.AbstractServletContextWrapper Detail: |
public Object getAttribute(String theName) {
return this.originalContext.getAttribute(theName);
}
|
public Enumeration getAttributeNames() {
return this.originalContext.getAttributeNames();
}
|
public ServletContext getContext(String theUripath) {
ServletContext context = AbstractServletContextWrapper.newInstance(
this.originalContext.getContext(theUripath));
return context;
}
|
public String getInitParameter(String theName) {
// Look first in the list of parameters set using the
// setInitParameter() method.
String value = (String) this.initParameters.get(theName);
if (value == null)
{
value = this.originalContext.getInitParameter(theName);
}
return value;
}
|
public Enumeration getInitParameterNames() {
Vector names = new Vector();
// Add parameters that were added using setInitParameter()
Enumeration en = this.initParameters.keys();
while (en.hasMoreElements())
{
String value = (String) en.nextElement();
names.add(value);
}
// Add parameters from web.xml
en = this.originalContext.getInitParameterNames();
while (en.hasMoreElements())
{
String value = (String) en.nextElement();
// Do not add parameters that have been overriden by calling
// the setInitParameter() method.
if (!names.contains(value))
{
names.add(value);
}
}
return names.elements();
}
|
public Vector getLogs() {
return this.logs;
}
Returns all the text logs that have been generated using the
log() methods so that it is possible to easily assert the
content of the logs. This method does not return the exceptions or
throwable sent for logging; it only returns the messages. |
public int getMajorVersion() {
return this.originalContext.getMajorVersion();
}
|
public String getMimeType(String theFilename) {
return this.originalContext.getMimeType(theFilename);
}
|
public int getMinorVersion() {
return this.originalContext.getMinorVersion();
}
|
public RequestDispatcher getNamedDispatcher(String theName) {
RequestDispatcher wrappedDispatcher = null;
RequestDispatcher originalDispatcher =
this.originalContext.getNamedDispatcher(theName);
if (originalDispatcher != null)
{
wrappedDispatcher =
new RequestDispatcherWrapper(originalDispatcher);
}
return wrappedDispatcher;
}
|
public ServletContext getOriginalContext() {
return this.originalContext;
}
|
public String getRealPath(String thePath) {
return this.originalContext.getRealPath(thePath);
}
|
public RequestDispatcher getRequestDispatcher(String thePath) {
RequestDispatcher wrappedDispatcher = null;
RequestDispatcher originalDispatcher =
this.originalContext.getRequestDispatcher(thePath);
if (originalDispatcher != null)
{
wrappedDispatcher =
new RequestDispatcherWrapper(originalDispatcher);
}
return wrappedDispatcher;
}
|
public URL getResource(String thePath) throws MalformedURLException {
return this.originalContext.getResource(thePath);
}
|
public InputStream getResourceAsStream(String thePath) {
return this.originalContext.getResourceAsStream(thePath);
}
|
public String getServerInfo() {
return this.originalContext.getServerInfo();
}
|
public Servlet getServlet(String theName) throws ServletException {
return this.originalContext.getServlet(theName);
}
|
public Enumeration getServletNames() {
return this.originalContext.getServletNames();
}
|
public Enumeration getServlets() {
return this.originalContext.getServlets();
}
|
public void log(String theMessage) {
if (theMessage != null)
{
this.logs.addElement(theMessage);
}
this.originalContext.log(theMessage);
}
Intercept the log call and add the message to an internal vector of
log messages that can then later be retrieved and asserted by the
test case writer. Note that the throwable is not saved. |
public void log(String theMessage,
Throwable theCause) {
if (theMessage != null)
{
this.logs.addElement(theMessage);
}
this.originalContext.log(theMessage, theCause);
}
Intercept the log call and add the message to an internal vector of
log messages that can then later be retrieved and asserted by the
test case writer. Note that the throwable is not saved. |
public void log(Exception theException,
String theMessage) {
if (theMessage != null)
{
this.logs.addElement(theMessage);
}
this.originalContext.log(theException, theMessage);
} Deprecated! As - of Java Servlet API 2.1, use
#log(String message, Throwable throwable) instead.
This method was originally defined to write an exception's
stack trace and an explanatory error message to the servlet
log file.
Intercept the log call and add the message to an internal vector of
log messages that can then later be retrieved and asserted by the
test case writer. Note that the throwable is not saved. |
public static AbstractServletContextWrapper newInstance(ServletContext theOriginalContext) {
try
{
Class clazz = Class.forName(
"org.apache.cactus.server.ServletContextWrapper");
Object[] args = new Object[] {theOriginalContext};
Constructor constructor = clazz.getConstructor(new Class[] {
ServletContext.class });
return (AbstractServletContextWrapper)
constructor.newInstance(args);
}
catch (Throwable t)
{
throw new ChainedRuntimeException(
"Failed to create ServletContextWrapper", t);
}
}
|
public void removeAttribute(String theName) {
this.originalContext.removeAttribute(theName);
}
|
public void setAttribute(String theName,
Object theAttribute) {
this.originalContext.setAttribute(theName, theAttribute);
}
|
public void setInitParameter(String theName,
String theValue) {
this.initParameters.put(theName, theValue);
}
Sets a parameter as if it were set in the web.xml file
(using the <context-param> element). |