org.apache.tapestry.test.mock
Class MockContext
java.lang.Object
org.apache.tapestry.test.mock.AttributeHolder
org.apache.tapestry.test.mock.MockContext
- All Implemented Interfaces:
- ServletContext, InitParameterHolder
public class MockContext
- extends AttributeHolder
- implements ServletContext, InitParameterHolder
Mock implementation of ServletContext
.
- Since:
- 4.0
- Author:
- Howard Lewis Ship
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MockContext
public MockContext()
MockContext
public MockContext(String testDirectory)
getContext
public ServletContext getContext(String name)
- Specified by:
getContext
in interface ServletContext
getMajorVersion
public int getMajorVersion()
- Specified by:
getMajorVersion
in interface ServletContext
getMinorVersion
public int getMinorVersion()
- Specified by:
getMinorVersion
in interface ServletContext
getMimeType
public String getMimeType(String path)
- Specified by:
getMimeType
in interface ServletContext
getResourcePaths
public Set getResourcePaths(String arg0)
- Specified by:
getResourcePaths
in interface ServletContext
getResource
public URL getResource(String path)
throws MalformedURLException
- Specified by:
getResource
in interface ServletContext
- Throws:
MalformedURLException
getResourceAsStream
public InputStream getResourceAsStream(String path)
- Specified by:
getResourceAsStream
in interface ServletContext
getRequestDispatcher
public RequestDispatcher getRequestDispatcher(String path)
- Gets a dispatcher for the given path. Path should be a relative path (relative
to the context). A special case: "NULL" returns null (i.e., when a
dispatcher can't be found).
- Specified by:
getRequestDispatcher
in interface ServletContext
getNamedDispatcher
public RequestDispatcher getNamedDispatcher(String name)
- Specified by:
getNamedDispatcher
in interface ServletContext
getServlet
public Servlet getServlet(String name)
throws ServletException
- Specified by:
getServlet
in interface ServletContext
- Throws:
ServletException
getServlets
public Enumeration getServlets()
- Specified by:
getServlets
in interface ServletContext
getServletNames
public Enumeration getServletNames()
- Specified by:
getServletNames
in interface ServletContext
log
public void log(String message)
- Specified by:
log
in interface ServletContext
log
public void log(Exception exception,
String message)
- Specified by:
log
in interface ServletContext
log
public void log(String message,
Throwable exception)
- Specified by:
log
in interface ServletContext
getRealPath
public String getRealPath(String arg0)
- Specified by:
getRealPath
in interface ServletContext
getContextPath
public String getContextPath()
getServerInfo
public String getServerInfo()
- Specified by:
getServerInfo
in interface ServletContext
getInitParameter
public String getInitParameter(String name)
- Specified by:
getInitParameter
in interface ServletContext
- Specified by:
getInitParameter
in interface InitParameterHolder
getInitParameterNames
public Enumeration getInitParameterNames()
- Specified by:
getInitParameterNames
in interface ServletContext
- Specified by:
getInitParameterNames
in interface InitParameterHolder
setInitParameter
public void setInitParameter(String name,
String value)
- Description copied from interface:
InitParameterHolder
- Allows Mock objects to have initial parameters set.
- Specified by:
setInitParameter
in interface InitParameterHolder
getServletContextName
public String getServletContextName()
- Specified by:
getServletContextName
in interface ServletContext
createSession
public MockSession createSession()
getSession
public MockSession getSession()
setServletContextName
public void setServletContextName(String servletContextName)
getRootDirectory
public String getRootDirectory()
setRootDirectory
public void setRootDirectory(String rootDirectory)
Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.