com.liferay.faces.bridge.context.url
Class BridgeURLBaseImpl

java.lang.Object
  extended by com.liferay.faces.bridge.context.url.BridgeURLBaseImpl
All Implemented Interfaces:
BridgeURL
Direct Known Subclasses:
BridgePartialActionURLImpl, BridgeResourceURLCompatImpl, BridgeResponseURLImpl

public abstract class BridgeURLBaseImpl
extends Object
implements BridgeURL

This is a utility class used only by ExternalContextImpl that represents a URL with attributes that the Bridge Spec is concerned with. The getter methods in this class make heavy use of lazy-initialization for performance reasons, because it is unlikely that every method will be called.

Author:
Neil Griffin

Field Summary
protected  BridgeConfig bridgeConfig
           
protected  BridgeContext bridgeContext
           
protected static String PORTLET_ACTION
           
protected static String PORTLET_RENDER
           
protected static String PORTLET_RESOURCE
           
protected static String RELATIVE_PATH_PREFIX
           
protected  String url
           
 
Constructor Summary
BridgeURLBaseImpl(String url, String currentFacesViewId, BridgeContext bridgeContext)
           
 
Method Summary
protected  String _toString(boolean modeChanged)
           
protected  String _toString(boolean modeChanged, Set<String> excludedParameterNames)
           
 String getContextRelativePath()
          Returns the context-relative path in the URL.
 String getParameter(String name)
          Returns the value of the underlying BridgeURL.getParameterMap() with the specified name.
 Map<String,String[]> getParameterMap()
          Returns a mutable Map representing the URL parameters.
 Set<String> getParameterNames()
          Returns a list of key names from the underlying BridgeURL.getParameterMap().
 Bridge.PortletPhase getPortletPhase()
          Returns the Bridge.PortletPhase associated with this URL.
protected  String getSchemeSpecificPart()
          Returns the scheme-specific part of the URI.
protected  URI getURI()
           
protected  String getViewIdParameterName()
           
 boolean isAbsolute()
          Determines whether or not the URL is absolute, meaning it contains a scheme component.
 boolean isEscaped()
          Determines whether or not the URL is escaped.
 boolean isExternal()
          Determines whether or not the URL is external.
 boolean isFacesViewTarget()
          Determines whether or not the URL targets a Faces View.
 boolean isHierarchical()
          Determines whether or not the URL is hierarchical, meaning it is either 1) absolute and the scheme-specific part begins with a forward-slash character, or 2) is relative.
 boolean isOpaque()
          Determines whether or not the URL is opaque, meaning it is absolute and its scheme component does not begin with a forward-slash character.
 boolean isPathRelative()
          Determines whether or not the path component of the URL is relative, meaning it does not begin with a forward-slash character.
 boolean isPortletScheme()
          Determines whether or not the URL begins with the "portlet:" scheme.
protected  boolean isRelative()
          Determines whether or not the URL is relative, meaning it does not have a scheme component.
 boolean isSecure()
          Flag indicating whether or not the URL is secure.
 boolean isSelfReferencing()
          Determines whether or not the URL is self-referencing, meaning, it targets the current Faces view.
protected  boolean matchPathAndExtension(String file1, String file2)
          Determines whether or not the specified files have the same path (prefix) and extension (suffix).
 String removeParameter(String name)
          Removes the value of the underlying BridgeURL.getParameterMap() with the specified name.
 void setParameter(String name, String value)
          Sets the value of the underlying BridgeURL.getParameterMap() according to the specified name.
 void setParameter(String name, String[] value)
          Sets the value of the underlying BridgeURL.getParameterMap() according to the specified name.
protected  void setPortletModeParameter(String portletMode, javax.portlet.PortletURL portletURL)
           
protected  void setRenderParameters(javax.portlet.BaseURL baseURL)
           
 void setSecure(boolean secure)
          Sets the flag indicating whether or not the URL is secure.
protected  void setSecureParameter(String secure, javax.portlet.BaseURL baseURL)
           
 void setSelfReferencing(boolean selfReferencing)
          Sets the flag indicating whether or not the URL is self-referencing, meaning, whether or not it targets the current Faces view.
protected  void setWindowStateParameter(String windowState, javax.portlet.PortletURL portletURL)
           
protected abstract  javax.portlet.BaseURL toBaseURL()
          Returns a BaseURL representation of the bridge URL.
 String toString()
          Returns a string-based representation of the URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PORTLET_ACTION

protected static final String PORTLET_ACTION
See Also:
Constant Field Values

PORTLET_RENDER

protected static final String PORTLET_RENDER
See Also:
Constant Field Values

PORTLET_RESOURCE

protected static final String PORTLET_RESOURCE
See Also:
Constant Field Values

RELATIVE_PATH_PREFIX

protected static final String RELATIVE_PATH_PREFIX
See Also:
Constant Field Values

bridgeConfig

protected BridgeConfig bridgeConfig

url

protected String url

bridgeContext

protected BridgeContext bridgeContext
Constructor Detail

BridgeURLBaseImpl

public BridgeURLBaseImpl(String url,
                         String currentFacesViewId,
                         BridgeContext bridgeContext)
Method Detail

removeParameter

public String removeParameter(String name)
Description copied from interface: BridgeURL
Removes the value of the underlying BridgeURL.getParameterMap() with the specified name.

Specified by:
removeParameter in interface BridgeURL

toString

public String toString()
Description copied from interface: BridgeURL
Returns a string-based representation of the URL. If BridgeURL.isEscaped() returns true then the value returned by this method will contain escaped characters.

Specified by:
toString in interface BridgeURL
Overrides:
toString in class Object

toBaseURL

protected abstract javax.portlet.BaseURL toBaseURL()
                                            throws MalformedURLException
Returns a BaseURL representation of the bridge URL.

Throws:
MalformedURLException

_toString

protected String _toString(boolean modeChanged)

_toString

protected String _toString(boolean modeChanged,
                           Set<String> excludedParameterNames)

matchPathAndExtension

protected boolean matchPathAndExtension(String file1,
                                        String file2)
Determines whether or not the specified files have the same path (prefix) and extension (suffix).

Parameters:
filePath1 - The first file to compare.
filePath2 - The second file to compare.
Returns:
true if the specified files have the same path (prefix) and extension (suffix), otherwise false.

getContextRelativePath

public String getContextRelativePath()
Description copied from interface: BridgeURL
Returns the context-relative path in the URL. If no path is found, then the current Faces viewId (found in the current UIViewRoot) is returned.

Specified by:
getContextRelativePath in interface BridgeURL

isEscaped

public boolean isEscaped()
Description copied from interface: BridgeURL
Determines whether or not the URL is escaped.

Specified by:
isEscaped in interface BridgeURL
Returns:
true if all occurrences of the ampersand character appear as & otherwise, returns false.

isAbsolute

public boolean isAbsolute()
Determines whether or not the URL is absolute, meaning it contains a scheme component. Note that according to the class-level documentation of URI an absolute URL is non-relative.

Specified by:
isAbsolute in interface BridgeURL
Returns:
Returns true if the URL is absolute, otherwise returns false.

isOpaque

public boolean isOpaque()
Description copied from interface: BridgeURL
Determines whether or not the URL is opaque, meaning it is absolute and its scheme component does not begin with a forward-slash character. For more information see URI.isOpaque().

Specified by:
isOpaque in interface BridgeURL
Returns:
true if the URL is opaque, otherwise false.

isPathRelative

public boolean isPathRelative()
Description copied from interface: BridgeURL
Determines whether or not the path component of the URL is relative, meaning it does not begin with a forward-slash character.

Specified by:
isPathRelative in interface BridgeURL
Returns:
true if the path is relative, otherwise false.

isPortletScheme

public boolean isPortletScheme()
Description copied from interface: BridgeURL
Determines whether or not the URL begins with the "portlet:" scheme.

Specified by:
isPortletScheme in interface BridgeURL
Returns:
true if the URL begins with the "portlet:" scheme, otherwise false.

isSecure

public boolean isSecure()
Description copied from interface: BridgeURL
Flag indicating whether or not the URL is secure. For more information, see BaseURL.setSecure(boolean).

Specified by:
isSecure in interface BridgeURL
Returns:
true if the URL is secure, otherwise false.

isRelative

protected boolean isRelative()
Determines whether or not the URL is relative, meaning it does not have a scheme component. Note that according to the class-level documentation of URI a relative URL is non-absolute.

Returns:
Returns true if the URL is relative, otherwise returns false.

isSelfReferencing

public boolean isSelfReferencing()
Description copied from interface: BridgeURL
Determines whether or not the URL is self-referencing, meaning, it targets the current Faces view.

Specified by:
isSelfReferencing in interface BridgeURL
Returns:
true if self-referencing, otherwise false.

isExternal

public boolean isExternal()
Description copied from interface: BridgeURL
Determines whether or not the URL is external.

Specified by:
isExternal in interface BridgeURL
Returns:
true if external, otherwise false.

isHierarchical

public boolean isHierarchical()
Description copied from interface: BridgeURL
Determines whether or not the URL is hierarchical, meaning it is either 1) absolute and the scheme-specific part begins with a forward-slash character, or 2) is relative.

Specified by:
isHierarchical in interface BridgeURL
Returns:
true if the URL is hierarchical, otherwise false.

getParameter

public String getParameter(String name)
Description copied from interface: BridgeURL
Returns the value of the underlying BridgeURL.getParameterMap() with the specified name.

Specified by:
getParameter in interface BridgeURL

setParameter

public void setParameter(String name,
                         String[] value)
Description copied from interface: BridgeURL
Sets the value of the underlying BridgeURL.getParameterMap() according to the specified name.

Specified by:
setParameter in interface BridgeURL

setParameter

public void setParameter(String name,
                         String value)
Description copied from interface: BridgeURL
Sets the value of the underlying BridgeURL.getParameterMap() according to the specified name.

Specified by:
setParameter in interface BridgeURL

getParameterMap

public Map<String,String[]> getParameterMap()
Description copied from interface: BridgeURL
Returns a mutable Map representing the URL parameters.

Specified by:
getParameterMap in interface BridgeURL

getParameterNames

public Set<String> getParameterNames()
Description copied from interface: BridgeURL
Returns a list of key names from the underlying BridgeURL.getParameterMap().

Specified by:
getParameterNames in interface BridgeURL

setPortletModeParameter

protected void setPortletModeParameter(String portletMode,
                                       javax.portlet.PortletURL portletURL)

getPortletPhase

public Bridge.PortletPhase getPortletPhase()
Description copied from interface: BridgeURL
Returns the Bridge.PortletPhase associated with this URL. Note that the value will be null if the URL does not begin with the "portlet:" scheme/prefix.

Specified by:
getPortletPhase in interface BridgeURL

setRenderParameters

protected void setRenderParameters(javax.portlet.BaseURL baseURL)

getSchemeSpecificPart

protected String getSchemeSpecificPart()
Returns the scheme-specific part of the URI. For example, the URI "http://www.liferay.com/foo/bar.png" would return "//www.liferay.com/foo/bar.png".


setSecure

public void setSecure(boolean secure)
Description copied from interface: BridgeURL
Sets the flag indicating whether or not the URL is secure.

Specified by:
setSecure in interface BridgeURL
Parameters:
secure - true if secure, otherwise false.

setSecureParameter

protected void setSecureParameter(String secure,
                                  javax.portlet.BaseURL baseURL)

setSelfReferencing

public void setSelfReferencing(boolean selfReferencing)
Description copied from interface: BridgeURL
Sets the flag indicating whether or not the URL is self-referencing, meaning, whether or not it targets the current Faces view.

Specified by:
setSelfReferencing in interface BridgeURL
Parameters:
selfReferencing - true if self-referencing, otherwise false.

isFacesViewTarget

public boolean isFacesViewTarget()
Description copied from interface: BridgeURL
Determines whether or not the URL targets a Faces View.

Specified by:
isFacesViewTarget in interface BridgeURL
Returns:
true if the URL targets a Faces View, otherwise false

getURI

protected URI getURI()

getViewIdParameterName

protected String getViewIdParameterName()

setWindowStateParameter

protected void setWindowStateParameter(String windowState,
                                       javax.portlet.PortletURL portletURL)


Copyright © 2014 Liferay, Inc.. All Rights Reserved.