org.apache.myfaces.portlet
Class MyFacesGenericPortlet

java.lang.Object
  extended by javax.portlet.GenericPortlet
      extended by org.apache.myfaces.portlet.MyFacesGenericPortlet
All Implemented Interfaces:
javax.portlet.Portlet, javax.portlet.PortletConfig

public class MyFacesGenericPortlet
extends javax.portlet.GenericPortlet

This portlet initializes MyFaces and converts portlet requests into JSF requests.

Version:
$Revision: 656083 $ $Date: 2008-05-13 20:58:26 -0500 (Tue, 13 May 2008) $
Author:
Stan Silvert (latest modification by $Author: lu4242 $)

Field Summary
protected static String CURRENT_FACES_CONTEXT
           
protected static String DEFAULT_VIEW
           
protected static String DEFAULT_VIEW_SELECTOR
           
protected  String defaultView
           
protected  DefaultViewSelector defaultViewSelector
           
protected static String FACES_INIT_DONE
           
protected  FacesContextFactory facesContextFactory
           
protected  Lifecycle lifecycle
           
protected  javax.portlet.PortletContext portletContext
           
protected static String REDEPLOY_FLAG
           
protected static String SAVED_REQUEST_ATTRIBUTES
           
static String VIEW_ID
           
 
Constructor Summary
MyFacesGenericPortlet()
          Creates a new instance of MyFacesPortlet
 
Method Summary
 void destroy()
          Portlet lifecycle.
protected  void doEdit(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Helper method to serve up the edit mode.
protected  void doHelp(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Helper method to serve up the edit mode.
protected  void doView(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Helper method to serve up the view mode.
protected  FacesContext facesContext(javax.portlet.PortletRequest request, javax.portlet.PortletResponse response)
           
protected  void facesRender(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Render a JSF view.
protected  String getLifecycleId()
           
protected  void handleExceptionFromLifecycle(Throwable e)
           
 void init()
          Portlet lifecycle.
protected  void initMyFaces()
           
protected  void logException(Throwable e, String msgPrefix)
           
protected  ReleaseableExternalContext makeExternalContext(javax.portlet.PortletRequest request, javax.portlet.PortletResponse response)
           
protected  void nonFacesRequest(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          This method follows JSF Spec section 2.1.1.
protected  void nonFacesRequest(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response, String view)
          This method follows JSF Spec section 2.1.1.
 void processAction(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)
          Called by the portlet container to allow the portlet to process an action request.
protected  void renderCleanup(javax.portlet.RenderRequest request)
           
protected  void restoreRequestAttributes(javax.portlet.RenderRequest request)
           
protected  void saveRequestAttributes(javax.portlet.ActionRequest request)
           
protected  String selectDefaultView(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
           
protected  boolean sessionInvalidated(javax.portlet.PortletRequest request)
           
protected  boolean sessionTimedOut(javax.portlet.PortletRequest request)
           
protected  void setContentType(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
           
protected  void setDefaultView()
           
protected  void setDefaultViewSelector()
           
protected  void setPortletRequestFlag(javax.portlet.PortletRequest request)
           
 
Methods inherited from class javax.portlet.GenericPortlet
doDispatch, getInitParameter, getInitParameterNames, getPortletConfig, getPortletContext, getPortletName, getResourceBundle, getTitle, init, render
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIEW_ID

public static final String VIEW_ID

CURRENT_FACES_CONTEXT

protected static final String CURRENT_FACES_CONTEXT

DEFAULT_VIEW

protected static final String DEFAULT_VIEW
See Also:
Constant Field Values

DEFAULT_VIEW_SELECTOR

protected static final String DEFAULT_VIEW_SELECTOR
See Also:
Constant Field Values

REDEPLOY_FLAG

protected static final String REDEPLOY_FLAG

FACES_INIT_DONE

protected static final String FACES_INIT_DONE

SAVED_REQUEST_ATTRIBUTES

protected static final String SAVED_REQUEST_ATTRIBUTES

portletContext

protected javax.portlet.PortletContext portletContext

facesContextFactory

protected FacesContextFactory facesContextFactory

lifecycle

protected Lifecycle lifecycle

defaultView

protected String defaultView

defaultViewSelector

protected DefaultViewSelector defaultViewSelector
Constructor Detail

MyFacesGenericPortlet

public MyFacesGenericPortlet()
Creates a new instance of MyFacesPortlet

Method Detail

destroy

public void destroy()
Portlet lifecycle.

Specified by:
destroy in interface javax.portlet.Portlet
Overrides:
destroy in class javax.portlet.GenericPortlet

init

public void init()
          throws javax.portlet.PortletException,
                 javax.portlet.UnavailableException
Portlet lifecycle.

Overrides:
init in class javax.portlet.GenericPortlet
Throws:
javax.portlet.PortletException
javax.portlet.UnavailableException

setDefaultView

protected void setDefaultView()
                       throws javax.portlet.UnavailableException
Throws:
javax.portlet.UnavailableException

setDefaultViewSelector

protected void setDefaultViewSelector()
                               throws javax.portlet.UnavailableException
Throws:
javax.portlet.UnavailableException

setContentType

protected void setContentType(javax.portlet.RenderRequest request,
                              javax.portlet.RenderResponse response)

getLifecycleId

protected String getLifecycleId()

initMyFaces

protected void initMyFaces()

processAction

public void processAction(javax.portlet.ActionRequest request,
                          javax.portlet.ActionResponse response)
                   throws javax.portlet.PortletException,
                          IOException
Called by the portlet container to allow the portlet to process an action request.

Specified by:
processAction in interface javax.portlet.Portlet
Overrides:
processAction in class javax.portlet.GenericPortlet
Throws:
javax.portlet.PortletException
IOException

saveRequestAttributes

protected void saveRequestAttributes(javax.portlet.ActionRequest request)

restoreRequestAttributes

protected void restoreRequestAttributes(javax.portlet.RenderRequest request)

handleExceptionFromLifecycle

protected void handleExceptionFromLifecycle(Throwable e)
                                     throws javax.portlet.PortletException,
                                            IOException
Throws:
javax.portlet.PortletException
IOException

doView

protected void doView(javax.portlet.RenderRequest request,
                      javax.portlet.RenderResponse response)
               throws javax.portlet.PortletException,
                      IOException
Helper method to serve up the view mode.

Overrides:
doView in class javax.portlet.GenericPortlet
Throws:
javax.portlet.PortletException
IOException

doEdit

protected void doEdit(javax.portlet.RenderRequest request,
                      javax.portlet.RenderResponse response)
               throws javax.portlet.PortletException,
                      IOException
Helper method to serve up the edit mode. Can be overridden to add the edit mode concept to a JSF application.

Overrides:
doEdit in class javax.portlet.GenericPortlet
Throws:
javax.portlet.PortletException
IOException

doHelp

protected void doHelp(javax.portlet.RenderRequest request,
                      javax.portlet.RenderResponse response)
               throws javax.portlet.PortletException,
                      IOException
Helper method to serve up the edit mode. Can be overridden to add the help mode concept to a JSF application.

Overrides:
doHelp in class javax.portlet.GenericPortlet
Throws:
javax.portlet.PortletException
IOException

renderCleanup

protected void renderCleanup(javax.portlet.RenderRequest request)

nonFacesRequest

protected void nonFacesRequest(javax.portlet.RenderRequest request,
                               javax.portlet.RenderResponse response)
                        throws javax.portlet.PortletException
This method follows JSF Spec section 2.1.1. It renders the default view from a non-faces request.

Parameters:
request - The portlet render request.
response - The portlet render response.
Throws:
javax.portlet.PortletException

nonFacesRequest

protected void nonFacesRequest(javax.portlet.RenderRequest request,
                               javax.portlet.RenderResponse response,
                               String view)
                        throws javax.portlet.PortletException
This method follows JSF Spec section 2.1.1. It renders a view from a non-faces request. This is useful for a default view as well as for views that need to be rendered from the portlet's edit and help buttons.

Parameters:
request - The portlet render request.
response - The portlet render response.
view - The name of the view that needs to be rendered.
Throws:
javax.portlet.PortletException

selectDefaultView

protected String selectDefaultView(javax.portlet.RenderRequest request,
                                   javax.portlet.RenderResponse response)
                            throws javax.portlet.PortletException
Throws:
javax.portlet.PortletException

facesContext

protected FacesContext facesContext(javax.portlet.PortletRequest request,
                                    javax.portlet.PortletResponse response)

makeExternalContext

protected ReleaseableExternalContext makeExternalContext(javax.portlet.PortletRequest request,
                                                         javax.portlet.PortletResponse response)

sessionTimedOut

protected boolean sessionTimedOut(javax.portlet.PortletRequest request)

sessionInvalidated

protected boolean sessionInvalidated(javax.portlet.PortletRequest request)

setPortletRequestFlag

protected void setPortletRequestFlag(javax.portlet.PortletRequest request)

facesRender

protected void facesRender(javax.portlet.RenderRequest request,
                           javax.portlet.RenderResponse response)
                    throws javax.portlet.PortletException,
                           IOException
Render a JSF view.

Throws:
javax.portlet.PortletException
IOException

logException

protected void logException(Throwable e,
                            String msgPrefix)


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.