com.liferay.faces.bridge.container.liferay
Class PortletContainerLiferayImpl

java.lang.Object
  extended by com.liferay.faces.bridge.container.PortletContainerCompatImpl
      extended by com.liferay.faces.bridge.container.PortletContainerImpl
          extended by com.liferay.faces.bridge.container.liferay.PortletContainerLiferayCompatImpl
              extended by com.liferay.faces.bridge.container.liferay.PortletContainerLiferayImpl
All Implemented Interfaces:
PortletContainer, Serializable, EventListener, javax.faces.event.PhaseListener

public class PortletContainerLiferayImpl
extends PortletContainerLiferayCompatImpl

Author:
Neil Griffin
See Also:
Serialized Form

Constructor Summary
PortletContainerLiferayImpl(javax.portlet.PortletRequest portletRequest, javax.portlet.PortletResponse portletResponse, javax.portlet.PortletContext portletContext, BridgeConfig bridgeConfig)
           
 
Method Summary
protected  javax.portlet.PortletURL createActionURL(javax.portlet.MimeResponse mimeResponse)
           
 javax.portlet.PortletURL createRedirectURL(String fromURL, Map<String,List<String>> parameters)
          Note that this default method implementation doesn't help when a is present in the navigation-rule.
protected  javax.portlet.PortletURL createRenderURL(javax.portlet.MimeResponse mimeResponse)
           
protected  javax.portlet.ResourceURL createResourceURL(javax.portlet.MimeResponse mimeResponse)
           
 String fixRequestParameterValue(String value)
          There is a bug in some versions of Liferay's PortalImpl.getStaticResourceURL(...) method in which it appends request parameters with a question-mark instead of an ampersand.
protected  String getEncodedRequestParameterValue(javax.portlet.PortletRequest portletRequest, String parameterName)
           
 String[] getHeader(String name)
          Returns the value of the header with the specified name from the underlying HttpServletRequest.
 long getHttpServletRequestDateHeader(String name)
          Returns the value of the specified header name from the HttpServletRequest that is wrapped by the current PortletRequest.
 String getRequestURL()
          Returns the URL requested by the user-agent (browser).
 String getResponseNamespace()
          Returns the response namespace.
 boolean isAbleToAddScriptResourceToHead()
          Determines whether or not the portlet container has the ability (standard or vendor-specific) to add <script src=".." /> resource to the <head>...</head> section of the rendered portal page.
 boolean isAbleToAddScriptTextToHead()
          Determines whether or not the portlet container has the ability (standard or vendor-specific) to add <script> text to the <head>...</head> section of the rendered portal page.
 boolean isAbleToAddStyleSheetResourceToHead()
          Determines whether or not the portlet container has the ability (standard or vendor-specific) to add stylesheet <link> tags to the <head>...</head> section of the rendered portal page.
 boolean isAbleToForwardOnDispatch()
          Determines whether or not the portlet container has the ability to issue a forward when a dispatch occurs.
 boolean isAbleToSetHttpStatusCode()
          Determines whether or not the portlet container has the ability to support the Portlet 2.0 standard mechanism of setting the ResourceResponse.HTTP_STATUS_CODE property on the ResourceResponse.
protected  boolean isMarkupHeadElementSupported()
          Determines whether or not the portlet container supports the standard Portlet 2.0 mechanism for adding resources to the ... section of the rendered portal page.
 boolean isNamespacedParameters()
          Determines whether or not the portlet container requires parameters to be namespaced.
 boolean isPostRedirectGetSupported()
          Liferay Portal does not implement the POST-REDIRECT-GET design pattern.
 void redirect(String url)
          Delegates to the underlying ActionResponse to perform a redirect to the specified URL.
protected  void saveRenderAttributes(javax.portlet.PortletMode portletMode, javax.portlet.WindowState windowState, com.liferay.portal.theme.ThemeDisplay themeDisplay, String responseNamespace, javax.portlet.PortletContext portletContext)
          Liferay Hack: Need to save some stuff that's only available at RenderRequest time in order to have getResourceURL() work properly later.
 
Methods inherited from class com.liferay.faces.bridge.container.liferay.PortletContainerLiferayCompatImpl
afterPhase, beforePhase, getHeadResponseWriter, getPageTop, getPhaseId, isPortletRequiresNamespacedParameters, setPageTop
 
Methods inherited from class com.liferay.faces.bridge.container.PortletContainerImpl
copyRequestParameters, createActionURL, createPartialActionURL, createRenderURL, createResourceURL, getContextParamAbleToSetHttpStatusCode, getRequestParameter, getRequestParameterValues, getRequestQueryString, isAbleToSetResourceResponseBufferSize, maintainRenderParameters, parseRequestParameters, setMimeResponseContentType
 
Methods inherited from class com.liferay.faces.bridge.container.PortletContainerCompatImpl
isJSF2PartialRequest, redirectJSF2PartialResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortletContainerLiferayImpl

public PortletContainerLiferayImpl(javax.portlet.PortletRequest portletRequest,
                                   javax.portlet.PortletResponse portletResponse,
                                   javax.portlet.PortletContext portletContext,
                                   BridgeConfig bridgeConfig)
Method Detail

createRedirectURL

public javax.portlet.PortletURL createRedirectURL(String fromURL,
                                                  Map<String,List<String>> parameters)
                                           throws MalformedURLException
Description copied from class: PortletContainerImpl
Note that this default method implementation doesn't help when a is present in the navigation-rule. That's because the JSF implementation will end up calling this method during the Portlet 2.0 ACTION_PHASE, and it's impossible for us to get a redirect URL (really, a render URL) from an ActionResponse. This method will need to be overridden for each portlet container and handled in a container-dependent way.

Specified by:
createRedirectURL in interface PortletContainer
Overrides:
createRedirectURL in class PortletContainerImpl
Parameters:
fromURL - The URL to copy from.
Returns:
The resulting portlet action URL.
Throws:
MalformedURLException

fixRequestParameterValue

public String fixRequestParameterValue(String value)
There is a bug in some versions of Liferay's PortalImpl.getStaticResourceURL(...) method in which it appends request parameters with a question-mark instead of an ampersand. This method is a hack-fix for that bug.

Specified by:
fixRequestParameterValue in interface PortletContainer
Overrides:
fixRequestParameterValue in class PortletContainerImpl
Parameters:
value - The request parameter value that may need to be fixed.
Returns:
The fixed request parameter value.

redirect

public void redirect(String url)
              throws IOException
Description copied from interface: PortletContainer
Delegates to the underlying ActionResponse to perform a redirect to the specified URL.

Specified by:
redirect in interface PortletContainer
Overrides:
redirect in class PortletContainerImpl
Throws:
IOException

createActionURL

protected javax.portlet.PortletURL createActionURL(javax.portlet.MimeResponse mimeResponse)
Overrides:
createActionURL in class PortletContainerImpl

createRenderURL

protected javax.portlet.PortletURL createRenderURL(javax.portlet.MimeResponse mimeResponse)
Overrides:
createRenderURL in class PortletContainerImpl

createResourceURL

protected javax.portlet.ResourceURL createResourceURL(javax.portlet.MimeResponse mimeResponse)
Overrides:
createResourceURL in class PortletContainerImpl

saveRenderAttributes

protected void saveRenderAttributes(javax.portlet.PortletMode portletMode,
                                    javax.portlet.WindowState windowState,
                                    com.liferay.portal.theme.ThemeDisplay themeDisplay,
                                    String responseNamespace,
                                    javax.portlet.PortletContext portletContext)
Liferay Hack: Need to save some stuff that's only available at RenderRequest time in order to have getResourceURL() work properly later.

Parameters:
renderRequest - The current RenderRequest.
responseNamespace - The current response namespace.
applicationMap - The current ApplicationMap.

isAbleToAddScriptResourceToHead

public boolean isAbleToAddScriptResourceToHead()
Description copied from interface: PortletContainer
Determines whether or not the portlet container has the ability (standard or vendor-specific) to add <script src=".." /> resource to the <head>...</head> section of the rendered portal page.

Specified by:
isAbleToAddScriptResourceToHead in interface PortletContainer
Overrides:
isAbleToAddScriptResourceToHead in class PortletContainerImpl
Returns:
True if the portlet container supports it.

isAbleToAddScriptTextToHead

public boolean isAbleToAddScriptTextToHead()
Description copied from interface: PortletContainer
Determines whether or not the portlet container has the ability (standard or vendor-specific) to add <script> text to the <head>...</head> section of the rendered portal page.

Specified by:
isAbleToAddScriptTextToHead in interface PortletContainer
Overrides:
isAbleToAddScriptTextToHead in class PortletContainerImpl
Returns:
True if the portlet container supports it.

isAbleToAddStyleSheetResourceToHead

public boolean isAbleToAddStyleSheetResourceToHead()
Description copied from interface: PortletContainer
Determines whether or not the portlet container has the ability (standard or vendor-specific) to add stylesheet <link> tags to the <head>...</head> section of the rendered portal page.

Specified by:
isAbleToAddStyleSheetResourceToHead in interface PortletContainer
Overrides:
isAbleToAddStyleSheetResourceToHead in class PortletContainerImpl
Returns:
True if the portlet container supports it.

isPostRedirectGetSupported

public boolean isPostRedirectGetSupported()
Liferay Portal does not implement the POST-REDIRECT-GET design pattern. Rather, the ACTION_PHASE and RENDER_PHASE are both part of a single HTTP POST request.

Specified by:
isPostRedirectGetSupported in interface PortletContainer
Overrides:
isPostRedirectGetSupported in class PortletContainerImpl
Returns:
false since Liferay Portal does not implement the POST-REDIRECT-GET design pattern.

isMarkupHeadElementSupported

protected boolean isMarkupHeadElementSupported()
Determines whether or not the portlet container supports the standard Portlet 2.0 mechanism for adding resources to the ... section of the rendered portal page. Section PLT.12.5.4 of the Portlet 2.0 spec indicates that this is an "optional" feature for vendors to implement. Liferay Portal added support for this feature in v6.0.3 but a bug prevented it from working, even in v6.0.5. So as of now this method returns false for Liferay.

Overrides:
isMarkupHeadElementSupported in class PortletContainerImpl
Returns:
false since Liferay doesn't support it reliably.
See Also:
LPE-2729, LPS-11767

isAbleToSetHttpStatusCode

public boolean isAbleToSetHttpStatusCode()
Description copied from interface: PortletContainer
Determines whether or not the portlet container has the ability to support the Portlet 2.0 standard mechanism of setting the ResourceResponse.HTTP_STATUS_CODE property on the ResourceResponse.

Specified by:
isAbleToSetHttpStatusCode in interface PortletContainer
Overrides:
isAbleToSetHttpStatusCode in class PortletContainerImpl

getEncodedRequestParameterValue

protected String getEncodedRequestParameterValue(javax.portlet.PortletRequest portletRequest,
                                                 String parameterName)

isAbleToForwardOnDispatch

public boolean isAbleToForwardOnDispatch()
Description copied from interface: PortletContainer
Determines whether or not the portlet container has the ability to issue a forward when a dispatch occurs. If unable to forward, then an include must happen during the dispatch instead.

Specified by:
isAbleToForwardOnDispatch in interface PortletContainer
Overrides:
isAbleToForwardOnDispatch in class PortletContainerImpl
Returns:
true if able, otherwise false.

getHeader

public String[] getHeader(String name)
Description copied from interface: PortletContainer
Returns the value of the header with the specified name from the underlying HttpServletRequest.

Specified by:
getHeader in interface PortletContainer
Overrides:
getHeader in class PortletContainerImpl

getHttpServletRequestDateHeader

public long getHttpServletRequestDateHeader(String name)
Description copied from interface: PortletContainer
Returns the value of the specified header name from the HttpServletRequest that is wrapped by the current PortletRequest.

Specified by:
getHttpServletRequestDateHeader in interface PortletContainer
Overrides:
getHttpServletRequestDateHeader in class PortletContainerImpl

getRequestURL

public String getRequestURL()
Description copied from interface: PortletContainer
Returns the URL requested by the user-agent (browser).

Specified by:
getRequestURL in interface PortletContainer
Overrides:
getRequestURL in class PortletContainerImpl

getResponseNamespace

public String getResponseNamespace()
Description copied from interface: PortletContainer
Returns the response namespace.

Specified by:
getResponseNamespace in interface PortletContainer
Overrides:
getResponseNamespace in class PortletContainerImpl

isNamespacedParameters

public boolean isNamespacedParameters()
Description copied from interface: PortletContainer
Determines whether or not the portlet container requires parameters to be namespaced.

Specified by:
isNamespacedParameters in interface PortletContainer
Overrides:
isNamespacedParameters in class PortletContainerImpl
Returns:
True if the portlet container requires parameters to be namespaced. Otherwise, returns false.


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