public class MockServletContext extends Object implements javax.servlet.ServletContext
ServletContext
Constructor and Description |
---|
MockServletContext() |
MockServletContext(String realPath) |
Modifier and Type | Method and Description |
---|---|
javax.servlet.FilterRegistration.Dynamic |
addFilter(String filterName,
Class<? extends javax.servlet.Filter> filterClass) |
javax.servlet.FilterRegistration.Dynamic |
addFilter(String filterName,
javax.servlet.Filter filter) |
javax.servlet.FilterRegistration.Dynamic |
addFilter(String filterName,
String className) |
void |
addListener(Class<? extends EventListener> listenerClass) |
void |
addListener(String className) |
<T extends EventListener> |
addListener(T t) |
javax.servlet.ServletRegistration.Dynamic |
addServlet(String servletName,
Class<? extends javax.servlet.Servlet> servletClass) |
javax.servlet.ServletRegistration.Dynamic |
addServlet(String servletName,
javax.servlet.Servlet servlet) |
javax.servlet.ServletRegistration.Dynamic |
addServlet(String servletName,
String className) |
<T extends javax.servlet.Filter> |
createFilter(Class<T> clazz) |
<T extends EventListener> |
createListener(Class<T> clazz) |
<T extends javax.servlet.Servlet> |
createServlet(Class<T> clazz) |
void |
declareRoles(String... roleNames) |
Object |
getAttribute(String s) |
Enumeration |
getAttributeNames() |
ClassLoader |
getClassLoader() |
javax.servlet.ServletContext |
getContext(String s) |
String |
getContextPath() |
Set<javax.servlet.SessionTrackingMode> |
getDefaultSessionTrackingModes() |
int |
getEffectiveMajorVersion() |
int |
getEffectiveMinorVersion() |
Set<javax.servlet.SessionTrackingMode> |
getEffectiveSessionTrackingModes() |
javax.servlet.FilterRegistration |
getFilterRegistration(String filterName) |
Map<String,? extends javax.servlet.FilterRegistration> |
getFilterRegistrations() |
String |
getInitParameter(String s) |
Enumeration |
getInitParameterNames() |
javax.servlet.descriptor.JspConfigDescriptor |
getJspConfigDescriptor() |
int |
getMajorVersion() |
String |
getMimeType(String s) |
int |
getMinorVersion() |
javax.servlet.RequestDispatcher |
getNamedDispatcher(String s) |
String |
getRealPath(String s) |
javax.servlet.RequestDispatcher |
getRequestDispatcher(String s) |
URL |
getResource(String s) |
InputStream |
getResourceAsStream(String s) |
Set |
getResourcePaths(String s) |
String |
getServerInfo() |
javax.servlet.Servlet |
getServlet(String s) |
String |
getServletContextName() |
Enumeration |
getServletNames() |
javax.servlet.ServletRegistration |
getServletRegistration(String servletName) |
Map<String,? extends javax.servlet.ServletRegistration> |
getServletRegistrations() |
Enumeration |
getServlets() |
javax.servlet.SessionCookieConfig |
getSessionCookieConfig() |
void |
log(Exception e,
String s) |
void |
log(String s) |
void |
log(String s,
Throwable throwable) |
void |
removeAttribute(String s) |
void |
setAttribute(String s,
Object o) |
boolean |
setInitParameter(String name,
String value) |
void |
setSessionTrackingModes(Set<javax.servlet.SessionTrackingMode> sessionTrackingModes) |
public MockServletContext()
public MockServletContext(String realPath)
public javax.servlet.ServletContext getContext(String s)
getContext
in interface javax.servlet.ServletContext
public int getMajorVersion()
getMajorVersion
in interface javax.servlet.ServletContext
public int getMinorVersion()
getMinorVersion
in interface javax.servlet.ServletContext
public String getMimeType(String s)
getMimeType
in interface javax.servlet.ServletContext
public Set getResourcePaths(String s)
getResourcePaths
in interface javax.servlet.ServletContext
public URL getResource(String s) throws MalformedURLException
getResource
in interface javax.servlet.ServletContext
MalformedURLException
public InputStream getResourceAsStream(String s)
getResourceAsStream
in interface javax.servlet.ServletContext
public javax.servlet.RequestDispatcher getRequestDispatcher(String s)
getRequestDispatcher
in interface javax.servlet.ServletContext
public javax.servlet.RequestDispatcher getNamedDispatcher(String s)
getNamedDispatcher
in interface javax.servlet.ServletContext
public javax.servlet.Servlet getServlet(String s) throws javax.servlet.ServletException
getServlet
in interface javax.servlet.ServletContext
javax.servlet.ServletException
public Enumeration getServlets()
getServlets
in interface javax.servlet.ServletContext
public Enumeration getServletNames()
getServletNames
in interface javax.servlet.ServletContext
public void log(String s)
log
in interface javax.servlet.ServletContext
public void log(Exception e, String s)
log
in interface javax.servlet.ServletContext
public void log(String s, Throwable throwable)
log
in interface javax.servlet.ServletContext
public String getRealPath(String s)
getRealPath
in interface javax.servlet.ServletContext
public String getServerInfo()
getServerInfo
in interface javax.servlet.ServletContext
public String getInitParameter(String s)
getInitParameter
in interface javax.servlet.ServletContext
public Enumeration getInitParameterNames()
getInitParameterNames
in interface javax.servlet.ServletContext
public Object getAttribute(String s)
getAttribute
in interface javax.servlet.ServletContext
public Enumeration getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletContext
public void setAttribute(String s, Object o)
setAttribute
in interface javax.servlet.ServletContext
public void removeAttribute(String s)
removeAttribute
in interface javax.servlet.ServletContext
public String getServletContextName()
getServletContextName
in interface javax.servlet.ServletContext
public String getContextPath()
getContextPath
in interface javax.servlet.ServletContext
public int getEffectiveMajorVersion()
getEffectiveMajorVersion
in interface javax.servlet.ServletContext
public int getEffectiveMinorVersion()
getEffectiveMinorVersion
in interface javax.servlet.ServletContext
public boolean setInitParameter(String name, String value)
setInitParameter
in interface javax.servlet.ServletContext
public javax.servlet.ServletRegistration.Dynamic addServlet(String servletName, String className)
addServlet
in interface javax.servlet.ServletContext
public javax.servlet.ServletRegistration.Dynamic addServlet(String servletName, javax.servlet.Servlet servlet)
addServlet
in interface javax.servlet.ServletContext
public javax.servlet.ServletRegistration.Dynamic addServlet(String servletName, Class<? extends javax.servlet.Servlet> servletClass)
addServlet
in interface javax.servlet.ServletContext
public <T extends javax.servlet.Servlet> T createServlet(Class<T> clazz) throws javax.servlet.ServletException
createServlet
in interface javax.servlet.ServletContext
javax.servlet.ServletException
public javax.servlet.ServletRegistration getServletRegistration(String servletName)
getServletRegistration
in interface javax.servlet.ServletContext
public Map<String,? extends javax.servlet.ServletRegistration> getServletRegistrations()
getServletRegistrations
in interface javax.servlet.ServletContext
public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, String className)
addFilter
in interface javax.servlet.ServletContext
public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, javax.servlet.Filter filter)
addFilter
in interface javax.servlet.ServletContext
public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, Class<? extends javax.servlet.Filter> filterClass)
addFilter
in interface javax.servlet.ServletContext
public <T extends javax.servlet.Filter> T createFilter(Class<T> clazz) throws javax.servlet.ServletException
createFilter
in interface javax.servlet.ServletContext
javax.servlet.ServletException
public javax.servlet.FilterRegistration getFilterRegistration(String filterName)
getFilterRegistration
in interface javax.servlet.ServletContext
public Map<String,? extends javax.servlet.FilterRegistration> getFilterRegistrations()
getFilterRegistrations
in interface javax.servlet.ServletContext
public javax.servlet.SessionCookieConfig getSessionCookieConfig()
getSessionCookieConfig
in interface javax.servlet.ServletContext
public void setSessionTrackingModes(Set<javax.servlet.SessionTrackingMode> sessionTrackingModes)
setSessionTrackingModes
in interface javax.servlet.ServletContext
public Set<javax.servlet.SessionTrackingMode> getDefaultSessionTrackingModes()
getDefaultSessionTrackingModes
in interface javax.servlet.ServletContext
public Set<javax.servlet.SessionTrackingMode> getEffectiveSessionTrackingModes()
getEffectiveSessionTrackingModes
in interface javax.servlet.ServletContext
public void addListener(String className)
addListener
in interface javax.servlet.ServletContext
public <T extends EventListener> void addListener(T t)
addListener
in interface javax.servlet.ServletContext
public void addListener(Class<? extends EventListener> listenerClass)
addListener
in interface javax.servlet.ServletContext
public <T extends EventListener> T createListener(Class<T> clazz) throws javax.servlet.ServletException
createListener
in interface javax.servlet.ServletContext
javax.servlet.ServletException
public javax.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor()
getJspConfigDescriptor
in interface javax.servlet.ServletContext
public ClassLoader getClassLoader()
getClassLoader
in interface javax.servlet.ServletContext
public void declareRoles(String... roleNames)
declareRoles
in interface javax.servlet.ServletContext
Copyright © 2002-2018 Atlassian. All Rights Reserved.