public class MockPortletContext
extends java.lang.Object
javax.portlet.PortletContext
interface.Modifier and Type | Class and Description |
---|---|
private static class |
MockPortletContext.MimeTypeResolver
Inner factory class used to just introduce a Java Activation Framework
dependency when actually asked to resolve a MIME type.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.Object> |
attributes |
private java.util.Set<java.lang.String> |
containerRuntimeOptions |
private java.util.Map<java.lang.String,java.lang.String> |
initParameters |
private Log |
logger |
private java.lang.String |
portletContextName |
private java.lang.String |
resourceBasePath |
private ResourceLoader |
resourceLoader |
private static java.lang.String |
TEMP_DIR_SYSTEM_PROPERTY |
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) |
private static final java.lang.String TEMP_DIR_SYSTEM_PROPERTY
private final Log logger
private final java.lang.String resourceBasePath
private final ResourceLoader resourceLoader
private final java.util.Map<java.lang.String,java.lang.Object> attributes
private final java.util.Map<java.lang.String,java.lang.String> initParameters
private java.lang.String portletContextName
private java.util.Set<java.lang.String> containerRuntimeOptions
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()
public PortletRequestDispatcher getRequestDispatcher(java.lang.String path)
public PortletRequestDispatcher getNamedDispatcher(java.lang.String path)
public java.io.InputStream getResourceAsStream(java.lang.String path)
public int getMajorVersion()
public int getMinorVersion()
public java.lang.String getMimeType(java.lang.String filePath)
public java.lang.String getRealPath(java.lang.String path)
public java.util.Set<java.lang.String> getResourcePaths(java.lang.String path)
public java.net.URL getResource(java.lang.String path) throws java.net.MalformedURLException
java.net.MalformedURLException
public java.lang.Object getAttribute(java.lang.String name)
public java.util.Enumeration<java.lang.String> getAttributeNames()
public void setAttribute(java.lang.String name, java.lang.Object value)
public void removeAttribute(java.lang.String name)
public void addInitParameter(java.lang.String name, java.lang.String value)
public java.lang.String getInitParameter(java.lang.String name)
public java.util.Enumeration<java.lang.String> getInitParameterNames()
public void log(java.lang.String message)
public void log(java.lang.String message, java.lang.Throwable t)
public void setPortletContextName(java.lang.String portletContextName)
public java.lang.String getPortletContextName()
public void addContainerRuntimeOption(java.lang.String key)
public java.util.Enumeration<java.lang.String> getContainerRuntimeOptions()