站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.6 API 英文版文档

JBossPortlet - JBOSS Portal 2.6 API 英文版文档


org.jboss.portlet
Class JBossPortlet

java.lang.Object
  extended byorg.jboss.portlet.JBossPortlet
All Implemented Interfaces:
Portlet
Direct Known Subclasses:
CatalogPortlet, CMSAdminPortlet, ExceptionPortlet, ForumsPortlet, LoginPortlet, RolePortlet, TestPortlet, ThemeManagerPortlet, ThemeSelectorPortlet, UserPortlet

public class JBossPortlet
extends java.lang.Object
implements Portlet

The JBossPortlet.

Version:
$Revision: 5448 $
Author:
Julien Viet

Field Summary
private static java.lang.Class[] ACTION_LOOKUP
           
private  PortletConfig config
          .
 
Constructor Summary
JBossPortlet()
           
 
Method Summary
 void destroy()
          Called by the portlet container to indicate to a portlet that the portlet is being taken out of service.
protected  void doDispatch(JBossRenderRequest request, JBossRenderResponse response)
           
protected  void doEdit(JBossRenderRequest request, JBossRenderResponse response)
          Provide a default generic editor for preferences that produce HTML markup.
protected  void doHelp(JBossRenderRequest request, JBossRenderResponse response)
          Throw a PortletException.
protected  void doView(JBossRenderRequest request, JBossRenderResponse response)
          Throw a PortletException.
 java.lang.String getDefaultOperation()
          Return the string main, it can be overriden to return another value by subclasses.
 java.lang.String getInitParameter(java.lang.String name)
           
 java.util.Enumeration getInitParameterNames()
           
 java.lang.String getOperationName()
          Return the string op, it can be overriden to return another value by subclasses.
 PortletConfig getPortletConfig()
           
 PortletContext getPortletContext()
           
 java.lang.String getPortletName()
           
 java.util.ResourceBundle getResourceBundle(java.util.Locale locale)
           
protected  java.lang.String getTitle(RenderRequest request)
           
 void init()
           
 void init(PortletConfig config)
          Called by the portlet container to indicate to a portlet that the portlet is being placed into service.
private  java.lang.reflect.Method lookupMethod(java.lang.String operation, java.lang.Class[] parameterTypes)
          Locate a method.
 void processAction(ActionRequest request, ActionResponse response)
          Called by the portlet container to allow the portlet to process an action request.
protected  void processAction(JBossActionRequest req, JBossActionResponse resp)
          Calls doDispatch(JBossActionRequest,JBossActionResponse).
protected  void processDispatch(JBossActionRequest req, JBossActionResponse resp)
          This method looks up the method corresponding to the action.
 void processEdit(JBossActionRequest req, JBossActionResponse resp)
          Default doEdit method that works in coordination with doEdit(JBossRenderRequest,JBossRenderResponse).
 void processHelp(JBossActionRequest req, JBossActionResponse resp)
           
 void processView(JBossActionRequest req, JBossActionResponse resp)
           
protected  void render(JBossRenderRequest req, JBossRenderResponse resp)
          Calls doDispatch(JBossRenderRequest,JBossRenderResponse).
 void render(RenderRequest req, RenderResponse resp)
          Called by the portlet container to allow the portlet to generate the content of the response based on its current state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_LOOKUP

private static final java.lang.Class[] ACTION_LOOKUP

config

private PortletConfig config
.

Constructor Detail

JBossPortlet

public JBossPortlet()
Method Detail

getDefaultOperation

public java.lang.String getDefaultOperation()
Return the string main, it can be overriden to return another value by subclasses.


getOperationName

public java.lang.String getOperationName()
Return the string op, it can be overriden to return another value by subclasses.


init

public void init()
          throws PortletException
Throws:
PortletException

getPortletConfig

public PortletConfig getPortletConfig()

getPortletName

public java.lang.String getPortletName()

getPortletContext

public PortletContext getPortletContext()

processAction

protected void processAction(JBossActionRequest req,
                             JBossActionResponse resp)
                      throws PortletException,
                             PortletSecurityException,
                             java.io.IOException
Calls doDispatch(JBossActionRequest,JBossActionResponse).

Throws:
PortletException
PortletSecurityException
java.io.IOException

processDispatch

protected void processDispatch(JBossActionRequest req,
                               JBossActionResponse resp)
                        throws PortletException,
                               PortletSecurityException,
                               java.io.IOException

This method looks up the method corresponding to the action. It uses the action parameter using the parameter name defines by the operationName field of this class. If not method is found it uses the method defined by the return of the method getDefaultOperation() of this class. In order to be found a method must use JBossActionRequest and in the signature.

If not valid dispatcher is found it throws a PortletException, otherwise it invokes the method by reflection. The invoked method may declare exceptions in the throws clause of the method. Whenever an exception is raised during the invocation of the method, a decision is taken depending on the nature of the exception :

  • If the exception is an instanceof PortletException, IOException then this exception is rethrown as is since this method declares them in its throws clause
  • If the exception is an instance of RuntimeException or Error>/code>, it is rethrown as is
  • Otherwise a PortletException is created with the caught exception as cause and thrown

Throws:
PortletException
PortletSecurityException
java.io.IOException

processEdit

public void processEdit(JBossActionRequest req,
                        JBossActionResponse resp)
                 throws PortletException,
                        PortletSecurityException,
                        java.io.IOException
Default doEdit method that works in coordination with doEdit(JBossRenderRequest,JBossRenderResponse).

Throws:
PortletException
PortletSecurityException
java.io.IOException

processHelp

public void processHelp(JBossActionRequest req,
                        JBossActionResponse resp)
                 throws PortletException,
                        PortletSecurityException,
                        java.io.IOException
Throws:
PortletException
PortletSecurityException
java.io.IOException

processView

public void processView(JBossActionRequest req,
                        JBossActionResponse resp)
                 throws PortletException,
                        PortletSecurityException,
                        java.io.IOException
Throws:
PortletException
PortletSecurityException
java.io.IOException

render

protected void render(JBossRenderRequest req,
                      JBossRenderResponse resp)
               throws PortletException,
                      PortletSecurityException,
                      java.io.IOException
Calls doDispatch(JBossRenderRequest,JBossRenderResponse).

Throws:
PortletException
PortletSecurityException
java.io.IOException

doDispatch

protected void doDispatch(JBossRenderRequest request,
                          JBossRenderResponse response)
                   throws PortletException,
                          PortletSecurityException,
                          java.io.IOException
Throws:
PortletException
PortletSecurityException
java.io.IOException

doView

protected void doView(JBossRenderRequest request,
                      JBossRenderResponse response)
               throws PortletException,
                      PortletSecurityException,
                      java.io.IOException
Throw a PortletException.

Throws:
PortletException
PortletSecurityException
java.io.IOException

doHelp

protected void doHelp(JBossRenderRequest request,
                      JBossRenderResponse response)
               throws PortletException,
                      PortletSecurityException,
                      java.io.IOException
Throw a PortletException.

Throws:
PortletException
PortletSecurityException
java.io.IOException

doEdit

protected void doEdit(JBossRenderRequest request,
                      JBossRenderResponse response)
               throws PortletException,
                      PortletSecurityException,
                      java.io.IOException
Provide a default generic editor for preferences that produce HTML markup.

Throws:
PortletException
PortletSecurityException
java.io.IOException

getResourceBundle

public java.util.ResourceBundle getResourceBundle(java.util.Locale locale)

getTitle

protected java.lang.String getTitle(RenderRequest request)

getInitParameter

public java.lang.String getInitParameter(java.lang.String name)
                                  throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getInitParameterNames

public java.util.Enumeration getInitParameterNames()

init

public void init(PortletConfig config)
          throws PortletException
Description copied from interface: Portlet
Called by the portlet container to indicate to a portlet that the portlet is being placed into service.

The portlet container calls the init method exactly once after instantiating the portlet. The init method must complete successfully before the portlet can receive any requests.

The portlet container cannot place the portlet into service if the init method

  1. Throws a PortletException
  2. Does not return within a time period defined by the portlet container.

Specified by:
init in interface Portlet
Parameters:
config - a PortletConfig object containing the portlet's configuration and initialization parameters
Throws:
PortletException - if an exception has occurred that interferes with the portlet's normal operation.

processAction

public void processAction(ActionRequest request,
                          ActionResponse response)
                   throws PortletException,
                          PortletSecurityException,
                          java.io.IOException
Description copied from interface: Portlet
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.

Typically, in response to an action request, a portlet updates state based on the information sent in the action request parameters. In an action the portlet may:

  • issue a redirect
  • change its window state
  • change its portlet mode
  • modify its persistent state
  • set render parameters

A client request triggered by an action URL translates into one action request and many render requests, one per portlet in the portal page. The action processing must be finished before the render requests can be issued.

Specified by:
processAction in interface Portlet
Parameters:
request - the action request
response - the action response
Throws:
PortletException - if the portlet has problems fulfilling the request
java.io.IOException - if the streaming causes an I/O problem
PortletSecurityException - if the portlet cannot fullfill this request because of security reasons

render

public void render(RenderRequest req,
                   RenderResponse resp)
            throws PortletException,
                   PortletSecurityException,
                   java.io.IOException
Description copied from interface: Portlet
Called by the portlet container to allow the portlet to generate the content of the response based on its current state.

Specified by:
render in interface Portlet
Parameters:
req - the render request
resp - the render response
Throws:
PortletSecurityException - if the portlet cannot fullfill this request because of security reasons
PortletException - if the portlet has problems fulfilling the rendering request
java.io.IOException - if the streaming causes an I/O problem

destroy

public void destroy()
Description copied from interface: Portlet
Called by the portlet container to indicate to a portlet that the portlet is being taken out of service.

Before the portlet container calls the destroy method, it should allow any threads that are currently processing requests within the portlet object to complete execution. To avoid waiting forever, the portlet container can optionally wait for a predefined time before destroying the portlet object.

This method enables the portlet to do the following:

  • clean up any resources that it holds (for example, memory, file handles, threads)
  • make sure that any persistent state is synchronized with the portlet current state in memory.

Specified by:
destroy in interface Portlet

lookupMethod

private java.lang.reflect.Method lookupMethod(java.lang.String operation,
                                              java.lang.Class[] parameterTypes)
Locate a method.