|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.slim3.struts.test.MockServletContext
public class MockServletContext
A mock implementation for ServletContext
.
Field Summary | |
---|---|
protected Map<String,Object> |
attributeTable
The map for the attributes. |
protected String |
contextPath
The context path. |
protected Map<String,String> |
initParameterMap
The map for the initial parameters. |
static int |
MAJOR_VERSION
Major Version |
static int |
MINOR_VERSION
Minor Version |
protected Map<String,String> |
realPathMap
The map for initial parameters. |
protected Map<String,URL> |
resourceMap
The map for resource. |
protected Map<String,Set<String>> |
resourcePathsMap
The map for resource paths. |
static String |
SERVER_INFO
Server Info |
protected String |
servletContextName
The servlet context name. |
Constructor Summary | |
---|---|
MockServletContext()
Constructor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAJOR_VERSION
public static final int MINOR_VERSION
public static final String SERVER_INFO
protected String servletContextName
protected String contextPath
protected Map<String,String> initParameterMap
protected Map<String,Object> attributeTable
protected Map<String,Set<String>> resourcePathsMap
protected Map<String,URL> resourceMap
protected Map<String,String> realPathMap
Constructor Detail |
---|
public MockServletContext()
Method Detail |
---|
public ServletContext getContext(String path)
getContext
in interface ServletContext
public int getMajorVersion()
getMajorVersion
in interface ServletContext
public int getMinorVersion()
getMinorVersion
in interface ServletContext
public String getMimeType(String file)
getMimeType
in interface ServletContext
public Set<String> getResourcePaths(String path)
getResourcePaths
in interface ServletContext
public void addResourcePaths(String path, Set<String> resourcePaths)
path
- the pathresourcePaths
- the resource pathspublic URL getResource(String path)
getResource
in interface ServletContext
public void addResource(String path, URL url)
path
- the pathurl
- the URL resourcepublic InputStream getResourceAsStream(String path)
getResourceAsStream
in interface ServletContext
public RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher
in interface ServletContext
public RequestDispatcher getNamedDispatcher(String name)
getNamedDispatcher
in interface ServletContext
public Servlet getServlet(String name) throws ServletException
getServlet
in interface ServletContext
ServletException
public Enumeration<Servlet> getServlets()
getServlets
in interface ServletContext
public Enumeration<String> getServletNames()
getServletNames
in interface ServletContext
public void log(String message)
log
in interface ServletContext
public void log(Exception ex, String message)
log
in interface ServletContext
public void log(String message, Throwable t)
log
in interface ServletContext
public String getRealPath(String path)
getRealPath
in interface ServletContext
public void addRealPath(String path, String realPath)
path
- the context relative pathrealPath
- the real pathpublic String getServerInfo()
getServerInfo
in interface ServletContext
ServletContext.getServerInfo()
public String getInitParameter(String name)
getInitParameter
in interface ServletContext
public Enumeration<String> getInitParameterNames()
getInitParameterNames
in interface ServletContext
public void setInitParameter(String name, String value)
name
- the parameter namevalue
- the valuepublic void removeInitParameter(String name)
name
- the parameter namepublic Object getAttribute(String name)
getAttribute
in interface ServletContext
ServletContext.getAttribute(java.lang.String)
public Enumeration<String> getAttributeNames()
getAttributeNames
in interface ServletContext
public void setAttribute(String name, Object value)
setAttribute
in interface ServletContext
public void removeAttribute(String name)
removeAttribute
in interface ServletContext
ServletContext.removeAttribute(java.lang.String)
public String getServletContextName()
getServletContextName
in interface ServletContext
ServletContext.getServletContextName()
public void setServletContextName(String servletContextName)
servletContextName
- the servlet context namepublic String getContextPath()
getContextPath
in interface ServletContext
public void setContextPath(String contextPath)
contextPath
- the context path
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |