org.springframework.js.resource
Class ResourceServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.springframework.web.servlet.HttpServletBean
              extended by org.springframework.js.resource.ResourceServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ResourceServlet
extends org.springframework.web.servlet.HttpServletBean

Special resource servlet for efficiently resolving and rendering static resources from within a JAR file.

Author:
Jeremy Grelle, Scott Andrews
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.springframework.web.servlet.HttpServletBean
logger
 
Constructor Summary
ResourceServlet()
           
 
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  long getLastModified(javax.servlet.http.HttpServletRequest request)
           
 void setAllowedResourcePaths(java.lang.String allowedResourcePaths)
          Set allowed resources as an comma separated String of URL patterns, e.g.
 void setCacheTimeout(int cacheTimeout)
          Set the number of seconds resources should be cached by the client.
 void setCompressedMimeTypes(java.lang.String compressedMimeTypes)
          Set comma separated MIME types that should have gzip compression applied.
 void setGzipEnabled(boolean gzipEnabled)
          Set whether to apply gzip compression to resources if the requesting client supports it.
 void setJarPathPrefix(java.lang.String jarPathPrefix)
          Set the default path prefix to apply to resources being served from jar files.
 
Methods inherited from class org.springframework.web.servlet.HttpServletBean
addRequiredProperty, getServletContext, getServletName, init, initBeanWrapper, initServletBean
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletInfo, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceServlet

public ResourceServlet()
Method Detail

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     java.io.IOException
Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

getLastModified

protected long getLastModified(javax.servlet.http.HttpServletRequest request)
Overrides:
getLastModified in class javax.servlet.http.HttpServlet

setGzipEnabled

public void setGzipEnabled(boolean gzipEnabled)
Set whether to apply gzip compression to resources if the requesting client supports it.


setAllowedResourcePaths

public void setAllowedResourcePaths(java.lang.String allowedResourcePaths)
Set allowed resources as an comma separated String of URL patterns, e.g. "META-INF/** /*.js", The paths may be any Ant-style pattern parsable by AntPathMatcher.

See Also:
AntPathMatcher

setCompressedMimeTypes

public void setCompressedMimeTypes(java.lang.String compressedMimeTypes)
Set comma separated MIME types that should have gzip compression applied. Typically, gzip compression is only useful for text based content. Ant-style patterns are supported, e.g. "text/*".

See Also:
AntPathMatcher

setJarPathPrefix

public void setJarPathPrefix(java.lang.String jarPathPrefix)
Set the default path prefix to apply to resources being served from jar files. Default is "META-INF".


setCacheTimeout

public void setCacheTimeout(int cacheTimeout)
Set the number of seconds resources should be cached by the client. Zero disables caching. Default is one year.