Class EntityHttpServletRequest.EntityServletContext
- java.lang.Object
-
- org.sakaiproject.entitybroker.util.http.EntityHttpServletRequest.EntityServletContext
-
- All Implemented Interfaces:
ServletContext
- Enclosing class:
- EntityHttpServletRequest
public static class EntityHttpServletRequest.EntityServletContext extends Object implements ServletContext
For testing, based on the spring Mock version
-
-
Field Summary
Fields Modifier and Type Field Description static StringTEMP_DIR_CONTEXT_ATTRIBUTE
-
Constructor Summary
Constructors Constructor Description EntityServletContext()Create a new MockServletContext, using no base path and a DefaultResourceLoader (i.e. the classpath root as WAR root).EntityServletContext(String resourceBasePath)Create a new MockServletContext, using a DefaultResourceLoader.
-
Method Summary
-
-
-
Field Detail
-
TEMP_DIR_CONTEXT_ATTRIBUTE
public static final String TEMP_DIR_CONTEXT_ATTRIBUTE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EntityServletContext
public EntityServletContext()
Create a new MockServletContext, using no base path and a DefaultResourceLoader (i.e. the classpath root as WAR root).- See Also:
DefaultResourceLoader
-
EntityServletContext
public EntityServletContext(String resourceBasePath)
Create a new MockServletContext, using a DefaultResourceLoader.- Parameters:
resourceBasePath- the WAR root directory (should not end with a slash)- See Also:
DefaultResourceLoader
-
-
Method Detail
-
getResourceLocation
protected String getResourceLocation(String path)
Build a full resource location for the given path, prepending the resource base path of this MockServletContext.- Parameters:
path- the path as specified- Returns:
- the full resource path
-
setContextPath
public void setContextPath(String contextPath)
-
getContextPath
public String getContextPath()
- Specified by:
getContextPathin interfaceServletContext
-
registerContext
public void registerContext(String contextPath, ServletContext context)
-
getContext
public ServletContext getContext(String contextPath)
- Specified by:
getContextin interfaceServletContext
-
getMajorVersion
public int getMajorVersion()
- Specified by:
getMajorVersionin interfaceServletContext
-
getMinorVersion
public int getMinorVersion()
- Specified by:
getMinorVersionin interfaceServletContext
-
getMimeType
public String getMimeType(String filePath)
- Specified by:
getMimeTypein interfaceServletContext
-
getResourcePaths
public Set getResourcePaths(String path)
- Specified by:
getResourcePathsin interfaceServletContext
-
getResource
public URL getResource(String path) throws MalformedURLException
- Specified by:
getResourcein interfaceServletContext- Throws:
MalformedURLException
-
getResourceAsStream
public InputStream getResourceAsStream(String path)
- Specified by:
getResourceAsStreamin interfaceServletContext
-
getRequestDispatcher
public RequestDispatcher getRequestDispatcher(String path)
- Specified by:
getRequestDispatcherin interfaceServletContext
-
getNamedDispatcher
public RequestDispatcher getNamedDispatcher(String path)
- Specified by:
getNamedDispatcherin interfaceServletContext
-
getServlet
public Servlet getServlet(String name)
- Specified by:
getServletin interfaceServletContext
-
getServlets
public Enumeration getServlets()
- Specified by:
getServletsin interfaceServletContext
-
getServletNames
public Enumeration getServletNames()
- Specified by:
getServletNamesin interfaceServletContext
-
log
public void log(String message)
- Specified by:
login interfaceServletContext
-
log
public void log(Exception ex, String message)
- Specified by:
login interfaceServletContext
-
log
public void log(String message, Throwable ex)
- Specified by:
login interfaceServletContext
-
getRealPath
public String getRealPath(String path)
- Specified by:
getRealPathin interfaceServletContext
-
getServerInfo
public String getServerInfo()
- Specified by:
getServerInfoin interfaceServletContext
-
getInitParameter
public String getInitParameter(String name)
- Specified by:
getInitParameterin interfaceServletContext
-
getInitParameterNames
public Enumeration getInitParameterNames()
- Specified by:
getInitParameterNamesin interfaceServletContext
-
getAttribute
public Object getAttribute(String name)
- Specified by:
getAttributein interfaceServletContext
-
getAttributeNames
public Enumeration getAttributeNames()
- Specified by:
getAttributeNamesin interfaceServletContext
-
setAttribute
public void setAttribute(String name, Object value)
- Specified by:
setAttributein interfaceServletContext
-
removeAttribute
public void removeAttribute(String name)
- Specified by:
removeAttributein interfaceServletContext
-
setServletContextName
public void setServletContextName(String servletContextName)
-
getServletContextName
public String getServletContextName()
- Specified by:
getServletContextNamein interfaceServletContext
-
-