org.jboss.portal.core.samples.basic
Class FSContentDrivenPortlet

java.lang.Object
  extended by javax.portlet.GenericPortlet
      extended by org.jboss.portal.core.samples.basic.FSContentDrivenPortlet
All Implemented Interfaces:
Portlet

public class FSContentDrivenPortlet
extends GenericPortlet

An example of content driven portlet that display the files located in the war file. The portlet does not implement any code to improve performance like caching in order to keep the code easier to understand. It should not be used in production for a large scale portal.

Content URI is defined as the canonical path of the file relative to the war file context root.

Version:
$Revision: 1.1 $
Author:
Julien Viet

Field Summary
static PortletMode EDIT_CONTENT_MODE
          The edit_content mode.
 
Constructor Summary
FSContentDrivenPortlet()
           
 
Method Summary
protected  void doDispatch(RenderRequest req, RenderResponse resp)
          Additional dispatch that will call the doEditContent(RenderRequest,RenderResponse) method.
protected  void doEditContent(RenderRequest req, RenderResponse resp)
          Implements the edit content functionnality.
protected  void doView(RenderRequest req, RenderResponse resp)
          Helper method to serve up the mandatory view mode.
protected  java.lang.String getContentURI(java.io.File file)
          Return the content uri of the file or null if it cannot be determined.
protected  java.io.File getFile(java.lang.String contentURI)
          Return a file from the specified path or null if the file cannot be determined.
 void processAction(ActionRequest req, ActionResponse resp)
          Called by the portlet container to allow the portlet to process an action request.
 
Methods inherited from class javax.portlet.GenericPortlet
destroy, doEdit, doHelp, getInitParameter, getInitParameterNames, getPortletConfig, getPortletContext, getPortletName, getResourceBundle, getTitle, init, init, render
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDIT_CONTENT_MODE

public static final PortletMode EDIT_CONTENT_MODE
The edit_content mode.

Constructor Detail

FSContentDrivenPortlet

public FSContentDrivenPortlet()
Method Detail

doDispatch

protected void doDispatch(RenderRequest req,
                          RenderResponse resp)
                   throws PortletException,
                          PortletSecurityException,
                          java.io.IOException
Additional dispatch that will call the doEditContent(RenderRequest,RenderResponse) method.

Overrides:
doDispatch in class GenericPortlet
Parameters:
req - the render request
resp - the render response
Throws:
PortletException - if the portlet cannot fulfilling the request
UnavailableException - if the portlet is unavailable to perform render at this time
PortletSecurityException - if the portlet cannot fullfill this request because of security reasons
java.io.IOException - if the streaming causes an I/O problem
See Also:
GenericPortlet.doView(RenderRequest,RenderResponse), GenericPortlet.doEdit(RenderRequest,RenderResponse), GenericPortlet.doHelp(RenderRequest,RenderResponse)

doEditContent

protected void doEditContent(RenderRequest req,
                             RenderResponse resp)
                      throws PortletException,
                             PortletSecurityException,
                             java.io.IOException
Implements the edit content functionnality.

Throws:
PortletException
PortletSecurityException
java.io.IOException

doView

protected void doView(RenderRequest req,
                      RenderResponse resp)
               throws PortletException,
                      PortletSecurityException,
                      java.io.IOException
Description copied from class: GenericPortlet
Helper method to serve up the mandatory view mode.

The default implementation throws an exception.

Overrides:
doView in class GenericPortlet
Parameters:
req - the portlet request
resp - the render response
Throws:
PortletException - if the portlet cannot fulfilling the request
UnavailableException - if the portlet is unavailable to perform render at this time
PortletSecurityException - if the portlet cannot fullfill this request because of security reasons
java.io.IOException - if the streaming causes an I/O problem

processAction

public void processAction(ActionRequest req,
                          ActionResponse resp)
                   throws PortletException,
                          PortletSecurityException,
                          java.io.IOException
Description copied from class: GenericPortlet
Called by the portlet container to allow the portlet to process an action request. This method is called if the client request was originated by a URL created (by the portlet) with the RenderResponse.createActionURL() method.

The default implementation throws an exception.

Specified by:
processAction in interface Portlet
Overrides:
processAction in class GenericPortlet
Parameters:
req - the action request
resp - the action response
Throws:
PortletException - if the portlet cannot fulfilling the request
UnavailableException - if the portlet is unavailable to process the action at this time
PortletSecurityException - if the portlet cannot fullfill this request because of security reasons
java.io.IOException - if the streaming causes an I/O problem

getFile

protected java.io.File getFile(java.lang.String contentURI)
                        throws java.io.IOException
Return a file from the specified path or null if the file cannot be determined.

Parameters:
contentURI - the file path
Returns:
the file or null
Throws:
java.io.IOException

getContentURI

protected java.lang.String getContentURI(java.io.File file)
                                  throws java.io.IOException
Return the content uri of the file or null if it cannot be determined.

Parameters:
file - the file to get the URI from
Returns:
the URI or null
Throws:
java.io.IOException