|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.riotfamily.cachius.spring.AbstractCacheableController
org.riotfamily.riot.resource.AbstractResourceController
public class AbstractResourceController
Controller that serves an internal resource.
Note: This will only work when a prefix mapping is used for the
DispatcherServlet (like /riot/*) since
request.getPathInfo()
is used.
Field Summary |
---|
Fields inherited from interface org.riotfamily.cachius.spring.CacheableController |
---|
CACHE_ETERNALLY |
Constructor Summary | |
---|---|
AbstractResourceController()
|
Method Summary | |
---|---|
protected boolean |
contentTypeShouldBeZipped(String contentType)
|
protected String |
getCacheKeyInternal(HttpServletRequest request)
Returns the actual cache-key. |
protected String |
getContentType(Resource resource)
|
long |
getLastModified(HttpServletRequest request)
The default implementation returns System.currentTimeMillis() so that the item is
refreshed as soon as it expires. |
protected long |
getLastModified(String path)
|
protected Reader |
getReader(Resource res,
String path,
String contentType,
HttpServletRequest request)
|
protected String |
getResourcePath(HttpServletRequest request)
|
long |
getTimeToLive()
The default implementation returns 0 so that
AbstractCacheableController.getLastModified(HttpServletRequest) is invoked every time the
controller is requested. |
boolean |
gzipResponse(HttpServletRequest request)
Returns whether the response should be gzipped. |
ModelAndView |
handleRequest(HttpServletRequest request,
HttpServletResponse response)
|
protected Resource |
lookupResource(String path)
|
protected void |
serveBinary(Resource res,
String contentType,
OutputStream out)
|
protected boolean |
serveResource(String path,
HttpServletRequest request,
HttpServletResponse response)
|
protected void |
serveText(Resource res,
String path,
String contentType,
HttpServletRequest request,
Writer out)
|
void |
setCheckForModifications(boolean checkForModifications)
Sets whether the controller check for file modifications. |
void |
setFileTypeMap(FileTypeMap fileTypeMap)
|
void |
setFilters(List<ResourceFilter> filters)
|
void |
setMappings(List<ResourceMapping> resourceMappings)
|
void |
setPathAttribute(String pathAttribute)
Sets the name of the request attribute that will contain the resource path. |
void |
setPathParameter(String pathParameter)
Sets the name of the request parameter that will contain the resource path. |
Methods inherited from class org.riotfamily.cachius.spring.AbstractCacheableController |
---|
appendCacheKey, bypassCache, getBeanName, getCacheKey, setAddUriToCacheKey, setBeanName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractResourceController()
Method Detail |
---|
public void setPathAttribute(String pathAttribute)
public void setPathParameter(String pathParameter)
public void setFileTypeMap(FileTypeMap fileTypeMap)
public void setMappings(List<ResourceMapping> resourceMappings)
public void setFilters(List<ResourceFilter> filters)
public void setCheckForModifications(boolean checkForModifications)
protected Resource lookupResource(String path) throws IOException
IOException
protected String getContentType(Resource resource)
protected String getResourcePath(HttpServletRequest request)
public long getLastModified(HttpServletRequest request)
AbstractCacheableController
System.currentTimeMillis()
so that the item is
refreshed as soon as it expires. Subclasses should override this
method to return something reasonable.
getLastModified
in interface CacheableController
getLastModified
in interface LastModified
getLastModified
in class AbstractCacheableController
protected long getLastModified(String path)
public long getTimeToLive()
AbstractCacheableController
0
so that
AbstractCacheableController.getLastModified(HttpServletRequest)
is invoked every time the
controller is requested.
getTimeToLive
in interface CacheableController
getTimeToLive
in class AbstractCacheableController
protected String getCacheKeyInternal(HttpServletRequest request)
AbstractCacheableController
getCacheKey()
if bypassCache()
returned false
.
The method creates a StringBuffer containing either the bean-name or the
originating path
and, in case of an include or forward, the
nested path
.
The StringBuffer is passed to AbstractCacheableController.appendCacheKey(StringBuffer, HttpServletRequest)
,
allowing subclasses to add additional information.
getCacheKeyInternal
in class AbstractCacheableController
protected boolean contentTypeShouldBeZipped(String contentType)
public boolean gzipResponse(HttpServletRequest request)
Compressible
true
, unless they serve multiple content
types which and not all of them are eligible for compression. They
don't have to check whether the client supports gzip
compression as all compatibility checks are done by Cachius
internally
.
gzipResponse
in interface Compressible
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws IOException
handleRequest
in interface Controller
IOException
protected boolean serveResource(String path, HttpServletRequest request, HttpServletResponse response) throws IOException
IOException
protected void serveText(Resource res, String path, String contentType, HttpServletRequest request, Writer out) throws IOException
IOException
protected Reader getReader(Resource res, String path, String contentType, HttpServletRequest request) throws IOException
IOException
protected void serveBinary(Resource res, String contentType, OutputStream out) throws IOException
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |