public class MockPortletContext extends java.lang.Object implements PortletContext
PortletContext
interface.Constructor and Description |
---|
MockPortletContext()
Create a new MockPortletContext with no base path and a
DefaultResourceLoader (i.e.
|
MockPortletContext(ResourceLoader resourceLoader)
Create a new MockPortletContext, using the specified ResourceLoader
and no base path.
|
MockPortletContext(java.lang.String resourceBasePath)
Create a new MockPortletContext using a DefaultResourceLoader.
|
MockPortletContext(java.lang.String resourceBasePath,
ResourceLoader resourceLoader)
Create a new MockPortletContext.
|
Modifier and Type | Method and Description |
---|---|
void |
addContainerRuntimeOption(java.lang.String key) |
void |
addInitParameter(java.lang.String name,
java.lang.String value) |
java.lang.Object |
getAttribute(java.lang.String name) |
java.util.Enumeration<java.lang.String> |
getAttributeNames() |
java.util.Enumeration<java.lang.String> |
getContainerRuntimeOptions() |
java.lang.String |
getInitParameter(java.lang.String name) |
java.util.Enumeration<java.lang.String> |
getInitParameterNames() |
int |
getMajorVersion() |
java.lang.String |
getMimeType(java.lang.String filePath) |
int |
getMinorVersion() |
PortletRequestDispatcher |
getNamedDispatcher(java.lang.String path) |
java.lang.String |
getPortletContextName() |
java.lang.String |
getRealPath(java.lang.String path) |
PortletRequestDispatcher |
getRequestDispatcher(java.lang.String path) |
java.net.URL |
getResource(java.lang.String path) |
java.io.InputStream |
getResourceAsStream(java.lang.String path) |
protected java.lang.String |
getResourceLocation(java.lang.String path)
Build a full resource location for the given path,
prepending the resource base path of this MockPortletContext.
|
java.util.Set<java.lang.String> |
getResourcePaths(java.lang.String path) |
java.lang.String |
getServerInfo() |
void |
log(java.lang.String message) |
void |
log(java.lang.String message,
java.lang.Throwable t) |
void |
removeAttribute(java.lang.String name) |
void |
setAttribute(java.lang.String name,
java.lang.Object value) |
void |
setPortletContextName(java.lang.String portletContextName) |
public MockPortletContext()
DefaultResourceLoader
public MockPortletContext(java.lang.String resourceBasePath)
resourceBasePath
- the WAR root directory (should not end with a slash)DefaultResourceLoader
public MockPortletContext(ResourceLoader resourceLoader)
resourceLoader
- the ResourceLoader to use (or null for the default)public MockPortletContext(java.lang.String resourceBasePath, ResourceLoader resourceLoader)
resourceBasePath
- the WAR root directory (should not end with a slash)resourceLoader
- the ResourceLoader to use (or null for the default)protected java.lang.String getResourceLocation(java.lang.String path)
path
- the path as specifiedpublic java.lang.String getServerInfo()
getServerInfo
in interface PortletContext
public PortletRequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher
in interface PortletContext
public PortletRequestDispatcher getNamedDispatcher(java.lang.String path)
getNamedDispatcher
in interface PortletContext
public java.io.InputStream getResourceAsStream(java.lang.String path)
getResourceAsStream
in interface PortletContext
public int getMajorVersion()
getMajorVersion
in interface PortletContext
public int getMinorVersion()
getMinorVersion
in interface PortletContext
public java.lang.String getMimeType(java.lang.String filePath)
getMimeType
in interface PortletContext
public java.lang.String getRealPath(java.lang.String path)
getRealPath
in interface PortletContext
public java.util.Set<java.lang.String> getResourcePaths(java.lang.String path)
getResourcePaths
in interface PortletContext
public java.net.URL getResource(java.lang.String path) throws java.net.MalformedURLException
getResource
in interface PortletContext
java.net.MalformedURLException
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface PortletContext
public java.util.Enumeration<java.lang.String> getAttributeNames()
getAttributeNames
in interface PortletContext
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface PortletContext
public void removeAttribute(java.lang.String name)
removeAttribute
in interface PortletContext
public void addInitParameter(java.lang.String name, java.lang.String value)
public java.lang.String getInitParameter(java.lang.String name)
getInitParameter
in interface PortletContext
public java.util.Enumeration<java.lang.String> getInitParameterNames()
getInitParameterNames
in interface PortletContext
public void log(java.lang.String message)
log
in interface PortletContext
public void log(java.lang.String message, java.lang.Throwable t)
log
in interface PortletContext
public void setPortletContextName(java.lang.String portletContextName)
public java.lang.String getPortletContextName()
getPortletContextName
in interface PortletContext
public void addContainerRuntimeOption(java.lang.String key)
public java.util.Enumeration<java.lang.String> getContainerRuntimeOptions()
getContainerRuntimeOptions
in interface PortletContext