|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 addedpublic void addInitParameter(String name, String value)
Add a context initialization parameter to the set of parameters recognized by this instance.
name
- Parameter namevalue
- Parameter valuepublic 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 ServletContext
public Enumeration getAttributeNames()
getAttributeNames
in interface ServletContext
public ServletContext getContext(String uripath)
getContext
in interface ServletContext
public String getContextPath()
getContextPath
in interface ServletContext
public String getInitParameter(String name)
getInitParameter
in interface ServletContext
public Enumeration getInitParameterNames()
getInitParameterNames
in interface ServletContext
public int getMajorVersion()
getMajorVersion
in interface ServletContext
public String getMimeType(String path)
getMimeType
in interface ServletContext
public int getMinorVersion()
getMinorVersion
in interface ServletContext
public RequestDispatcher getNamedDispatcher(String name)
getNamedDispatcher
in interface ServletContext
public String getRealPath(String path)
getRealPath
in interface ServletContext
public RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher
in interface ServletContext
public URL getResource(String path) throws MalformedURLException
getResource
in interface ServletContext
MalformedURLException
public InputStream getResourceAsStream(String path)
getResourceAsStream
in interface ServletContext
public Set getResourcePaths(String path)
getResourcePaths
in interface ServletContext
public Servlet getServlet(String name) throws ServletException
getServlet
in interface ServletContext
ServletException
public String getServletContextName()
getServletContextName
in interface ServletContext
public String getServerInfo()
getServerInfo
in interface ServletContext
public Enumeration getServlets()
getServlets
in interface ServletContext
public Enumeration getServletNames()
getServletNames
in interface ServletContext
public 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 ServletContext
public 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 |