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: 279594 $ $Date: 2005-09-08 19:52:24 +0200 (Thu, 08 Sep 2005) $
Author:
Stan Silvert (latest modification by $Author: ssilvert $)

Field Summary
protected static java.lang.String CURRENT_FACES_CONTEXT
           
protected static java.lang.String DEFAULT_VIEW
           
protected static java.lang.String DEFAULT_VIEW_SELECTOR
           
protected  java.lang.String defaultView
           
protected  DefaultViewSelector defaultViewSelector
           
protected static java.lang.String FACES_INIT_DONE
           
protected  javax.faces.context.FacesContextFactory facesContextFactory
           
protected  javax.faces.lifecycle.Lifecycle lifecycle
           
protected  javax.portlet.PortletContext portletContext
           
static java.lang.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  javax.faces.context.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  java.lang.String getLifecycleId()
           
protected  void handleExceptionFromLifecycle(java.lang.Throwable e)
           
 void init()
          Portlet lifecycle.
protected  void initMyFaces()
           
protected  void logException(java.lang.Throwable e, java.lang.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, java.lang.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  java.lang.String selectDefaultView(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
           
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 java.lang.String VIEW_ID

CURRENT_FACES_CONTEXT

protected static final java.lang.String CURRENT_FACES_CONTEXT

DEFAULT_VIEW

protected static final java.lang.String DEFAULT_VIEW
See Also:
Constant Field Values

DEFAULT_VIEW_SELECTOR

protected static final java.lang.String DEFAULT_VIEW_SELECTOR
See Also:
Constant Field Values

FACES_INIT_DONE

protected static final java.lang.String FACES_INIT_DONE

portletContext

protected javax.portlet.PortletContext portletContext

facesContextFactory

protected javax.faces.context.FacesContextFactory facesContextFactory

lifecycle

protected javax.faces.lifecycle.Lifecycle lifecycle

defaultView

protected java.lang.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 java.lang.String getLifecycleId()

initMyFaces

protected void initMyFaces()

processAction

public void processAction(javax.portlet.ActionRequest request,
                          javax.portlet.ActionResponse response)
                   throws javax.portlet.PortletException,
                          java.io.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
java.io.IOException

handleExceptionFromLifecycle

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

doView

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

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

doEdit

protected void doEdit(javax.portlet.RenderRequest request,
                      javax.portlet.RenderResponse response)
               throws javax.portlet.PortletException,
                      java.io.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
java.io.IOException

doHelp

protected void doHelp(javax.portlet.RenderRequest request,
                      javax.portlet.RenderResponse response)
               throws javax.portlet.PortletException,
                      java.io.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
java.io.IOException

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,
                               java.lang.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 java.lang.String selectDefaultView(javax.portlet.RenderRequest request,
                                             javax.portlet.RenderResponse response)
                                      throws javax.portlet.PortletException
Throws:
javax.portlet.PortletException

facesContext

protected javax.faces.context.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)

setPortletRequestFlag

protected void setPortletRequestFlag(javax.portlet.PortletRequest request)

facesRender

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

Throws:
javax.portlet.PortletException
java.io.IOException

logException

protected void logException(java.lang.Throwable e,
                            java.lang.String msgPrefix)