|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shale.test.mock.MockServletContext
public class MockServletContext
Mock implementation of ServletContext.
WARNING - Before you can get meaningful results from
calls to the getResource(), getResourceAsStream(),
getResourcePaths(), or getRealPath() methods,
you must configure the documentRoot property, passing in a
File object pointing at a directory that simulates a
web application structure.
| Constructor Summary | |
|---|---|
MockServletContext()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MockServletContext()
| Method Detail |
|---|
public void addAttributeListener(ServletContextAttributeListener listener)
Add a new listener instance that should be notified about attribute changes.
listener - Listener to be added
public void addInitParameter(String name,
String value)
Add a context initialization parameter to the set of parameters recognized by this instance.
name - Parameter namevalue - Parameter value
public void addMimeType(String extension,
String contentType)
Add a new MIME type mapping to the set of mappings recognized by this instance.
extension - Extension to check for (without the period)contentType - Corresponding content typepublic void setDocumentRoot(File documentRoot)
Set the document root for getRealPath()
resolution. This parameter MUST represent
a directory.
documentRoot - The new base directorypublic Object getAttribute(String name)
getAttribute in interface ServletContextpublic Enumeration getAttributeNames()
getAttributeNames in interface ServletContextpublic ServletContext getContext(String uripath)
getContext in interface ServletContextpublic String getContextPath()
getContextPath in interface ServletContextpublic String getInitParameter(String name)
getInitParameter in interface ServletContextpublic Enumeration getInitParameterNames()
getInitParameterNames in interface ServletContextpublic int getMajorVersion()
getMajorVersion in interface ServletContextpublic String getMimeType(String path)
getMimeType in interface ServletContextpublic int getMinorVersion()
getMinorVersion in interface ServletContextpublic RequestDispatcher getNamedDispatcher(String name)
getNamedDispatcher in interface ServletContextpublic String getRealPath(String path)
getRealPath in interface ServletContextpublic RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher in interface ServletContext
public URL getResource(String path)
throws MalformedURLException
getResource in interface ServletContextMalformedURLExceptionpublic InputStream getResourceAsStream(String path)
getResourceAsStream in interface ServletContextpublic Set getResourcePaths(String path)
getResourcePaths in interface ServletContext
public Servlet getServlet(String name)
throws ServletException
getServlet in interface ServletContextServletExceptionpublic String getServletContextName()
getServletContextName in interface ServletContextpublic String getServerInfo()
getServerInfo in interface ServletContextpublic Enumeration getServlets()
getServlets in interface ServletContextpublic Enumeration getServletNames()
getServletNames in interface ServletContextpublic void log(String message)
log in interface ServletContext
public void log(Exception exception,
String message)
log in interface ServletContext
public void log(String message,
Throwable exception)
log in interface ServletContextpublic void removeAttribute(String name)
removeAttribute in interface ServletContext
public void setAttribute(String name,
Object value)
setAttribute in interface ServletContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||