站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

MockPortletContext (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.mock.web.portlet
Class MockPortletContext

java.lang.Object
  extended by org.springframework.mock.web.portlet.MockPortletContext
All Implemented Interfaces:
PortletContext

public class MockPortletContext
extends Object
implements PortletContext

Mock implementation of the PortletContext interface.

Since:
2.0
Author:
John A. Lewis, Juergen Hoeller

Constructor Summary
MockPortletContext()
          Create a new MockPortletContext with no base path and a DefaultResourceLoader (i.e. the classpath root as WAR root).
MockPortletContext(ResourceLoader resourceLoader)
          Create a new MockPortletContext, using the specified ResourceLoader and no base path.
MockPortletContext(String resourceBasePath)
          Create a new MockPortletContext using a DefaultResourceLoader.
MockPortletContext(String resourceBasePath, ResourceLoader resourceLoader)
          Create a new MockPortletContext.
 
Method Summary
 void addInitParameter(String name, String value)
           
 Object getAttribute(String name)
           
 Enumeration getAttributeNames()
           
 String getInitParameter(String name)
           
 Enumeration getInitParameterNames()
           
 int getMajorVersion()
           
 String getMimeType(String filePath)
           
 int getMinorVersion()
           
 PortletRequestDispatcher getNamedDispatcher(String path)
           
 String getPortletContextName()
           
 String getRealPath(String path)
           
 PortletRequestDispatcher getRequestDispatcher(String path)
           
 URL getResource(String path)
           
 InputStream getResourceAsStream(String path)
           
protected  String getResourceLocation(String path)
          Build a full resource location for the given path, prepending the resource base path of this MockPortletContext.
 Set getResourcePaths(String path)
           
 String getServerInfo()
           
 void log(String message)
           
 void log(String message, Throwable t)
           
 void removeAttribute(String name)
           
 void setAttribute(String name, Object value)
           
 void setPortletContextName(String portletContextName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockPortletContext

public MockPortletContext()
Create a new MockPortletContext with no base path and a DefaultResourceLoader (i.e. the classpath root as WAR root).

See Also:
DefaultResourceLoader

MockPortletContext

public MockPortletContext(String resourceBasePath)
Create a new MockPortletContext using a DefaultResourceLoader.

Parameters:
resourceBasePath - the WAR root directory (should not end with a slash)
See Also:
DefaultResourceLoader

MockPortletContext

public MockPortletContext(ResourceLoader resourceLoader)
Create a new MockPortletContext, using the specified ResourceLoader and no base path.

Parameters:
resourceLoader - the ResourceLoader to use (or null for the default)

MockPortletContext

public MockPortletContext(String resourceBasePath,
                          ResourceLoader resourceLoader)
Create a new MockPortletContext.

Parameters:
resourceBasePath - the WAR root directory (should not end with a slash)
resourceLoader - the ResourceLoader to use (or null for the default)
Method Detail

getResourceLocation

protected String getResourceLocation(String path)
Build a full resource location for the given path, prepending the resource base path of this MockPortletContext.

Parameters:
path - the path as specified
Returns:
the full resource path

getServerInfo

public String getServerInfo()
Specified by:
getServerInfo in interface PortletContext

getRequestDispatcher

public PortletRequestDispatcher getRequestDispatcher(String path)
Specified by:
getRequestDispatcher in interface PortletContext

getNamedDispatcher

public PortletRequestDispatcher getNamedDispatcher(String path)
Specified by:
getNamedDispatcher in interface PortletContext

getResourceAsStream

public InputStream getResourceAsStream(String path)
Specified by:
getResourceAsStream in interface PortletContext

getMajorVersion

public int getMajorVersion()
Specified by:
getMajorVersion in interface PortletContext

getMinorVersion

public int getMinorVersion()
Specified by:
getMinorVersion in interface PortletContext

getMimeType

public String getMimeType(String filePath)
Specified by:
getMimeType in interface PortletContext

getRealPath

public String getRealPath(String path)
Specified by:
getRealPath in interface PortletContext

getResourcePaths

public Set getResourcePaths(String path)
Specified by:
getResourcePaths in interface PortletContext

getResource

public URL getResource(String path)
                throws MalformedURLException
Specified by:
getResource in interface PortletContext
Throws:
MalformedURLException

getAttribute

public Object getAttribute(String name)
Specified by:
getAttribute in interface PortletContext

getAttributeNames

public Enumeration getAttributeNames()
Specified by:
getAttributeNames in interface PortletContext

setAttribute

public void setAttribute(String name,
                         Object value)
Specified by:
setAttribute in interface PortletContext

removeAttribute

public void removeAttribute(String name)
Specified by:
removeAttribute in interface PortletContext

addInitParameter

public void addInitParameter(String name,
                             String value)

getInitParameter

public String getInitParameter(String name)
Specified by:
getInitParameter in interface PortletContext

getInitParameterNames

public Enumeration getInitParameterNames()
Specified by:
getInitParameterNames in interface PortletContext

log

public void log(String message)
Specified by:
log in interface PortletContext

log

public void log(String message,
                Throwable t)
Specified by:
log in interface PortletContext

setPortletContextName

public void setPortletContextName(String portletContextName)

getPortletContextName

public String getPortletContextName()
Specified by:
getPortletContextName in interface PortletContext

The Spring Framework

Copyright © 2002-2007 The Spring Framework.