Java Doc for AbstractController.java in  » J2EE » spring-framework-2.0.6 » org » springframework » web » portlet » mvc » 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.mvc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.springframework.web.portlet.handler.PortletContentGenerator
   org.springframework.web.portlet.mvc.AbstractController

All known Subclasses:   org.springframework.web.portlet.mvc.ParameterizableViewController,  org.springframework.web.portlet.mvc.BaseCommandController,  org.springframework.web.portlet.mvc.PortletWrappingController,
AbstractController
abstract public class AbstractController extends PortletContentGenerator implements Controller(Code)
Convenient superclass for controller implementations, using the Template Method design pattern.

As stated in the Controller Controller interface, a lot of functionality is already provided by certain abstract base controllers. The AbstractController is one of the most important abstract base controller providing basic features such controlling if a session is required and render caching.

Workflow (and that defined by interface):

  1. If this is an action request, AbstractController.handleActionRequest handleActionRequest will be called by the DispatcherPortlet once to perform the action defined by this controller.
  2. If a session is required, try to get it (PortletException if not found).
  3. Call method AbstractController.handleActionRequestInternal handleActionRequestInternal , (optionally synchronizing around the call on the PortletSession), which should be overridden by extending classes to provide actual functionality to perform the desired action of the controller. This will be executed only once.
  4. For a straight render request, or the render phase of an action request (assuming the same controller is called for the render phase -- see tip below), AbstractController.handleRenderRequest handleRenderRequest will be called by the DispatcherPortlet repeatedly to render the display defined by this controller.
  5. If a session is required, try to get it (PortletException if none found).
  6. It will control caching as defined by the cacheSeconds property.
  7. Call method AbstractController.handleRenderRequestInternal handleRenderRequestInternal , (optionally synchronizing around the call on the PortletSession), which should be overridden by extending classes to provide actual functionality to return org.springframework.web.portlet.ModelAndView ModelAndView objects. This will be executed repeatedly as the portal updates the current displayed page.

Exposed configuration properties (and those defined by interface):
name default description
requiresSession false whether a session should be required for requests to be able to be handled by this controller. This ensures, derived controller can - without fear of Nullpointers - call request.getSession() to retrieve a session. If no session can be found while processing the request, a PortletException will be thrown
synchronizeOnSession false whether the calls to handleRenderRequestInternal and handleRenderRequestInternal should be synchronized around the PortletSession, to serialize invocations from the same client. No effect if there is no PortletSession.
cacheSeconds -1 indicates the amount of seconds to specify caching is allowed in the render response generatedby this request. 0 (zero) will indicate no caching is allowed at all, -1 (the default) will not override the portlet configuration and any positive number will cause the render response to declare the amount indicated as seconds to cache the content
renderWhenMinimized false whether should be rendered when the portlet is in a minimized state -- will return null for the ModelandView when the portlet is minimized and this is false

TIP: The controller mapping will be run twice by the PortletDispatcher for action requests -- once for the action phase and again for the render phase. You can reach the render phase of a different controller by simply changing the values for the criteria your mapping is using, such as portlet mode or a request parameter, during the action phase of your controller. This is very handy since redirects within the portlet are apparently impossible. Before doing this, it is usually wise to call clearAllRenderParameters and then explicitly set all the parameters that you want the new controller to see. This avoids unexpected parameters from being passed to the render phase of the second controller, such as the parameter indicating a form submit ocurred in an AbstractFormController.

Thanks to Rainer Schmitz and Nick Lothian for their suggestions!
author:
   John A. Lewis
author:
   Juergen Hoeller
since:
   2.0





Method Summary
final public  voidhandleActionRequest(ActionRequest request, ActionResponse response)
    
protected  voidhandleActionRequestInternal(ActionRequest request, ActionResponse response)
     Subclasses are meant to override this method if the controller is expected to handle action requests.
final public  ModelAndViewhandleRenderRequest(RenderRequest request, RenderResponse response)
    
protected  ModelAndViewhandleRenderRequestInternal(RenderRequest request, RenderResponse response)
     Subclasses are meant to override this method if the controller is expected to handle render requests.
public  booleanisRenderWhenMinimized()
     Return whether controller will render when portlet is minimized.
final public  booleanisSynchronizeOnSession()
     Return whether controller execution should be synchronized on the session.
public  voidsetRenderWhenMinimized(boolean renderWhenMinimized)
     Set if the controller should render an view when the portlet is in a minimized window.
final public  voidsetSynchronizeOnSession(boolean synchronizeOnSession)
     Set if controller execution should be synchronized on the session, to serialize parallel invocations from the same client.

More specifically, the execution of the handleActionRequestInternal method will get synchronized if this flag is "true".




Method Detail
handleActionRequest
final public void handleActionRequest(ActionRequest request, ActionResponse response) throws Exception(Code)



handleActionRequestInternal
protected void handleActionRequestInternal(ActionRequest request, ActionResponse response) throws Exception(Code)
Subclasses are meant to override this method if the controller is expected to handle action requests. The contract is the same as for handleActionRequest.

The default implementation throws a PortletException.
See Also:   AbstractController.handleActionRequest
See Also:   AbstractController.handleRenderRequestInternal




handleRenderRequest
final public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) throws Exception(Code)



handleRenderRequestInternal
protected ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response) throws Exception(Code)
Subclasses are meant to override this method if the controller is expected to handle render requests. The contract is the same as for handleRenderRequest.

The default implementation throws a PortletException.
See Also:   AbstractController.handleRenderRequest
See Also:   AbstractController.handleActionRequestInternal




isRenderWhenMinimized
public boolean isRenderWhenMinimized()(Code)
Return whether controller will render when portlet is minimized.



isSynchronizeOnSession
final public boolean isSynchronizeOnSession()(Code)
Return whether controller execution should be synchronized on the session.



setRenderWhenMinimized
public void setRenderWhenMinimized(boolean renderWhenMinimized)(Code)
Set if the controller should render an view when the portlet is in a minimized window. The default is false.
See Also:   javax.portlet.RenderRequest.getWindowState
See Also:   javax.portlet.WindowState.MINIMIZED



setSynchronizeOnSession
final public void setSynchronizeOnSession(boolean synchronizeOnSession)(Code)
Set if controller execution should be synchronized on the session, to serialize parallel invocations from the same client.

More specifically, the execution of the handleActionRequestInternal method will get synchronized if this flag is "true". The best available session mutex will be used for the synchronization; ideally, this will be a mutex exposed by HttpSessionMutexListener.

The session mutex is guaranteed to be the same object during the entire lifetime of the session, available under the key defined by the SESSION_MUTEX_ATTRIBUTE constant. It serves as a safe reference to synchronize on for locking on the current session.

In many cases, the PortletSession reference itself is a safe mutex as well, since it will always be the same object reference for the same active logical session. However, this is not guaranteed across different servlet containers; the only 100% safe way is a session mutex.
See Also:   AbstractController.handleActionRequestInternal
See Also:   org.springframework.web.util.HttpSessionMutexListener
See Also:   org.springframework.web.portlet.util.PortletUtils.getSessionMutex(javax.portlet.PortletSession)




Methods inherited from org.springframework.web.portlet.handler.PortletContentGenerator
final protected void applyCacheSeconds(RenderResponse response, int seconds)(Code)(Java Doc)
final protected void cacheForSeconds(RenderResponse response, int seconds)(Code)(Java Doc)
final protected void check(PortletRequest request, PortletResponse response) throws PortletException(Code)(Java Doc)
final protected void checkAndPrepare(RenderRequest request, RenderResponse response) throws PortletException(Code)(Java Doc)
final protected void checkAndPrepare(RenderRequest request, RenderResponse response, int cacheSeconds) throws PortletException(Code)(Java Doc)
final public int getCacheSeconds()(Code)(Java Doc)
final public boolean isRequireSession()(Code)(Java Doc)
final protected void preventCaching(RenderResponse response)(Code)(Java Doc)
final public void setCacheSeconds(int seconds)(Code)(Java Doc)
final public void setRequireSession(boolean requireSession)(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.