com.bea.portlet
Class StandalonePortletURL

java.lang.Object
  extended by com.bea.portlet.GenericURL
      extended by com.bea.portlet.PostbackURL
          extended by com.bea.portlet.WindowURL
              extended by com.bea.portlet.StandalonePortletURL
All Implemented Interfaces
Cloneable

public class StandalonePortletURL
extends WindowURL

The StandalonePortletURL class creates URLs used to render individual portlets. URLs created by this class preserve contextual information from the originating Portal such as Look and Feel and Theme. The intended use cases for StandalonePortletURL involve the rendering of portlets outside of the main Portal page, such as in popup windows, IFRAMEs or non-Portal HTML pages.

StandalonePortletURL can be used to produce three main types of URLs:

  1. Self-referencing URLs
  2. URLs referencing other portlets
  3. Detached Portlet URLs
By default StandalonePortletURL will create URLs that reference the "current" portlet. This type of URL can only be created from within the context of a portlet, and can be used to render the current portlet in an alternative state or mode. When a StandalonePortletURL is created with a specific windowLabel the URL will reference the specified portlet.

By specifying a portletUri when creating a StandalonePortletURL a Detached Portlet URL will be created. Detached Portlets are external to the Portal, but these mechanisms allow for such portlets to share some context with the Portal (such as Look and Feel). NOTE that Detached Portlets created from a customized Desktop will actually reference the primary instance of the portlet.

For all types of StandalonePortletURL three different levels of decoration can be used:

  1. "normal"
  2. content-only fragment
  3. content-only document
By default StandalonePortletURL will create URLs that cause the referenced portlet to render with all normal portal decoration, such as titlebars, borders and other expected visual aspects of the portal such as colors and fonts. When created with the contentOnly property set to true, the resulting URL will cause the referenced portlet to be rendered as an HTML fragment consisting of only the content of the portlet. This level of decoration may be appropriate for use cases that want to incorporate portlet content into an existing document by using DHTML mechanisms. Alternatively, the contentMode property can be set to FRAGMENT to cause the referenced portlet to be rendered as an HTML document. This level of decoration may be appropriate for use cases that want to display portlet content in a popup window or an embedded iframe.

See Also
"Portlet Development Guide", "Client-side Development Guide"

Nested Class Summary
static class StandalonePortletURL.ContentMode
          Enumeration of valid values for the KEY_CONTENT_MODE parameter
 
Field Summary
static String KEY_ASYNC
           
static String KEY_ASYNC_MODE
           
static String KEY_CONTENT_MODE
           
static String KEY_CONTENT_ONLY
           
static String KEY_DEFAULT_WINDOW_ICON
           
static String KEY_DEFAULT_WINDOW_ICON_PATH
           
static String KEY_DISC_ENABLED
           
static String KEY_PORTAL_CONTENT_TYPE
           
static String KEY_PORTLET_INSTANCE_LABEL
           
static String KEY_SKELETON
           
static String KEY_SKELETON_CHROMOSOME
           
static String KEY_SKELETON_PATH
           
static String KEY_SKIN
           
static String KEY_SKIN_CHROMOSOME
           
static String KEY_SKIN_PATH
           
static String KEY_STREAMING
          this attribute is true if the url is to a streamed portlet.
static String KEY_THEME_ALT_SKELETON
           
static String KEY_THEME_ALT_SKIN
           
static String KEY_THEME_NAME
           
static String KEY_THEME_SKELETON_CHROMOSOME
           
static String KEY_THEME_SKIN_CHROMOSOME
           
static String KEY_TITLE
           
 
Fields inherited from class com.bea.portlet.GenericURL
COMMUNITY_ADMIN_FLAG_PARAM, COMMUNITY_DESKTOP, CONTROL_STATE_PARAM, CURRENT_PAGE, domain, DOMAIN, EVENT_NAME_PARAM, httpRequest, httpResponse, httpsDomain, LOADSTATE_PARAM, MODE_PARAM, PAGE_LABEL_PARAM, params, PATH, PORT, PORTLET_SUB_INSTANCE_ID, POSTBACK_PARAM, PREFIX, QUERY_STRING, SCHEME, SECURE_PORT, STATE_PARAM, TREE_OPTIMIZATION_PARAM, URL_COMPRESSION, WINDOW_LABEL_PARAM
 
Constructor Summary
protected StandalonePortletURL(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
          Constructs a self-referencing StandalonePortletURL.
protected StandalonePortletURL(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, String windowLabel)
          Constructs a StandalonePortletURL that references the specified portlet.
 
Method Summary
 void addParameter(String name, String value)
          Adds a query parameter to the URL.
 void addParameter(String name, String value, boolean encodeName, boolean encodeValue)
          Add a parameter.
 Object clone()
          Returns a deep copy of this StandalonePortletURL.
static StandalonePortletURL createStandalonePortletURL(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
          Returns a self-referencing StandalonePortletURL.
static StandalonePortletURL createStandalonePortletURL(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, String windowLabel)
          Returns a StandalonePortletURL that references the specified portlet.
 StandalonePortletURL.ContentMode getContentMode()
          Returns the content mode used to render the Portlet.
 String getPortletServletName()
          Deprecated  
 boolean isContentOnly()
          Returns true if only the content of the Portlet will be rendered.
 void setContentMode(StandalonePortletURL.ContentMode contentMode)
          Sets the content mode used to render the portlet.
 void setContentOnly(boolean contentOnly)
          Set to true to render only the content of the portlet.
 void setDesktopStateShared(boolean desktopStateShared)
          Deprecated Provided only for backward compatibility
 void setPortletServletName(String servletPortletName)
          Deprecated  
 void setPortletUri(String portletUri)
          Used to create a "detached" Portlet.
 void setWindowLabel(String windowLabel)
          Equivalent to using the three-argument factory method to create a URL.
 
Methods inherited from class com.bea.portlet.WindowURL
createWindowURL, createWindowURL, getWindowLabel, getWindowMode, getWindowState, removeSharedParameter, setWindowMode, setWindowState
 
Methods inherited from class com.bea.portlet.PostbackURL
createPostbackURL
 
Methods inherited from class com.bea.portlet.GenericURL
addAjaxNoRewriteParam, addParameter, appendEnsureSeparator, appendEnsureSeparator, createGenericURL, createQueryString, createQueryStringBuilder, getAmpForm, getContextualPath, getCurrentPageLabel, getDomain, getEncodeSession, getParameter, getParameters, getPath, getPathPrefix, getPort, getResolvedTemplate, getScheme, getSecurePort, getSecurityTokenManagerClass, getSecurityTokenName, getSecurityTokenValue, getTemplate, getUrlType, removeParameter, setContextualPath, setDomain, setEncodeSession, setForcedAmpForm, setPath, setPathPrefix, setPort, setScheme, setSecurePort, setTemplate, toString, verifySecurityToken
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_STREAMING

public static final String KEY_STREAMING
this attribute is true if the url is to a streamed portlet.

See Also
Constants Summary

KEY_TITLE

public static final String KEY_TITLE
See Also
Constants Summary

KEY_SKELETON

public static final String KEY_SKELETON
See Also
Constants Summary

KEY_SKELETON_PATH

public static final String KEY_SKELETON_PATH
See Also
Constants Summary

KEY_SKELETON_CHROMOSOME

public static final String KEY_SKELETON_CHROMOSOME
See Also
Constants Summary

KEY_SKIN

public static final String KEY_SKIN
See Also
Constants Summary

KEY_SKIN_PATH

public static final String KEY_SKIN_PATH
See Also
Constants Summary

KEY_SKIN_CHROMOSOME

public static final String KEY_SKIN_CHROMOSOME
See Also
Constants Summary

KEY_DEFAULT_WINDOW_ICON

public static final String KEY_DEFAULT_WINDOW_ICON
See Also
Constants Summary

KEY_DEFAULT_WINDOW_ICON_PATH

public static final String KEY_DEFAULT_WINDOW_ICON_PATH
See Also
Constants Summary

KEY_THEME_NAME

public static final String KEY_THEME_NAME
See Also
Constants Summary

KEY_THEME_ALT_SKELETON

public static final String KEY_THEME_ALT_SKELETON
See Also
Constants Summary

KEY_THEME_ALT_SKIN

public static final String KEY_THEME_ALT_SKIN
See Also
Constants Summary

KEY_THEME_SKELETON_CHROMOSOME

public static final String KEY_THEME_SKELETON_CHROMOSOME
See Also
Constants Summary

KEY_THEME_SKIN_CHROMOSOME

public static final String KEY_THEME_SKIN_CHROMOSOME
See Also
Constants Summary

KEY_PORTAL_CONTENT_TYPE

public static final String KEY_PORTAL_CONTENT_TYPE
See Also
Constants Summary

KEY_PORTLET_INSTANCE_LABEL

public static final String KEY_PORTLET_INSTANCE_LABEL
See Also
Constants Summary

KEY_CONTENT_ONLY

public static final String KEY_CONTENT_ONLY
See Also
Constants Summary

KEY_CONTENT_MODE

public static final String KEY_CONTENT_MODE
See Also
Constants Summary

KEY_ASYNC

public static final String KEY_ASYNC
See Also
Constants Summary

KEY_ASYNC_MODE

public static final String KEY_ASYNC_MODE
See Also
Constants Summary

KEY_DISC_ENABLED

public static final String KEY_DISC_ENABLED
See Also
Constants Summary
Constructor Detail

StandalonePortletURL

protected StandalonePortletURL(javax.servlet.http.HttpServletRequest httpRequest,
                               javax.servlet.http.HttpServletResponse httpResponse)

Constructs a self-referencing StandalonePortletURL.

Parameters
httpRequest - HTTP request
httpResponse - HTTP response

StandalonePortletURL

protected StandalonePortletURL(javax.servlet.http.HttpServletRequest httpRequest,
                               javax.servlet.http.HttpServletResponse httpResponse,
                               String windowLabel)

Constructs a StandalonePortletURL that references the specified portlet.

Parameters
httpRequest - HTTP request
httpResponse - HTTP response
windowLabel - window label
Method Detail

createStandalonePortletURL

public static StandalonePortletURL createStandalonePortletURL(javax.servlet.http.HttpServletRequest httpRequest,
                                                              javax.servlet.http.HttpServletResponse httpResponse)

Returns a self-referencing StandalonePortletURL.

Parameters
httpRequest - HTTP request
httpResponse - HTTP response
Returns
a new StandalonePortletURL

createStandalonePortletURL

public static StandalonePortletURL createStandalonePortletURL(javax.servlet.http.HttpServletRequest httpRequest,
                                                              javax.servlet.http.HttpServletResponse httpResponse,
                                                              String windowLabel)

Returns a StandalonePortletURL that references the specified portlet.

Parameters
httpRequest - HTTP request
httpResponse - HTTP response
windowLabel - the window label of the portlet that is the target of this URL.
Returns
StandalonePortletURL

setPortletServletName

@Deprecated
public void setPortletServletName(String servletPortletName)
Deprecated 

This method is deprecated and should not be used.


getPortletServletName

@Deprecated
public String getPortletServletName()
Deprecated 

This method is deprecated and should not be used.


isContentOnly

public boolean isContentOnly()
Returns true if only the content of the Portlet will be rendered.


setContentOnly

public void setContentOnly(boolean contentOnly)
Set to true to render only the content of the portlet.

Parameters
contentOnly - if true, only the content of the portlet will be rendered.

getContentMode

public StandalonePortletURL.ContentMode getContentMode()
Returns the content mode used to render the Portlet. Only used if "contentOnly" is set to true.


setContentMode

public void setContentMode(StandalonePortletURL.ContentMode contentMode)
Sets the content mode used to render the portlet. Only used if "contentOnly" is set to true. Defaults to StandalonePortletURL.ContentMode.FRAGMENT if not specified.

Parameters
contentMode - the content mode to use when rendering the portlet if only the portlet's content is to be rendered.
See Also
setContentOnly(boolean)

setDesktopStateShared

@Deprecated
public void setDesktopStateShared(boolean desktopStateShared)
Deprecated Provided only for backward compatibility

Set to false to prevent the Portlet from sharing state with it's originating desktop. WARNING: This is provided for backward compatibility with existing applications; all other uses are unsupported.


setWindowLabel

public void setWindowLabel(String windowLabel)
Equivalent to using the three-argument factory method to create a URL. Will cause the Portlet with the specified window label to be the target of this URL.

This method and the setPortletUri(String) method are mutually exclusive

Overrides:
setWindowLabel in class WindowURL
Parameters
windowLabel - the window label of the portlet to be the target of this URL
See Also
createStandalonePortletURL(HttpServletRequest, HttpServletResponse, String)

setPortletUri

public void setPortletUri(String portletUri)
Used to create a "detached" Portlet. A detached portlet is not associated with a Portal and is typically used to provide shared "popup" type application components.

This method and the setWindowLabel(String) method are mutually exclusive

Parameters
portletUri - Webapp-relative path to the .portlet file

clone

public Object clone()

Returns a deep copy of this StandalonePortletURL.

Overrides:
clone in class WindowURL
Returns
a deep copy of this StandalonePortletURL

addParameter

public void addParameter(String name,
                         String value)

Adds a query parameter to the URL. Multiple values for the same parameter can be set by calling this method multiple times with the same name.

This method URL encodes the parameter name and value.

Overrides:
addParameter in class GenericURL
Parameters
name - the name of the query parameter.
value - the value of the query parameter.

addParameter

public void addParameter(String name,
                         String value,
                         boolean encodeName,
                         boolean encodeValue)

Add a parameter. Multiple values for the same parameter can be set by calling this method multiple times with the same name.

If the encodeName boolean argument is true, this method URL encodes the parameter name. If the encodeValue boolean argument is true, this method URL encodes the parameter value.

Overrides:
addParameter in class GenericURL
Parameters
name - parameter's name
value - parameter's value
encodeName - true if the parameter's name should be encoded
encodeValue - true if the parameter's value should be encoded


Copyright © 2011, Oracle. All rights reserved.