|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The PortletContext
interface defines a portlet's view of the
portlet container within which each portlet is running.
Method Summary | |
java.lang.Object |
getAttribute(java.lang.String arg0)
|
java.util.Enumeration |
getAttributeNames()
|
java.lang.String |
getInitParameter(java.lang.String name)
|
java.util.Enumeration |
getInitParameterNames()
|
net.sf.jportlet.portlet.PortletLog |
getLog()
Returns the portlet log which allows the portlet to write debug, informational, warning, or error messages to a log |
java.io.InputStream |
getResourceAsStream(java.lang.String path,
net.sf.jportlet.portlet.Client client)
Returns the resource located at the given path (inside the portlet context) as an InputStream for a given client device
, or null if the resource not found. |
java.io.InputStream |
getResourceAsStream(java.lang.String path,
net.sf.jportlet.portlet.Client client,
java.util.Locale locale)
Returns the resource located at the given path (inside the portlet context) as an java.io.InputStream for a given client device
and Locale , or null if the resource not found. |
java.lang.String |
getResourcePath(java.lang.String path,
net.sf.jportlet.portlet.Client client)
Return the path of a resource for a given client device , or null if the resource not found. |
java.lang.String |
getResourcePath(java.lang.String path,
net.sf.jportlet.portlet.Client client,
java.util.Locale locale)
Return the path of a resource for a given client device and Locale , or null if the resource not found. |
net.sf.jportlet.service.PortletService |
getService(java.lang.String name)
This function looks up a portlet service with the given classname. |
java.lang.String |
getText(java.lang.String key,
java.util.Locale locale)
Returns the localized text resource with the given key and using the given locale. |
void |
include(java.lang.String path,
net.sf.jportlet.portlet.PortletRequest request,
net.sf.jportlet.portlet.PortletResponse response)
Allows the portlet to render a resource as specified by the given path (inside the portlet context). |
void |
removeAttribute(java.lang.String name)
|
void |
send(java.lang.String portletName,
java.lang.Object message,
net.sf.jportlet.portlet.PortletRequest request,
net.sf.jportlet.portlet.PortletResponse response)
Send a message to a portlet. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
|
Methods inherited from interface javax.servlet.ServletContext |
getContext, getMajorVersion, getMimeType, getMinorVersion, getNamedDispatcher, getRealPath, getRequestDispatcher, getResource, getResourceAsStream, getResourcePaths, getServerInfo, getServlet, getServletContextName, getServletNames, getServlets, log, log, log |
Method Detail |
public java.lang.Object getAttribute(java.lang.String arg0)
getAttribute
in interface javax.servlet.ServletContext
ServletContext.getAttribute(java.lang.String)
public java.util.Enumeration getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletContext
ServletContext.getAttributeNames()
public java.lang.String getInitParameter(java.lang.String name)
getInitParameter
in interface javax.servlet.ServletContext
ServletContext.getInitParameter(java.lang.String)
public java.util.Enumeration getInitParameterNames()
getInitParameterNames
in interface javax.servlet.ServletContext
ServletContext.getInitParameterNames()
public net.sf.jportlet.portlet.PortletLog getLog()
public java.io.InputStream getResourceAsStream(java.lang.String path, net.sf.jportlet.portlet.Client client)
InputStream
for a given client device
, or null
if the resource not found.
The resource are always searched first from the portlet classpath, and
if not found, it will be searched from the portlet web module.
For example, if a web-browser request to the portlet
com.foo.MyPortlet
named myportlet
the resource /template.vm
,
This function will search the following files until it found it:
path
- Path of the requested resourceclient
- Information about the client device
public java.io.InputStream getResourceAsStream(java.lang.String path, net.sf.jportlet.portlet.Client client, java.util.Locale locale)
java.io.InputStream
for a given client device
and Locale
, or null
if the resource not found.
The resource are always searched first from the portlet classpath, and
if not found, it will be searched from the portlet web module.
For example, if a web-browser from US request to the portlet
com.foo.MyPortlet
named myportlet
the resource /template.vm
,
This function will search the following files until it found it:
path
- resource pathclient
- clientlocale
- locale
public java.lang.String getResourcePath(java.lang.String path, net.sf.jportlet.portlet.Client client)
null
if the resource not found.
See #getResourcePath()
to understand how the container find
the requested resource
path
- resource pathclient
- client
public java.lang.String getResourcePath(java.lang.String path, net.sf.jportlet.portlet.Client client, java.util.Locale locale)
Locale
, or null
if the resource not found.
See #getResourcePath()
to understand how the container find
the requested resource
path
- resource pathclient
- clientlocale
- locale
public net.sf.jportlet.service.PortletService getService(java.lang.String name) throws PortletServiceUnavailableException, PortletServiceNotFoundException
name
- name of the service
PortletServiceUnavailableException
- if an exception has occurrred that interferes with the portlet service's normal initialization
PortletServiceNotFoundException
- if the service not foundpublic java.lang.String getText(java.lang.String key, java.util.Locale locale)
CLASSPATH
has
to contain a resource bundle with the same name (including the package)
as the portlet
key
- key of the textlocale
- target locale
public void include(java.lang.String path, net.sf.jportlet.portlet.PortletRequest request, net.sf.jportlet.portlet.PortletResponse response) throws PortletException, java.io.IOException
For example, For the portlet com.foo.MyPortlet
named myportlet
,
a file /template.vm
will be searched for
in the following order, when accessing via HTML-Browser:
path
- path of the file to includerequest
- request of the portletresponse
- response of the portlet
java.io.IOException
- if any IO error
PortletException
- if any other errorpublic void removeAttribute(java.lang.String name)
removeAttribute
in interface javax.servlet.ServletContext
ServletContext.removeAttribute(java.lang.String)
public void send(java.lang.String portletName, java.lang.Object message, net.sf.jportlet.portlet.PortletRequest request, net.sf.jportlet.portlet.PortletResponse response) throws PortletException
portletName
not specified,
this method will broadcast the message to all portlets
portletName
- name of the portletmessage
- message to sendrequest
- response
-
PortletException
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface javax.servlet.ServletContext
ServletContext.setAttribute(java.lang.String, java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |