|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mockrunner.mock.web.MockServletContext
public class MockServletContext
Mock implementation of ServletContext
.
Constructor Summary | |
---|---|
MockServletContext()
|
Method Summary | |
---|---|
void |
addAttributeListener(javax.servlet.ServletContextAttributeListener listener)
|
void |
addResourcePath(java.lang.String path,
java.lang.String resourcePath)
|
void |
addResourcePaths(java.lang.String path,
java.util.Collection pathes)
|
void |
clearAttributes()
|
void |
clearInitParameters()
Clears the init parameters. |
void |
clearRequestDispatcherMap()
Clears the map of RequestDispatcher objects. |
java.lang.Object |
getAttribute(java.lang.String key)
|
java.util.Enumeration |
getAttributeNames()
|
javax.servlet.ServletContext |
getContext(java.lang.String url)
|
java.lang.String |
getContextPath()
|
java.lang.String |
getInitParameter(java.lang.String name)
|
java.util.Enumeration |
getInitParameterNames()
|
int |
getMajorVersion()
|
java.lang.String |
getMimeType(java.lang.String file)
|
int |
getMinorVersion()
|
javax.servlet.RequestDispatcher |
getNamedDispatcher(java.lang.String name)
|
java.lang.String |
getRealPath(java.lang.String path)
|
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String path)
|
java.util.Map |
getRequestDispatcherMap()
Returns the map of RequestDispatcher objects. |
java.net.URL |
getResource(java.lang.String path)
|
java.io.InputStream |
getResourceAsStream(java.lang.String path)
|
java.util.Set |
getResourcePaths(java.lang.String path)
|
java.lang.String |
getServerInfo()
|
javax.servlet.Servlet |
getServlet(java.lang.String arg0)
|
java.lang.String |
getServletContextName()
|
java.util.Enumeration |
getServletNames()
|
java.util.Enumeration |
getServlets()
|
void |
log(java.lang.Exception exc,
java.lang.String message)
|
void |
log(java.lang.String message)
|
void |
log(java.lang.String message,
java.lang.Throwable exc)
|
void |
removeAttribute(java.lang.String key)
|
void |
resetAll()
Resets the state of this object to the default values |
void |
setAttribute(java.lang.String key,
java.lang.Object value)
|
void |
setContext(java.lang.String url,
javax.servlet.ServletContext context)
Sets a ServletContext that will be returned
when calling getContext(java.lang.String) |
void |
setContextPath(java.lang.String contextPath)
|
void |
setInitParameter(java.lang.String name,
java.lang.String value)
Sets an init parameter. |
void |
setInitParameters(java.util.Map parameters)
Sets several init parameters. |
void |
setMimeType(java.lang.String file,
java.lang.String type)
|
void |
setRealPath(java.lang.String path,
java.lang.String realPath)
|
void |
setRequestDispatcher(java.lang.String path,
javax.servlet.RequestDispatcher dispatcher)
Sets a RequestDispatcher that will be returned when calling
getRequestDispatcher(java.lang.String) or getNamedDispatcher(java.lang.String)
with the specified path or name. |
void |
setResource(java.lang.String path,
java.net.URL url)
|
void |
setResourceAsStream(java.lang.String path,
byte[] data)
|
void |
setResourceAsStream(java.lang.String path,
java.io.InputStream inputStream)
|
void |
setServletContextName(java.lang.String servletContextName)
|
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 resetAll()
public void addAttributeListener(javax.servlet.ServletContextAttributeListener listener)
public void clearAttributes()
public java.lang.Object getAttribute(java.lang.String key)
getAttribute
in interface javax.servlet.ServletContext
public java.util.Enumeration getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletContext
public void removeAttribute(java.lang.String key)
removeAttribute
in interface javax.servlet.ServletContext
public void setAttribute(java.lang.String key, java.lang.Object value)
setAttribute
in interface javax.servlet.ServletContext
public javax.servlet.RequestDispatcher getNamedDispatcher(java.lang.String name)
getNamedDispatcher
in interface javax.servlet.ServletContext
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher
in interface javax.servlet.ServletContext
public java.util.Map getRequestDispatcherMap()
RequestDispatcher
objects. The specified path
maps to the corresponding RequestDispatcher
object.
RequestDispatcher
objectspublic void clearRequestDispatcherMap()
RequestDispatcher
objects.
public void setRequestDispatcher(java.lang.String path, javax.servlet.RequestDispatcher dispatcher)
RequestDispatcher
that will be returned when calling
getRequestDispatcher(java.lang.String)
or getNamedDispatcher(java.lang.String)
with the specified path or name.
If no RequestDispatcher
is set for the specified path, getRequestDispatcher(java.lang.String)
and
getNamedDispatcher(java.lang.String)
automatically create a new one.
path
- the path for the RequestDispatcher
dispatcher
- the RequestDispatcher
objectpublic javax.servlet.ServletContext getContext(java.lang.String url)
getContext
in interface javax.servlet.ServletContext
public void setContext(java.lang.String url, javax.servlet.ServletContext context)
ServletContext
that will be returned
when calling getContext(java.lang.String)
url
- the URLcontext
- the ServletContext
public void clearInitParameters()
public java.lang.String getInitParameter(java.lang.String name)
getInitParameter
in interface javax.servlet.ServletContext
public void setInitParameter(java.lang.String name, java.lang.String value)
name
- the namevalue
- the valuepublic void setInitParameters(java.util.Map parameters)
parameters
- the parameter mappublic java.util.Enumeration getInitParameterNames()
getInitParameterNames
in interface javax.servlet.ServletContext
public int getMajorVersion()
getMajorVersion
in interface javax.servlet.ServletContext
public int getMinorVersion()
getMinorVersion
in interface javax.servlet.ServletContext
public java.lang.String getMimeType(java.lang.String file)
getMimeType
in interface javax.servlet.ServletContext
public void setMimeType(java.lang.String file, java.lang.String type)
public java.lang.String getRealPath(java.lang.String path)
getRealPath
in interface javax.servlet.ServletContext
public void setRealPath(java.lang.String path, java.lang.String realPath)
public java.net.URL getResource(java.lang.String path) throws java.net.MalformedURLException
getResource
in interface javax.servlet.ServletContext
java.net.MalformedURLException
public void setResource(java.lang.String path, java.net.URL url)
public java.io.InputStream getResourceAsStream(java.lang.String path)
getResourceAsStream
in interface javax.servlet.ServletContext
public void setResourceAsStream(java.lang.String path, java.io.InputStream inputStream)
public void setResourceAsStream(java.lang.String path, byte[] data)
public java.util.Set getResourcePaths(java.lang.String path)
getResourcePaths
in interface javax.servlet.ServletContext
public void addResourcePaths(java.lang.String path, java.util.Collection pathes)
public void addResourcePath(java.lang.String path, java.lang.String resourcePath)
public java.lang.String getServerInfo()
getServerInfo
in interface javax.servlet.ServletContext
public javax.servlet.Servlet getServlet(java.lang.String arg0) throws javax.servlet.ServletException
getServlet
in interface javax.servlet.ServletContext
javax.servlet.ServletException
public java.lang.String getServletContextName()
getServletContextName
in interface javax.servlet.ServletContext
public void setServletContextName(java.lang.String servletContextName)
public java.lang.String getContextPath()
getContextPath
in interface javax.servlet.ServletContext
public void setContextPath(java.lang.String contextPath)
public java.util.Enumeration getServletNames()
getServletNames
in interface javax.servlet.ServletContext
public java.util.Enumeration getServlets()
getServlets
in interface javax.servlet.ServletContext
public void log(java.lang.Exception exc, java.lang.String message)
log
in interface javax.servlet.ServletContext
public void log(java.lang.String message, java.lang.Throwable exc)
log
in interface javax.servlet.ServletContext
public void log(java.lang.String message)
log
in interface javax.servlet.ServletContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |