Package mondrian.tui
Class MockServletContext
java.lang.Object
mondrian.tui.MockServletContext
- All Implemented Interfaces:
javax.servlet.ServletContext
Partial implementation of the
ServletContext
where just
enough is present to allow for communication between Mondrian's
XMLA code and other code in the same JVM.
Currently it is used in both the CmdRunner and in XMLA JUnit tests. If you need to add to this implementation, please do so.
- Author:
- Richard M. Emberson
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addInitParameter
(String name, String value) void
addResource
(String name, URL url) Returns an Enumeration containing the attribute names available within this servlet context.javax.servlet.ServletContext
getContext
(String s) Returns a ServletContext object that corresponds to a specified URL on the server.getInitParameter
(String name) Returns a String containing the value of the named context-wide initialization parameter, or null if the parameter does not exist.Returns the names of the context's initialization parameters as an Enumeration of String objects, or an empty Enumeration if the context has no initialization parameters.int
Returns the major version of the Java Servlet API that this servlet container supports.Returns the MIME type of the specified file, or null if the MIME type is not known.int
Returns the minor version of the Servlet API that this servlet container supports.javax.servlet.RequestDispatcher
Returns a RequestDispatcher object that acts as a wrapper for the named servlet.getRealPath
(String path) Returns a String containing the real path for a given virtual path.javax.servlet.RequestDispatcher
Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path.getResource
(String name) Returns a URL to the resource that is mapped to a specified path.Returns the resource located at the named path as an InputStream object.Returns the name and version of the servlet container on which the servlet is running.javax.servlet.Servlet
getServlet
(String s) void
Deprecated.Method log is deprecatedvoid
Writes the specified message to a servlet log file, usually an event log.void
Writes an explanatory message and a stack trace for a given Throwable exception to the servlet log file.void
Removes the attribute with the given name from the servlet context.void
setAttribute
(String s, Object obj) Binds an object to a given attribute name in this servlet context.void
setMajorVersion
(int majorVersion) void
setMinorVersion
(int minorVersion)
-
Field Details
-
PARAM_DATASOURCES_CONFIG
- See Also:
-
PARAM_CHAR_ENCODING
- See Also:
-
PARAM_CALLBACKS
- See Also:
-
-
Constructor Details
-
MockServletContext
public MockServletContext()
-
-
Method Details
-
getContext
Returns a ServletContext object that corresponds to a specified URL on the server.- Specified by:
getContext
in interfacejavax.servlet.ServletContext
-
getMajorVersion
public int getMajorVersion()Returns the major version of the Java Servlet API that this servlet container supports.- Specified by:
getMajorVersion
in interfacejavax.servlet.ServletContext
-
getMinorVersion
public int getMinorVersion()Returns the minor version of the Servlet API that this servlet container supports.- Specified by:
getMinorVersion
in interfacejavax.servlet.ServletContext
-
getMimeType
Returns the MIME type of the specified file, or null if the MIME type is not known.- Specified by:
getMimeType
in interfacejavax.servlet.ServletContext
-
getResourcePaths
- Specified by:
getResourcePaths
in interfacejavax.servlet.ServletContext
-
getResource
Returns a URL to the resource that is mapped to a specified path.- Specified by:
getResource
in interfacejavax.servlet.ServletContext
- Throws:
MalformedURLException
-
getResourceAsStream
Returns the resource located at the named path as an InputStream object.- Specified by:
getResourceAsStream
in interfacejavax.servlet.ServletContext
-
getRequestDispatcher
Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path.- Specified by:
getRequestDispatcher
in interfacejavax.servlet.ServletContext
-
getNamedDispatcher
Returns a RequestDispatcher object that acts as a wrapper for the named servlet.- Specified by:
getNamedDispatcher
in interfacejavax.servlet.ServletContext
-
getServlet
- Specified by:
getServlet
in interfacejavax.servlet.ServletContext
- Throws:
javax.servlet.ServletException
-
getServlets
- Specified by:
getServlets
in interfacejavax.servlet.ServletContext
-
getServletNames
- Specified by:
getServletNames
in interfacejavax.servlet.ServletContext
-
log
Writes the specified message to a servlet log file, usually an event log.- Specified by:
log
in interfacejavax.servlet.ServletContext
-
log
Deprecated.Method log is deprecatedDeprecated. As of Java Servlet API 2.1, use log(String message, Throwable throwable) instead. This method was originally defined to write an exception's stack trace and an explanatory error message to the servlet log file.- Specified by:
log
in interfacejavax.servlet.ServletContext
-
log
Writes an explanatory message and a stack trace for a given Throwable exception to the servlet log file.- Specified by:
log
in interfacejavax.servlet.ServletContext
-
getRealPath
Returns a String containing the real path for a given virtual path.- Specified by:
getRealPath
in interfacejavax.servlet.ServletContext
-
getServerInfo
Returns the name and version of the servlet container on which the servlet is running.- Specified by:
getServerInfo
in interfacejavax.servlet.ServletContext
-
getInitParameter
Returns a String containing the value of the named context-wide initialization parameter, or null if the parameter does not exist.- Specified by:
getInitParameter
in interfacejavax.servlet.ServletContext
-
getInitParameterNames
Returns the names of the context's initialization parameters as an Enumeration of String objects, or an empty Enumeration if the context has no initialization parameters.- Specified by:
getInitParameterNames
in interfacejavax.servlet.ServletContext
-
getAttribute
- Specified by:
getAttribute
in interfacejavax.servlet.ServletContext
-
getAttributeNames
Returns an Enumeration containing the attribute names available within this servlet context.- Specified by:
getAttributeNames
in interfacejavax.servlet.ServletContext
-
setAttribute
Binds an object to a given attribute name in this servlet context.- Specified by:
setAttribute
in interfacejavax.servlet.ServletContext
-
removeAttribute
Removes the attribute with the given name from the servlet context.- Specified by:
removeAttribute
in interfacejavax.servlet.ServletContext
-
getServletContextName
- Specified by:
getServletContextName
in interfacejavax.servlet.ServletContext
-
setMajorVersion
public void setMajorVersion(int majorVersion) -
setMinorVersion
public void setMinorVersion(int minorVersion) -
addResource
-
addInitParameter
-