org.apache.jetspeed.container.url.impl
Class AbstractPortalURL

java.lang.Object
  extended by org.apache.jetspeed.container.url.impl.AbstractPortalURL
All Implemented Interfaces:
PortalURL
Direct Known Subclasses:
DesktopEncodingPortalURL, PathInfoEncodingPortalURL, QueryStringEncodingPortalURL

public abstract class AbstractPortalURL
extends java.lang.Object
implements PortalURL

AbstractPortalURL delivers the base implemention for parsing Jetspeed Portal URLs and creating new Portlet URLs. Not implemented is the encoding and decoding of the NavigationState parameter in the URL, allowing concrete implementations to supply different algorithms for it like encoding it as pathInfo or as query string parameter.

Version:
$Id: AbstractPortalURL.java 605989 2007-12-20 18:26:54Z ate $
Author:
Ate Douma

Field Summary
protected  BasePortalURL base
           
protected  java.lang.String basePath
           
protected  java.lang.String characterEncoding
           
protected  java.lang.String contextPath
           
static java.lang.String DEFAULT_NAV_STATE_PARAMETER
           
protected  java.lang.String encodedNavState
           
protected  NavigationalState navState
           
protected static java.lang.String navStateParameter
           
protected  java.lang.String nonSecureBaseURL
           
protected  java.lang.String path
           
protected static java.lang.Boolean relativeOnly
           
protected  java.lang.String secureBaseURL
           
 
Fields inherited from interface org.apache.jetspeed.container.url.PortalURL
HTTP, HTTPS
 
Constructor Summary
AbstractPortalURL(javax.servlet.http.HttpServletRequest request, java.lang.String characterEncoding, NavigationalState navState, PortalContext portalContext)
           
AbstractPortalURL(NavigationalState navState, PortalContext portalContext)
           
AbstractPortalURL(NavigationalState navState, PortalContext portalContext, BasePortalURL base)
           
AbstractPortalURL(java.lang.String characterEncoding, NavigationalState navState, PortalContext portalContext)
           
 
Method Summary
 java.lang.String createNavigationalEncoding(org.apache.pluto.om.window.PortletWindow window, java.util.Map parameters, javax.portlet.PortletMode mode, javax.portlet.WindowState state, boolean action)
          Creates the navigational encoding for a given window Similiar to createPortletURL above
 java.lang.String createNavigationalEncoding(org.apache.pluto.om.window.PortletWindow window, javax.portlet.PortletMode mode, javax.portlet.WindowState state)
          Creates the navigational encoding for a given window Similiar to createPortletURL above
 java.lang.String createPortletURL(org.apache.pluto.om.window.PortletWindow window, java.util.Map parameters, javax.portlet.PortletMode mode, javax.portlet.WindowState state, boolean action, boolean secure)
          Create a new PortletURL for a PortletWindow including request or action parameters.
 java.lang.String createPortletURL(org.apache.pluto.om.window.PortletWindow window, javax.portlet.PortletMode mode, javax.portlet.WindowState state, boolean secure)
          Create a new PortletURL for a PortletWindow retaining its (request) parameters.
protected abstract  java.lang.String createPortletURL(java.lang.String encodedNavState, boolean secure)
           
protected  void decodeBasePath(javax.servlet.http.HttpServletRequest request)
           
protected  void decodeBaseURL(javax.servlet.http.HttpServletRequest request)
           
protected abstract  void decodePathAndNavigationalState(javax.servlet.http.HttpServletRequest request)
           
 java.lang.String getBasePath()
          Returns the current Portal base path.
 java.lang.String getBaseURL()
          Gets the Base URL for this portal.
 java.lang.String getBaseURL(boolean secure)
          Gets a secure version of the Base URL for this portal.
 NavigationalState getNavigationalState()
          Gets the NavigationalState for access to the current request portal control parameters
static java.lang.String getNavigationalStateParameterName()
           
 java.lang.String getPageBasePath()
          Returns the current Portal Page base path without possible encoded NavigationalState parameter.
 java.lang.String getPath()
          Gets the global navigational path of the current request.
 java.lang.String getPortalURL()
           
 boolean hasEncodedNavState()
           
 boolean isPathInfoEncodingNavState()
           
 boolean isRelativeOnly()
           
 boolean isSecure()
           
 void setCharacterEncoding(java.lang.String characterEncoding)
           
protected  void setEncodedNavigationalState(java.lang.String encodedNavigationalState)
           
protected  void setPath(java.lang.String path)
           
 void setRequest(javax.servlet.http.HttpServletRequest request)
          Sets the @link{javax.servlet.http.HttpServletRequest} that will be used to generate urls.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NAV_STATE_PARAMETER

public static final java.lang.String DEFAULT_NAV_STATE_PARAMETER
See Also:
Constant Field Values

navStateParameter

protected static java.lang.String navStateParameter

navState

protected NavigationalState navState

base

protected BasePortalURL base

relativeOnly

protected static java.lang.Boolean relativeOnly

contextPath

protected java.lang.String contextPath

basePath

protected java.lang.String basePath

path

protected java.lang.String path

encodedNavState

protected java.lang.String encodedNavState

secureBaseURL

protected java.lang.String secureBaseURL

nonSecureBaseURL

protected java.lang.String nonSecureBaseURL

characterEncoding

protected java.lang.String characterEncoding
Constructor Detail

AbstractPortalURL

public AbstractPortalURL(NavigationalState navState,
                         PortalContext portalContext,
                         BasePortalURL base)

AbstractPortalURL

public AbstractPortalURL(NavigationalState navState,
                         PortalContext portalContext)

AbstractPortalURL

public AbstractPortalURL(java.lang.String characterEncoding,
                         NavigationalState navState,
                         PortalContext portalContext)

AbstractPortalURL

public AbstractPortalURL(javax.servlet.http.HttpServletRequest request,
                         java.lang.String characterEncoding,
                         NavigationalState navState,
                         PortalContext portalContext)
Method Detail

isRelativeOnly

public boolean isRelativeOnly()
Specified by:
isRelativeOnly in interface PortalURL
Returns:
true if only relative urls should be generated (without scheme, servername, port)

getNavigationalStateParameterName

public static java.lang.String getNavigationalStateParameterName()

createNavigationalEncoding

public java.lang.String createNavigationalEncoding(org.apache.pluto.om.window.PortletWindow window,
                                                   java.util.Map parameters,
                                                   javax.portlet.PortletMode mode,
                                                   javax.portlet.WindowState state,
                                                   boolean action)
Description copied from interface: PortalURL
Creates the navigational encoding for a given window Similiar to createPortletURL above

Specified by:
createNavigationalEncoding in interface PortalURL
Parameters:
window - the PortalWindow
parameters - the new request or action parameters for the PortalWindow
mode - the new PortletMode for the PortalWindow
state - the new WindowState for the PortalWindow
action - indicates if an actionURL or renderURL is created
Returns:
a new navigational state as String

createNavigationalEncoding

public java.lang.String createNavigationalEncoding(org.apache.pluto.om.window.PortletWindow window,
                                                   javax.portlet.PortletMode mode,
                                                   javax.portlet.WindowState state)
Description copied from interface: PortalURL
Creates the navigational encoding for a given window Similiar to createPortletURL above

Specified by:
createNavigationalEncoding in interface PortalURL
Parameters:
window - the PortalWindow
mode - the new PortletMode for the PortalWindow
state - the new WindowState for the PortalWindow
Returns:
a new renderURL as String

decodeBaseURL

protected void decodeBaseURL(javax.servlet.http.HttpServletRequest request)

decodeBasePath

protected void decodeBasePath(javax.servlet.http.HttpServletRequest request)

setEncodedNavigationalState

protected void setEncodedNavigationalState(java.lang.String encodedNavigationalState)

setPath

protected void setPath(java.lang.String path)

getBaseURL

public java.lang.String getBaseURL()
Description copied from interface: PortalURL
Gets the Base URL for this portal.

Specified by:
getBaseURL in interface PortalURL
Returns:
The Base URL of the portal.

getBaseURL

public java.lang.String getBaseURL(boolean secure)
Description copied from interface: PortalURL
Gets a secure version of the Base URL for this portal.

Specified by:
getBaseURL in interface PortalURL
Returns:
The secure Base URL of the portal.

getBasePath

public java.lang.String getBasePath()
Description copied from interface: PortalURL
Returns the current Portal base path.
This path can be used as base for root relative pages and resources which don't need the NavigationalState.

Specified by:
getBasePath in interface PortalURL
Returns:
the current Portal base path without NavigationalState

getPath

public java.lang.String getPath()
Description copied from interface: PortalURL
Gets the global navigational path of the current request.
The path does not contain the NavigationalState parameter

Specified by:
getPath in interface PortalURL
Returns:
The the global navigational path of the current request.

getPageBasePath

public java.lang.String getPageBasePath()
Description copied from interface: PortalURL
Returns the current Portal Page base path without possible encoded NavigationalState parameter.
This path can be used as base for page relative resources which don't need the NavigationalState.

Specified by:
getPageBasePath in interface PortalURL
Returns:
the current Portal Page base path without NavigationalState

isSecure

public boolean isSecure()
Specified by:
isSecure in interface PortalURL
Returns:
true if the current request is secure

getNavigationalState

public NavigationalState getNavigationalState()
Description copied from interface: PortalURL
Gets the NavigationalState for access to the current request portal control parameters

Specified by:
getNavigationalState in interface PortalURL
Returns:
the NavigationalState of the PortalURL

createPortletURL

public java.lang.String createPortletURL(org.apache.pluto.om.window.PortletWindow window,
                                         java.util.Map parameters,
                                         javax.portlet.PortletMode mode,
                                         javax.portlet.WindowState state,
                                         boolean action,
                                         boolean secure)
Description copied from interface: PortalURL
Create a new PortletURL for a PortletWindow including request or action parameters.
The Portal Navigational State is encoded within the URL

Specified by:
createPortletURL in interface PortalURL
Parameters:
window - the PortalWindow
parameters - the new request or action parameters for the PortalWindow
mode - the new PortletMode for the PortalWindow
state - the new WindowState for the PortalWindow
action - indicates if an actionURL or renderURL is created
secure - indicates if a secure url is required
Returns:
a new actionURL or renderURL as String

createPortletURL

public java.lang.String createPortletURL(org.apache.pluto.om.window.PortletWindow window,
                                         javax.portlet.PortletMode mode,
                                         javax.portlet.WindowState state,
                                         boolean secure)
Description copied from interface: PortalURL
Create a new PortletURL for a PortletWindow retaining its (request) parameters.
The Portal Navigational State is encoded within the URL

Specified by:
createPortletURL in interface PortalURL
Parameters:
window - the PortalWindow
mode - the new PortletMode for the PortalWindow
state - the new WindowState for the PortalWindow
Returns:
a new renderURL as String

decodePathAndNavigationalState

protected abstract void decodePathAndNavigationalState(javax.servlet.http.HttpServletRequest request)

createPortletURL

protected abstract java.lang.String createPortletURL(java.lang.String encodedNavState,
                                                     boolean secure)

setRequest

public void setRequest(javax.servlet.http.HttpServletRequest request)
Description copied from interface: PortalURL
Sets the @link{javax.servlet.http.HttpServletRequest} that will be used to generate urls.

Specified by:
setRequest in interface PortalURL

setCharacterEncoding

public void setCharacterEncoding(java.lang.String characterEncoding)
Specified by:
setCharacterEncoding in interface PortalURL

getPortalURL

public java.lang.String getPortalURL()
Specified by:
getPortalURL in interface PortalURL
Returns:
a Portal URL with encoded current navigational state

hasEncodedNavState

public boolean hasEncodedNavState()
Specified by:
hasEncodedNavState in interface PortalURL
Returns:
true if navigational state was provided on the url

isPathInfoEncodingNavState

public boolean isPathInfoEncodingNavState()
Specified by:
isPathInfoEncodingNavState in interface PortalURL
Returns:
true if navigational state is encoded as pathInfo


Copyright © 1999-2009 Apache Software Foundation. All Rights Reserved.