org.directwebremoting.servlet
Class CachingHandler

java.lang.Object
  extended by org.directwebremoting.servlet.CachingHandler
All Implemented Interfaces:
Handler
Direct Known Subclasses:
TemplateHandler

public abstract class CachingHandler
extends java.lang.Object
implements Handler

A handler that deals with ETags and other nonsense to do with keeping a browsers cache in-sync with a web server.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
CachingHandler()
           
 
Method Summary
abstract  java.lang.String generateCachableContent(java.lang.String contextPath, java.lang.String servletPath, java.lang.String pathInfo)
          Create a String which can be cached and sent as a 302.
 java.lang.String getMimeType()
           
 void handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handle a URL request that has been mapped to this Handler
 void setIgnoreLastModified(boolean ignoreLastModified)
           
 void setMimeType(java.lang.String mimeType)
          The mime type to send the output under
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingHandler

public CachingHandler()
Method Detail

handle

public void handle(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws java.io.IOException
Description copied from interface: Handler
Handle a URL request that has been mapped to this Handler

Specified by:
handle in interface Handler
Parameters:
request - The HTTP request data
response - Where we write the HTTP response data
Throws:
java.io.IOException - If the write process fails

generateCachableContent

public abstract java.lang.String generateCachableContent(java.lang.String contextPath,
                                                         java.lang.String servletPath,
                                                         java.lang.String pathInfo)
                                                  throws java.io.IOException
Create a String which can be cached and sent as a 302. Returning null signals that the resource doesn't exist and should result in a 404.

Parameters:
contextPath -
servletPath -
pathInfo -
Returns:
The string to output for this resource
Throws:
java.io.IOException

setIgnoreLastModified

public void setIgnoreLastModified(boolean ignoreLastModified)
Parameters:
ignoreLastModified - The ignoreLastModified to set.

setMimeType

public void setMimeType(java.lang.String mimeType)
The mime type to send the output under

Parameters:
mimeType - the mimeType to set

getMimeType

public java.lang.String getMimeType()
Returns:
the current mime type

Copyright ยจ 2008