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:
java.io.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. A simple rule for accessible resources: only files into a mgnl-resources folder will be loaded by this servlet (corresponding to the mapped url /.resources/*. 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.

Version:
$Revision: 41137 $ ($Author: gjoseph $)
Author:
Fabrizio Giustina
See Also:
Serialized Form

Field Summary
static java.lang.String MGNL_RESOURCES_ROOT
          Root directory for resources streamed from the classath.
 
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  java.lang.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_RESOURCES_ROOT

public static final java.lang.String MGNL_RESOURCES_ROOT
Root directory for resources streamed from the classath. Only resources in this folder can be accessed.

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 java.io.IOException
All static resource requests are handled here.

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

getFilePath

protected java.lang.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-2011 Magnolia International Ltd.. All Rights Reserved.