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


org.springframework.web.context.support.WebApplicationObjectSupport
   org.springframework.web.servlet.support.WebContentGenerator

All known Subclasses:   org.springframework.web.servlet.mvc.WebContentInterceptor,  org.springframework.web.servlet.mvc.AbstractController,
WebContentGenerator
abstract public class WebContentGenerator extends WebApplicationObjectSupport (Code)
Convenient superclass for any kind of web content generator, like AbstractController and WebContentInterceptor. Can also be used for custom handlers that have their own org.springframework.web.servlet.HandlerAdapter .

Supports HTTP cache control options. The usage of corresponding HTTP headers can be determined via the "useExpiresHeader" and "userCacheControlHeader" properties.
author:
   Rod Johnson
author:
   Juergen Hoeller
See Also:   WebContentGenerator.setUseExpiresHeader
See Also:   WebContentGenerator.setUseCacheControlHeader
See Also:   org.springframework.web.servlet.mvc.AbstractController
See Also:   org.springframework.web.servlet.mvc.WebContentInterceptor



Field Summary
final public static  StringMETHOD_GET
    
final public static  StringMETHOD_HEAD
    
final public static  StringMETHOD_POST
    

Constructor Summary
public  WebContentGenerator()
    

Method Summary
final protected  voidapplyCacheSeconds(HttpServletResponse response, int seconds)
     Apply the given cache seconds and generate corresponding HTTP headers, i.e.
final protected  voidapplyCacheSeconds(HttpServletResponse response, int seconds, boolean mustRevalidate)
     Apply the given cache seconds and generate respective HTTP headers.

That is, allow caching for the given number of seconds in the case of a positive value, prevent caching if given a 0 value, else do nothing (i.e.

final protected  voidcacheForSeconds(HttpServletResponse response, int seconds)
     Set HTTP headers to allow caching for the given number of seconds.
final protected  voidcacheForSeconds(HttpServletResponse response, int seconds, boolean mustRevalidate)
     Set HTTP headers to allow caching for the given number of seconds.
final protected  voidcheckAndPrepare(HttpServletRequest request, HttpServletResponse response, boolean lastModified)
     Check and prepare the given request and response according to the settings of this generator.
final protected  voidcheckAndPrepare(HttpServletRequest request, HttpServletResponse response, int cacheSeconds, boolean lastModified)
     Check and prepare the given request and response according to the settings of this generator.
final public  intgetCacheSeconds()
     Return the number of seconds that content is cached.
final public  String[]getSupportedMethods()
     Return the HTTP methods that this content generator supports.
final public  booleanisRequireSession()
     Return whether a session is required to handle requests.
final public  booleanisUseCacheControlHeader()
     Return whether the HTTP 1.1 cache-control header is used.
final public  booleanisUseExpiresHeader()
     Return whether the HTTP 1.0 expires header is used.
final protected  voidpreventCaching(HttpServletResponse response)
     Prevent the response from being cached.
final public  voidsetCacheSeconds(int seconds)
     Cache content for the given number of seconds.
final public  voidsetRequireSession(boolean requireSession)
     Set whether a session should be required to handle requests.
final public  voidsetSupportedMethods(String[] methods)
     Set the HTTP methods that this content generator should support.
final public  voidsetUseCacheControlHeader(boolean useCacheControlHeader)
     Set whether to use the HTTP 1.1 cache-control header.
final public  voidsetUseExpiresHeader(boolean useExpiresHeader)
     Set whether to use the HTTP 1.0 expires header.

Field Detail
METHOD_GET
final public static String METHOD_GET(Code)
HTTP method "GET"



METHOD_HEAD
final public static String METHOD_HEAD(Code)
HTTP method "HEAD"



METHOD_POST
final public static String METHOD_POST(Code)
HTTP method "POST"




Constructor Detail
WebContentGenerator
public WebContentGenerator()(Code)




Method Detail
applyCacheSeconds
final protected void applyCacheSeconds(HttpServletResponse response, int seconds)(Code)
Apply the given cache seconds and generate corresponding HTTP headers, i.e. allow caching for the given number of seconds in case of a positive value, prevent caching if given a 0 value, do nothing else. Does not tell the browser to revalidate the resource.
Parameters:
  response - current HTTP response
Parameters:
  seconds - positive number of seconds into the future that theresponse should be cacheable for, 0 to prevent caching
See Also:   WebContentGenerator.cacheForSeconds(javax.servlet.http.HttpServletResponse,int,boolean)



applyCacheSeconds
final protected void applyCacheSeconds(HttpServletResponse response, int seconds, boolean mustRevalidate)(Code)
Apply the given cache seconds and generate respective HTTP headers.

That is, allow caching for the given number of seconds in the case of a positive value, prevent caching if given a 0 value, else do nothing (i.e. leave caching to the client).
Parameters:
  response - the current HTTP response
Parameters:
  seconds - the (positive) number of seconds into the future thatthe response should be cacheable for; 0 to prevent caching; anda negative value to leave caching to the client.
Parameters:
  mustRevalidate - whether the client should revalidate the resource(typically only necessary for controllers with last-modified support)




cacheForSeconds
final protected void cacheForSeconds(HttpServletResponse response, int seconds)(Code)
Set HTTP headers to allow caching for the given number of seconds. Does not tell the browser to revalidate the resource.
Parameters:
  response - current HTTP response
Parameters:
  seconds - number of seconds into the future that the responseshould be cacheable for
See Also:   WebContentGenerator.cacheForSeconds(javax.servlet.http.HttpServletResponse,int,boolean)



cacheForSeconds
final protected void cacheForSeconds(HttpServletResponse response, int seconds, boolean mustRevalidate)(Code)
Set HTTP headers to allow caching for the given number of seconds. Tells the browser to revalidate the resource if mustRevalidate is true.
Parameters:
  response - the current HTTP response
Parameters:
  seconds - number of seconds into the future that the responseshould be cacheable for
Parameters:
  mustRevalidate - whether the client should revalidate the resource(typically only necessary for controllers with last-modified support)



checkAndPrepare
final protected void checkAndPrepare(HttpServletRequest request, HttpServletResponse response, boolean lastModified) throws ServletException(Code)
Check and prepare the given request and response according to the settings of this generator. Checks for supported methods and a required session, and applies the number of cache seconds specified for this generator.
Parameters:
  request - current HTTP request
Parameters:
  response - current HTTP response
Parameters:
  lastModified - if the mapped handler provides Last-Modified support
throws:
  ServletException - if the request cannot be handled because a check failed



checkAndPrepare
final protected void checkAndPrepare(HttpServletRequest request, HttpServletResponse response, int cacheSeconds, boolean lastModified) throws ServletException(Code)
Check and prepare the given request and response according to the settings of this generator. Checks for supported methods and a required session, and applies the given number of cache seconds.
Parameters:
  request - current HTTP request
Parameters:
  response - current HTTP response
Parameters:
  cacheSeconds - positive number of seconds into the future that theresponse should be cacheable for, 0 to prevent caching
Parameters:
  lastModified - if the mapped handler provides Last-Modified support
throws:
  ServletException - if the request cannot be handled because a check failed



getCacheSeconds
final public int getCacheSeconds()(Code)
Return the number of seconds that content is cached.



getSupportedMethods
final public String[] getSupportedMethods()(Code)
Return the HTTP methods that this content generator supports.



isRequireSession
final public boolean isRequireSession()(Code)
Return whether a session is required to handle requests.



isUseCacheControlHeader
final public boolean isUseCacheControlHeader()(Code)
Return whether the HTTP 1.1 cache-control header is used.



isUseExpiresHeader
final public boolean isUseExpiresHeader()(Code)
Return whether the HTTP 1.0 expires header is used.



preventCaching
final protected void preventCaching(HttpServletResponse response)(Code)
Prevent the response from being cached. See www.mnot.net.cache docs.



setCacheSeconds
final public void setCacheSeconds(int seconds)(Code)
Cache content for the given number of seconds. Default is -1, indicating no generation of cache-related headers.

Only if this is set to 0 (no cache) or a positive value (cache for this many seconds) will this class generate cache headers.

The headers can be overwritten by subclasses, before content is generated.




setRequireSession
final public void setRequireSession(boolean requireSession)(Code)
Set whether a session should be required to handle requests.



setSupportedMethods
final public void setSupportedMethods(String[] methods)(Code)
Set the HTTP methods that this content generator should support. Default is HEAD, GET and POST.



setUseCacheControlHeader
final public void setUseCacheControlHeader(boolean useCacheControlHeader)(Code)
Set whether to use the HTTP 1.1 cache-control header. Default is "true".

Note: Cache headers will only get applied if caching is enabled for the current request.




setUseExpiresHeader
final public void setUseExpiresHeader(boolean useExpiresHeader)(Code)
Set whether to use the HTTP 1.0 expires header. Default is "true".

Note: Cache headers will only get applied if caching is enabled for the current request.




Methods inherited from org.springframework.web.context.support.WebApplicationObjectSupport
final protected ServletContext getServletContext() throws IllegalStateException(Code)(Java Doc)
final protected File getTempDir() throws IllegalStateException(Code)(Java Doc)
final protected WebApplicationContext getWebApplicationContext() throws IllegalStateException(Code)(Java Doc)
protected boolean isContextRequired()(Code)(Java Doc)
final public void setServletContext(ServletContext servletContext)(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.