com.bea.netuix.servlets.controls.portlet
Class PortletPresentationContext

java.lang.Object
  extended by com.bea.netuix.servlets.controls.ControlContext
      extended by com.bea.netuix.servlets.controls.PresentationContext
          extended by com.bea.netuix.servlets.controls.window.WindowPresentationContext
              extended by com.bea.netuix.servlets.controls.portlet.PortletPresentationContext
All Implemented Interfaces
ResponseHeaderAdder, Serializable
Direct Known Subclasses:
ProxyPortletPresentationContext, WebflowPresentationContext

public class PortletPresentationContext
extends WindowPresentationContext

This class represents a portal portlet component. All presentation-related attributes of a portlet component are available from instances of this class. Such instances are typically used during portal rendering via look and feel skeleton files (e.g. window.jsp).

Depending on the context of invocation of this classes methods, some may throw UnsupportedOperationException. Such contexts include within remote WSRP portlets. All methods should function normally for locally rendered portlets.

See Also
getPortletPresentationContext(javax.servlet.http.HttpServletRequest), Serialized Form

Field Summary
 
Fields inherited from class com.bea.netuix.servlets.controls.window.WindowPresentationContext
CLASS_NAME
 
Constructor Summary
protected PortletPresentationContext()
           
 
Method Summary
 String getAsyncContent()
          Get the value of the portlet's asyncContent property.
 ControlContextConstants.HeaderMode getHeaderMode()
          Returns a HeaderMode representing the header mode currently set for the response object.
 javax.servlet.http.HttpServletRequest getHttpRequest()
          Returns a HttpServletRequest
 String getInstanceLabel()
          Return the instance label for the portlet.
 String getLabel()
          Return the instanceLabel for the portlet, if it exists.
 PagePresentationContext getPagePresentationContext()
          Return the portlets parent PagePresentationContext.
 PortletPreferences getPortletPreferences(javax.servlet.http.HttpServletRequest request)
          Returns a read-only copy of preferences for this portlet.
static PortletPresentationContext getPortletPresentationContext(javax.servlet.http.HttpServletRequest request)
          This is a convenience method for returning a reference to the current PortletPresentationContext.
 String getPortletUri()
          Getter for the portlet's URI. Example: /portlets/myportlet/myportlet.portlet
 PortletPreferences getPreferences(javax.servlet.http.HttpServletRequest request)
          Deprecated Use getPortletPreferences instead
 String getSharedParameterValue(String name)
          Gets the value of the specified shared parameter.
 String[] getSharedParameterValues(String name)
          Gets all values for the specified shared parameter.
 boolean isAsyncContent()
          Is the portlet set up to render asynchronously?
 boolean isCapable(Capability capability)
          Returns true if this control has the specified capability.
 boolean isClientRequest()
          Returns true if this is a Portal-Aware XMLHttpRequest from the client.
 boolean isContentOnly()
          This field only applies to async portlets.
 boolean isDefaultMinimized()
          Returns the value for defaultMinimized.
 boolean isPortletRenderedByClient()
          Returns true if this is a PortletSource-based request from the client.
 boolean isRemote()
          This method returns true when the portlet is being invoked remotely via WSRP on a producer.
 boolean isReturnContentToCaller()
          Returns true if Portal-Aware-XHR has been invoked within this portlet.
 void setHeaderMode(ControlContextConstants.HeaderMode mode)
          Accepts HeaderMode desired for this portlet running over WSRP.
 
Methods inherited from class com.bea.netuix.servlets.controls.window.WindowPresentationContext
getCapability, getContentAttributeRenderer, getContentPresentationClass, getContentPresentationContextChildren, getContentPresentationStyle, getDefinitionId, getDefinitionLabel, getInstanceId, getLocalInstanceId, getMetaData, getMetaDatas, getOrientation, getParentPagePresentationContext, getPreviousWindowMode, getThemePresentationContext, getTitle, getTitlebarPresentationContext, getWindowMode, getWindowPresentationContext, getWindowState, isPacked
 
Methods inherited from class com.bea.netuix.servlets.controls.PresentationContext
addCookie, addDateHeader, addHeader, addIntHeader, getAttributeRenderer, getChildren, getChildren, getFirstChild, getOrderedChildren, getParsedProperties, getPresentationClass, getPresentationId, getPresentationStyle, getProperties, getProperty, getProperty, getPropertyAsBoolean, getPropertyAsInt, getRenderFormat, getResolvedLocale, getTagName, isVisible, setCharacterEncoding, setContentType, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortletPresentationContext

protected PortletPresentationContext()
Method Detail

getInstanceLabel

public String getInstanceLabel()
Return the instance label for the portlet. This is a unique identifier for the portlet.

Returns
The portlet's instance label

getLabel

public String getLabel()
Return the instanceLabel for the portlet, if it exists. Otherwise, returns the portlet's definitionLabel.

Specified by:
getLabel in class WindowPresentationContext
Returns
The portlet's label

getPortletUri

public String getPortletUri()
Getter for the portlet's URI. Example: /portlets/myportlet/myportlet.portlet

Returns
A String containing the portlets uri.

isDefaultMinimized

public boolean isDefaultMinimized()
Returns the value for defaultMinimized.


getPortletPresentationContext

public static PortletPresentationContext getPortletPresentationContext(javax.servlet.http.HttpServletRequest request)
This is a convenience method for returning a reference to the current PortletPresentationContext. Note this method will only work if called from within a portal (typically, from the window.jsp skeleton). This method may return null if called when no appropriate context exists, but such a context should safely exist when being fetched from the associated skeleton JSP during normal portal rendering.

Parameters
request - The current HTTPServletRequest instance
Returns
A reference to the current PortletPresentationContext, if any

getPortletPreferences

public PortletPreferences getPortletPreferences(javax.servlet.http.HttpServletRequest request)
Returns a read-only copy of preferences for this portlet.

Parameters
request - The current HTTPServletRequest instance
Returns
The read-only preferences instance

getPreferences

@Deprecated
public PortletPreferences getPreferences(javax.servlet.http.HttpServletRequest request)
Deprecated Use getPortletPreferences instead

Returns a read-only copy of preferences for this portlet.

Parameters
request - The current HTTPServletRequest instance
Returns
The read-only preferences instance

isCapable

public boolean isCapable(Capability capability)
Returns true if this control has the specified capability.

Overrides:
isCapable in class WindowPresentationContext
Parameters
capability - A window mode or state
See Also
WindowCapabilities

isAsyncContent

public boolean isAsyncContent()
Is the portlet set up to render asynchronously?

Returns
true if the asyncContent property on the portlet is configured to anything besides "none".

getAsyncContent

public String getAsyncContent()
Get the value of the portlet's asyncContent property.

Returns
the value of the asyncContent property on the portlet.

isContentOnly

public boolean isContentOnly()
This field only applies to async portlets. This method returns true for the async request that actually renders the portlet content, and false for the "original" portal request that renders the main portal and portlet outline.


getPagePresentationContext

public PagePresentationContext getPagePresentationContext()
Return the portlets parent PagePresentationContext.

Returns
If this portlet is placed on a page then a reference to the parent page's backing context, otherwise null.

isPortletRenderedByClient

public boolean isPortletRenderedByClient()
Returns true if this is a PortletSource-based request from the client. "PortletSource-based" means that the request originated with an XHR from the PortletSource client-side API. The PortletSource API is an Ajax-based front end to the Portlet Publishing feature of WLP.

Returns
true if a portlet publishing request is being used to render this portlet

isReturnContentToCaller

public boolean isReturnContentToCaller()
Returns true if Portal-Aware-XHR has been invoked within this portlet.

Returns
whether or not this is an XPR request from this portlet.

isClientRequest

public boolean isClientRequest()
Returns true if this is a Portal-Aware XMLHttpRequest from the client. For example, such requests may be generated when asynchronous rendering is enabled for a desktop and a postback link is clicked in a portlet.

This method is a more general alternative to the isPortletSourceRequest() method, which only applies to portlet publishing requests from the PortletSource client-side API. This isClientRequest() method is for any request made by the framework using the portal XMLHttpRequest client-side API which includes portlet publishing and several other use cases.

Returns
true if the request originated from the Portal-Aware XMLHttpRequest client-side API.

isRemote

public boolean isRemote()
This method returns true when the portlet is being invoked remotely via WSRP on a producer. This method returns false for local portlets.

Returns
whether or not this portlet is remote

getSharedParameterValue

public String getSharedParameterValue(String name)
Gets the value of the specified shared parameter. If there are multiple values for the specified shared parameter, the first value is returned.

Parameters
name - the parameterID of the parameter to get. If the name is not a registered shared parameter, null will be returned.
Returns
the first value of the specified shared parameter, or null if the parameter has no values or is not a registered shared parameter for this portlet.

getSharedParameterValues

public String[] getSharedParameterValues(String name)
Gets all values for the specified shared parameter.

Parameters
name - the parameterID of the parameter to get. If the name is not a registered shared parameter, null will be returned.
Returns
the values of the specified shared parameter, or null if the parameter has no values or is not a registered shared parameter for this portlet.

setHeaderMode

public void setHeaderMode(ControlContextConstants.HeaderMode mode)
Accepts HeaderMode desired for this portlet running over WSRP. If not explicitly set for the portlet, it defaults to what was set for the WSRP Producer. If the WSRP producer did not have it set in its configuration file, then it defaults to HeaderMode.BOTH. If the portlet is not running over WSRP, this setting will be ignored.

Parameters
HeaderMode - desired mode for headers on the response object

getHeaderMode

public ControlContextConstants.HeaderMode getHeaderMode()
Returns a HeaderMode representing the header mode currently set for the response object. Defaults to HeaderMode.CLIENT when in non-WSRP mode.

Returns
HeaderMode the setting for how headers are being handled on the response object

getHttpRequest

public javax.servlet.http.HttpServletRequest getHttpRequest()
Returns a HttpServletRequest

Returns
HttpServletRequest the Http Servlet request object


Copyright © 2011, Oracle. All rights reserved.