|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.myfaces.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()
|
|
| Method Summary | |
|---|---|
void |
addAttributeListener(javax.servlet.ServletContextAttributeListener listener)
Add a new listener instance that should be notified about attribute changes. |
void |
addInitParameter(String name,
String value)
Add a context initialization parameter to the set of parameters recognized by this instance. |
void |
addMimeType(String extension,
String contentType)
Add a new MIME type mapping to the set of mappings recognized by this instance. |
Object |
getAttribute(String name)
|
Enumeration |
getAttributeNames()
|
javax.servlet.ServletContext |
getContext(String uripath)
|
String |
getContextPath()
|
String |
getInitParameter(String name)
|
Enumeration |
getInitParameterNames()
|
int |
getMajorVersion()
|
String |
getMimeType(String path)
|
int |
getMinorVersion()
|
javax.servlet.RequestDispatcher |
getNamedDispatcher(String name)
|
String |
getRealPath(String path)
|
javax.servlet.RequestDispatcher |
getRequestDispatcher(String path)
|
URL |
getResource(String path)
|
InputStream |
getResourceAsStream(String path)
|
Set |
getResourcePaths(String path)
|
String |
getServerInfo()
|
javax.servlet.Servlet |
getServlet(String name)
|
String |
getServletContextName()
|
Enumeration |
getServletNames()
|
Enumeration |
getServlets()
|
MockWebContainer |
getWebContainer()
|
void |
log(Exception exception,
String message)
|
void |
log(String message)
|
void |
log(String message,
Throwable exception)
|
void |
removeAttribute(String name)
|
void |
setAttribute(String name,
Object value)
|
void |
setDocumentRoot(File documentRoot)
Set the document root for getRealPath()
resolution. |
void |
setDocumentRoot(URI base)
|
void |
setWebContainer(MockWebContainer container)
|
| 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 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 void setDocumentRoot(URI base)
public void addAttributeListener(javax.servlet.ServletContextAttributeListener listener)
Add a new listener instance that should be notified about attribute changes.
listener - Listener to be addedpublic MockWebContainer getWebContainer()
public void setWebContainer(MockWebContainer container)
public Object getAttribute(String name)
getAttribute in interface javax.servlet.ServletContextpublic Enumeration getAttributeNames()
getAttributeNames in interface javax.servlet.ServletContextpublic String getInitParameter(String name)
getInitParameter in interface javax.servlet.ServletContextpublic Enumeration getInitParameterNames()
getInitParameterNames in interface javax.servlet.ServletContextpublic int getMajorVersion()
getMajorVersion in interface javax.servlet.ServletContextpublic String getMimeType(String path)
getMimeType in interface javax.servlet.ServletContextpublic int getMinorVersion()
getMinorVersion in interface javax.servlet.ServletContextpublic String getRealPath(String path)
getRealPath in interface javax.servlet.ServletContext
public URL getResource(String path)
throws MalformedURLException
getResource in interface javax.servlet.ServletContextMalformedURLExceptionpublic InputStream getResourceAsStream(String path)
getResourceAsStream in interface javax.servlet.ServletContextpublic Set getResourcePaths(String path)
getResourcePaths in interface javax.servlet.ServletContextpublic void log(String message)
log in interface javax.servlet.ServletContext
public void log(Exception exception,
String message)
log in interface javax.servlet.ServletContext
public void log(String message,
Throwable exception)
log in interface javax.servlet.ServletContextpublic void removeAttribute(String name)
removeAttribute in interface javax.servlet.ServletContext
public void setAttribute(String name,
Object value)
setAttribute in interface javax.servlet.ServletContextpublic javax.servlet.ServletContext getContext(String uripath)
getContext in interface javax.servlet.ServletContextpublic String getContextPath()
getContextPath in interface javax.servlet.ServletContext
public javax.servlet.Servlet getServlet(String name)
throws javax.servlet.ServletException
getServlet in interface javax.servlet.ServletContextjavax.servlet.ServletExceptionpublic String getServletContextName()
getServletContextName in interface javax.servlet.ServletContextpublic String getServerInfo()
getServerInfo in interface javax.servlet.ServletContextpublic Enumeration getServlets()
getServlets in interface javax.servlet.ServletContextpublic Enumeration getServletNames()
getServletNames in interface javax.servlet.ServletContextpublic javax.servlet.RequestDispatcher getNamedDispatcher(String name)
getNamedDispatcher in interface javax.servlet.ServletContextpublic javax.servlet.RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher in interface javax.servlet.ServletContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||