Java Doc for FrameworkPortlet.java in  » J2EE » spring-framework-2.0.6 » org » springframework » web » portlet » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.web.portlet 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.springframework.web.portlet.GenericPortletBean
   org.springframework.web.portlet.FrameworkPortlet

All known Subclasses:   org.springframework.web.portlet.DispatcherPortlet,
FrameworkPortlet
abstract public class FrameworkPortlet extends GenericPortletBean implements ApplicationListener(Code)
Base portlet for Spring's portlet framework. Provides integration with a Spring application context, in a JavaBean-based overall solution.

This class offers the following functionality:

  • Manages a Portlet org.springframework.context.ApplicationContext instance per portlet. The portlet's configuration is determined by beans in the portlet's namespace.
  • Publishes events on request processing, whether or not a request is successfully handled.

Subclasses must implement FrameworkPortlet.doActionService and FrameworkPortlet.doRenderService to handle action and render requests. Because this extends GenericPortletBean rather than Portlet directly, bean properties are mapped onto it. Subclasses can override FrameworkPortlet.initFrameworkPortlet() for custom initialization.

Regards a "contextClass" parameter at the portlet init-param level, falling back to the default context class ( org.springframework.web.portlet.context.XmlPortletApplicationContext ) if not found. Note that, with the default FrameworkPortlet, a context class needs to implement the org.springframework.web.portlet.context.ConfigurablePortletApplicationContext SPI.

Passes a "contextConfigLocation" portlet init-param to the context instance, parsing it into potentially multiple file paths which can be separated by any number of commas and spaces, like "test-portlet.xml, myPortlet.xml". If not explicitly specified, the context implementation is supposed to build a default location from the namespace of the portlet.

Note: In case of multiple config locations, later bean definitions will override ones defined in earlier loaded files, at least when using one of Spring's default ApplicationContext implementations. This can be leveraged to deliberately override certain bean definitions via an extra XML file.

The default namespace is "'portlet-name'-portlet", e.g. "test-portlet" for a portlet-name "test" (leading to a "/WEB-INF/test-portlet.xml" default location with XmlPortletApplicationContext). The namespace can also be set explicitly via the "namespace" portlet init-param.
author:
   William G. Thompson, Jr.
author:
   John A. Lewis
author:
   Juergen Hoeller
since:
   2.0
See Also:   FrameworkPortlet.doActionService
See Also:   FrameworkPortlet.doRenderService
See Also:   FrameworkPortlet.setContextClass
See Also:   FrameworkPortlet.setContextConfigLocation
See Also:   FrameworkPortlet.setNamespace



Field Summary
final public static  ClassDEFAULT_CONTEXT_CLASS
     Default context class for FrameworkPortlet.
final public static  StringDEFAULT_NAMESPACE_SUFFIX
     Suffix for Portlet ApplicationContext namespaces.
final public static  String[]DEFAULT_USERINFO_ATTRIBUTE_NAMES
     Default USER_INFO attribute names to search for the current username: "user.login.id", "user.name".
final public static  StringPORTLET_CONTEXT_PREFIX
     Prefix for the PortletContext attribute for the Portlet ApplicationContext.


Method Summary
protected  ApplicationContextcreatePortletApplicationContext(ApplicationContext parent)
     Instantiate the Portlet ApplicationContext for this portlet, either a default XmlPortletApplicationContext or a custom context class if set.

This implementation expects custom contexts to implement ConfigurablePortletApplicationContext.

public  voiddestroy()
     Close the ApplicationContext of this portlet.
abstract protected  voiddoActionService(ActionRequest request, ActionResponse response)
     Subclasses must implement this method to do the work of action request handling.
final protected  voiddoDispatch(RenderRequest request, RenderResponse response)
     Delegate render requests to processRequest/doRenderService.
abstract protected  voiddoRenderService(RenderRequest request, RenderResponse response)
     Subclasses must implement this method to do the work of render request handling.
public  ClassgetContextClass()
     Return the custom context class.
public  StringgetContextConfigLocation()
     Return the explicit context config location, if any.
public  StringgetNamespace()
     Return the namespace for this portlet, falling back to default scheme if no custom namespace was set.
final public  ApplicationContextgetPortletApplicationContext()
     Return this portlet's ApplicationContext.
public  StringgetPortletContextAttributeName()
     Return the PortletContext attribute name for this portlets's ApplicationContext.
public  String[]getUserinfoUsernameAttributes()
    
protected  StringgetUsernameForRequest(PortletRequest request)
     Determine the username for the given request.
protected  voidinitFrameworkPortlet()
     This method will be invoked after any bean properties have been set and the ApplicationContext has been loaded.
protected  ApplicationContextinitPortletApplicationContext()
     Initialize and publish the Portlet ApplicationContext for this portlet.
final protected  voidinitPortletBean()
     Overridden method of GenericPortletBean, invoked after any bean properties have been set.
public  booleanisPublishContext()
     Return whether to publish this portlet's context as a PortletContext attribute.
public  booleanisPublishEvents()
     Return whether this portlet should publish a PortletRequestHandledEvent at the end of each request.
public  voidonApplicationEvent(ApplicationEvent event)
     ApplicationListener endpoint that receives events from this servlet's WebApplicationContext.
protected  voidonRefresh(ApplicationContext context)
     Template method which can be overridden to add portlet-specific refresh work.
protected  voidpostProcessPortletApplicationContext(ConfigurableApplicationContext pac)
     Post-process the given Portlet ApplicationContext before it is refreshed and activated as context for this portlet.

The default implementation is empty.

final public  voidprocessAction(ActionRequest request, ActionResponse response)
     Delegate action requests to processRequest/doActionService.
final protected  voidprocessRequest(PortletRequest request, PortletResponse response)
     Process this request, publishing an event regardless of the outcome.
public  voidrefresh()
     Refresh this portlet's application context, as well as the dependent state of the portlet.
public  voidsetContextClass(Class contextClass)
     Set a custom context class.
public  voidsetContextConfigLocation(String contextConfigLocation)
     Set the context config location explicitly, instead of relying on the default location built from the namespace.
public  voidsetNamespace(String namespace)
     Set a custom namespace for this portlet, to be used for building a default context config location.
public  voidsetPublishContext(boolean publishContext)
     Set whether to publish this portlet's context as a PortletContext attribute, available to all objects in the web container.
public  voidsetPublishEvents(boolean publishEvents)
     Set whether this portlet should publish a PortletRequestHandledEvent at the end of each request.
public  voidsetUserinfoUsernameAttributes(String[] userinfoUsernameAttributes)
     Set the list of attributes to search in the USER_INFO map when trying to find the username of the current user.

Field Detail
DEFAULT_CONTEXT_CLASS
final public static Class DEFAULT_CONTEXT_CLASS(Code)
Default context class for FrameworkPortlet.
See Also:   org.springframework.web.portlet.context.XmlPortletApplicationContext



DEFAULT_NAMESPACE_SUFFIX
final public static String DEFAULT_NAMESPACE_SUFFIX(Code)
Suffix for Portlet ApplicationContext namespaces. If a portlet of this class is given the name "test" in a context, the namespace used by the portlet will resolve to "test-portlet".



DEFAULT_USERINFO_ATTRIBUTE_NAMES
final public static String[] DEFAULT_USERINFO_ATTRIBUTE_NAMES(Code)
Default USER_INFO attribute names to search for the current username: "user.login.id", "user.name".



PORTLET_CONTEXT_PREFIX
final public static String PORTLET_CONTEXT_PREFIX(Code)
Prefix for the PortletContext attribute for the Portlet ApplicationContext. The completion is the portlet name.





Method Detail
createPortletApplicationContext
protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) throws BeansException(Code)
Instantiate the Portlet ApplicationContext for this portlet, either a default XmlPortletApplicationContext or a custom context class if set.

This implementation expects custom contexts to implement ConfigurablePortletApplicationContext. Can be overridden in subclasses.
Parameters:
  parent - the parent ApplicationContext to use, or null if none the Portlet ApplicationContext for this portlet
throws:
  BeansException - if the context couldn't be initialized
See Also:   FrameworkPortlet.setContextClass
See Also:   org.springframework.web.portlet.context.XmlPortletApplicationContext




destroy
public void destroy()(Code)
Close the ApplicationContext of this portlet.
See Also:   org.springframework.context.ConfigurableApplicationContext.close



doActionService
abstract protected void doActionService(ActionRequest request, ActionResponse response) throws Exception(Code)
Subclasses must implement this method to do the work of action request handling.

The contract is essentially the same as that for the processAction method of GenericPortlet.

This class intercepts calls to ensure that exception handling and event publication takes place.
Parameters:
  request - current action request
Parameters:
  response - current action response
throws:
  Exception - in case of any kind of processing failure
See Also:   javax.portlet.GenericPortlet.processAction




doDispatch
final protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException(Code)
Delegate render requests to processRequest/doRenderService.



doRenderService
abstract protected void doRenderService(RenderRequest request, RenderResponse response) throws Exception(Code)
Subclasses must implement this method to do the work of render request handling.

The contract is essentially the same as that for the doDispatch method of GenericPortlet.

This class intercepts calls to ensure that exception handling and event publication takes place.
Parameters:
  request - current render request
Parameters:
  response - current render response
throws:
  Exception - in case of any kind of processing failure
See Also:   javax.portlet.GenericPortlet.doDispatch




getContextClass
public Class getContextClass()(Code)
Return the custom context class.



getContextConfigLocation
public String getContextConfigLocation()(Code)
Return the explicit context config location, if any.



getNamespace
public String getNamespace()(Code)
Return the namespace for this portlet, falling back to default scheme if no custom namespace was set. (e.g. "test-portlet" for a portlet named "test")



getPortletApplicationContext
final public ApplicationContext getPortletApplicationContext()(Code)
Return this portlet's ApplicationContext.



getPortletContextAttributeName
public String getPortletContextAttributeName()(Code)
Return the PortletContext attribute name for this portlets's ApplicationContext.

The default implementation returns PORTLET_CONTEXT_PREFIX + portlet name.
See Also:   FrameworkPortlet.PORTLET_CONTEXT_PREFIX
See Also:   FrameworkPortlet.getPortletName




getUserinfoUsernameAttributes
public String[] getUserinfoUsernameAttributes()(Code)
Returns the list of attributes that will be searched in the USER_INFO map when trying to find the username of the current user
See Also:   FrameworkPortlet.getUsernameForRequest



getUsernameForRequest
protected String getUsernameForRequest(PortletRequest request)(Code)
Determine the username for the given request.

The default implementation first tries the UserPrincipal. If that does not exist, then it checks the USER_INFO map. Can be overridden in subclasses.
Parameters:
  request - current portlet request the username, or null if none found
See Also:   javax.portlet.PortletRequest.getUserPrincipal
See Also:   javax.portlet.PortletRequest.getRemoteUser
See Also:   javax.portlet.PortletRequest.USER_INFO
See Also:   FrameworkPortlet.setUserinfoUsernameAttributes




initFrameworkPortlet
protected void initFrameworkPortlet() throws PortletException, BeansException(Code)
This method will be invoked after any bean properties have been set and the ApplicationContext has been loaded.

The default implementation is empty; subclasses may override this method to perform any initialization they require.
throws:
  PortletException - in case of an initialization exception
throws:
  BeansException - if thrown by ApplicationContext methods




initPortletApplicationContext
protected ApplicationContext initPortletApplicationContext() throws BeansException(Code)
Initialize and publish the Portlet ApplicationContext for this portlet.

Delegates to FrameworkPortlet.createPortletApplicationContext for actual creation. Can be overridden in subclasses. the ApplicationContext for this portlet
throws:
  BeansException - if the context couldn't be initialized




initPortletBean
final protected void initPortletBean() throws PortletException, BeansException(Code)
Overridden method of GenericPortletBean, invoked after any bean properties have been set. Creates this portlet's ApplicationContext.



isPublishContext
public boolean isPublishContext()(Code)
Return whether to publish this portlet's context as a PortletContext attribute.



isPublishEvents
public boolean isPublishEvents()(Code)
Return whether this portlet should publish a PortletRequestHandledEvent at the end of each request.



onApplicationEvent
public void onApplicationEvent(ApplicationEvent event)(Code)
ApplicationListener endpoint that receives events from this servlet's WebApplicationContext.

The default implementation calls FrameworkPortlet.onRefresh in case of a org.springframework.context.event.ContextRefreshedEvent , triggering a refresh of this servlet's context-dependent state.
Parameters:
  event - the incoming ApplicationContext event




onRefresh
protected void onRefresh(ApplicationContext context) throws BeansException(Code)
Template method which can be overridden to add portlet-specific refresh work. Called after successful context refresh.

This implementation is empty.
Parameters:
  context - the current Portlet ApplicationContext
throws:
  BeansException - in case of errors
See Also:   FrameworkPortlet.refresh()




postProcessPortletApplicationContext
protected void postProcessPortletApplicationContext(ConfigurableApplicationContext pac)(Code)
Post-process the given Portlet ApplicationContext before it is refreshed and activated as context for this portlet.

The default implementation is empty. refresh() will be called automatically after this method returns.
Parameters:
  pac - the configured Portlet ApplicationContext (not refreshed yet)
See Also:   FrameworkPortlet.createPortletApplicationContext
See Also:   ConfigurableApplicationContext.refresh




processAction
final public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException(Code)
Delegate action requests to processRequest/doActionService.



processRequest
final protected void processRequest(PortletRequest request, PortletResponse response) throws PortletException, IOException(Code)
Process this request, publishing an event regardless of the outcome. The actual event handling is performed by the abstract doActionService() and doRenderService() template methods.
See Also:   FrameworkPortlet.doActionService
See Also:   FrameworkPortlet.doRenderService



refresh
public void refresh() throws BeansException(Code)
Refresh this portlet's application context, as well as the dependent state of the portlet.
throws:
  BeansException - in case of errors
See Also:   FrameworkPortlet.getPortletApplicationContext()
See Also:   org.springframework.context.ConfigurableApplicationContext.refresh



setContextClass
public void setContextClass(Class contextClass)(Code)
Set a custom context class. This class must be of type ApplicationContext; when using the default FrameworkPortlet implementation, the context class must also implement ConfigurablePortletApplicationContext.
See Also:   FrameworkPortlet.createPortletApplicationContext



setContextConfigLocation
public void setContextConfigLocation(String contextConfigLocation)(Code)
Set the context config location explicitly, instead of relying on the default location built from the namespace. This location string can consist of multiple locations separated by any number of commas and spaces.



setNamespace
public void setNamespace(String namespace)(Code)
Set a custom namespace for this portlet, to be used for building a default context config location.



setPublishContext
public void setPublishContext(boolean publishContext)(Code)
Set whether to publish this portlet's context as a PortletContext attribute, available to all objects in the web container. Default is true.

This is especially handy during testing, although it is debatable whether it's good practice to let other application objects access the context this way.




setPublishEvents
public void setPublishEvents(boolean publishEvents)(Code)
Set whether this portlet should publish a PortletRequestHandledEvent at the end of each request. Default is true; can be turned off for a slight performance improvement, provided that no ApplicationListeners rely on such events.
See Also:   org.springframework.web.portlet.context.PortletRequestHandledEvent



setUserinfoUsernameAttributes
public void setUserinfoUsernameAttributes(String[] userinfoUsernameAttributes)(Code)
Set the list of attributes to search in the USER_INFO map when trying to find the username of the current user.
See Also:   FrameworkPortlet.getUsernameForRequest



Fields inherited from org.springframework.web.portlet.GenericPortletBean
final protected Log logger(Code)(Java Doc)

Methods inherited from org.springframework.web.portlet.GenericPortletBean
final protected void addRequiredProperty(String property)(Code)(Java Doc)
final public PortletContext getPortletContext()(Code)(Java Doc)
final public String getPortletName()(Code)(Java Doc)
final public void init() throws PortletException(Code)(Java Doc)
protected void initBeanWrapper(BeanWrapper bw) throws BeansException(Code)(Java Doc)
protected void initPortletBean() throws PortletException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.