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


org.springframework.web.servlet.support.WebContentGenerator
   org.springframework.web.servlet.mvc.AbstractController

All known Subclasses:   org.springframework.web.servlet.mvc.BaseCommandController,  org.springframework.web.servlet.mvc.AbstractUrlViewController,  org.springframework.web.servlet.mvc.ParameterizableViewController,  org.springframework.web.servlet.mvc.multiaction.MultiActionController,  org.springframework.web.servlet.mvc.ServletForwardingController,  org.springframework.web.servlet.mvc.ServletWrappingController,
AbstractController
abstract public class AbstractController extends WebContentGenerator implements Controller(Code)

Convenient superclass for controller implementations, using the Template Method design pattern.

As stated in the org.springframework.web.servlet.mvc.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 as the generation of caching headers and the enabling or disabling of supported methods (GET/POST).

Workflow (and that defined by interface):

  1. AbstractController.handleRequest(HttpServletRequest,HttpServletResponse) handleRequest() will be called by the DispatcherServlet
  2. Inspection of supported methods (ServletException if request method is not support)
  3. If session is required, try to get it (ServletException if not found)
  4. Set caching headers if needed according to cacheSeconds propery
  5. Call abstract method AbstractController.handleRequestInternal(HttpServletRequest,HttpServletResponse) handleRequestInternal() (optionally synchronizing around the call on the HttpSession), which should be implemented by extending classes to provide actual functionality to return org.springframework.web.servlet.ModelAndView ModelAndView objects.

Exposed configuration properties (and those defined by interface):
name default description
supportedMethods GET,POST comma-separated (CSV) list of methods supported by this controller, such as GET, POST and PUT
requireSession false whether a session should be required for requests to be able to be handled by this controller. This ensures that derived controller can - without fear of null pointers - call request.getSession() to retrieve a session. If no session can be found while processing the request, a ServletException will be thrown
cacheSeconds -1 indicates the amount of seconds to include in the cache header for the response following on this request. 0 (zero) will include headers for no caching at all, -1 (the default) will not generate any headers and any positive number will generate headers that state the amount indicated as seconds to cache the content
synchronizeOnSession false whether the call to handleRequestInternal should be synchronized around the HttpSession, to serialize invocations from the same client. No effect if there is no HttpSession.

author:
   Rod Johnson
author:
   Juergen Hoeller
See Also:   WebContentInterceptor





Method Summary
final public  ModelAndViewhandleRequest(HttpServletRequest request, HttpServletResponse response)
    
abstract protected  ModelAndViewhandleRequestInternal(HttpServletRequest request, HttpServletResponse response)
     Template method.
final public  booleanisSynchronizeOnSession()
     Return whether controller execution should be synchronized on the session.
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 handleRequestInternal method will get synchronized if this flag is "true".




Method Detail
handleRequest
final public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception(Code)



handleRequestInternal
abstract protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception(Code)
Template method. Subclasses must implement this. The contract is the same as for handleRequest.
See Also:   AbstractController.handleRequest



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



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 handleRequestInternal 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 HttpSession 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:   org.springframework.web.servlet.mvc.AbstractController.handleRequestInternal
See Also:   org.springframework.web.util.HttpSessionMutexListener
See Also:   org.springframework.web.util.WebUtils.getSessionMutex(javax.servlet.http.HttpSession)




Fields inherited from org.springframework.web.servlet.support.WebContentGenerator
final public static String METHOD_GET(Code)(Java Doc)
final public static String METHOD_HEAD(Code)(Java Doc)
final public static String METHOD_POST(Code)(Java Doc)

Methods inherited from org.springframework.web.servlet.support.WebContentGenerator
final protected void applyCacheSeconds(HttpServletResponse response, int seconds)(Code)(Java Doc)
final protected void applyCacheSeconds(HttpServletResponse response, int seconds, boolean mustRevalidate)(Code)(Java Doc)
final protected void cacheForSeconds(HttpServletResponse response, int seconds)(Code)(Java Doc)
final protected void cacheForSeconds(HttpServletResponse response, int seconds, boolean mustRevalidate)(Code)(Java Doc)
final protected void checkAndPrepare(HttpServletRequest request, HttpServletResponse response, boolean lastModified) throws ServletException(Code)(Java Doc)
final protected void checkAndPrepare(HttpServletRequest request, HttpServletResponse response, int cacheSeconds, boolean lastModified) throws ServletException(Code)(Java Doc)
final public int getCacheSeconds()(Code)(Java Doc)
final public String[] getSupportedMethods()(Code)(Java Doc)
final public boolean isRequireSession()(Code)(Java Doc)
final public boolean isUseCacheControlHeader()(Code)(Java Doc)
final public boolean isUseExpiresHeader()(Code)(Java Doc)
final protected void preventCaching(HttpServletResponse response)(Code)(Java Doc)
final public void setCacheSeconds(int seconds)(Code)(Java Doc)
final public void setRequireSession(boolean requireSession)(Code)(Java Doc)
final public void setSupportedMethods(String[] methods)(Code)(Java Doc)
final public void setUseCacheControlHeader(boolean useCacheControlHeader)(Code)(Java Doc)
final public void setUseExpiresHeader(boolean useExpiresHeader)(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.