info.magnolia.cms.servlets
Class ClasspathSpool

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by info.magnolia.cms.servlets.ClasspathSpool
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ClasspathSpool
extends javax.servlet.http.HttpServlet

A simple spool servlet that load resources from the classpath. Resources folder is configurable via the servlet resourcesRoot init parameter. If none is provided, it defaults to /mgnl-resources. Files in this folder will be loaded by this servlet (corresponding to the configured mapped url, e.g. /.resources/* or /VAADIN/*, etc. This servlet should be used for authoring-only resources, like rich editor images and scripts. It's not suggested for public website resources. Content length and last modification date are not set on files returned from the classpath.

See Also:
Serialized Form

Field Summary
static String MGNL_DEFAULT_RESOURCES_ROOT
          Default root directory for resources streamed from the classpath.
 
Constructor Summary
ClasspathSpool()
           
 
Method Summary
 void destroy()
           
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          All static resource requests are handled here.
protected  String getFilePath(javax.servlet.http.HttpServletRequest request)
           
protected  long getLastModified(javax.servlet.http.HttpServletRequest req)
           
 void init()
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MGNL_DEFAULT_RESOURCES_ROOT

public static final String MGNL_DEFAULT_RESOURCES_ROOT
Default root directory for resources streamed from the classpath. Resources folder is configurable via the servlet resourcesRoot init parameter.

See Also:
Constant Field Values
Constructor Detail

ClasspathSpool

public ClasspathSpool()
Method Detail

getLastModified

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

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws IOException
All static resource requests are handled here.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
IOException - for error in accessing the resource or the servlet output stream

getFilePath

protected String getFilePath(javax.servlet.http.HttpServletRequest request)

init

public void init()
          throws javax.servlet.ServletException
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException
See Also:
GenericServlet.init()

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet
See Also:
GenericServlet.destroy()


Copyright © 2003-2014 Magnolia International Ltd.. All Rights Reserved.