info.magnolia.module.blossom.web
Class InstallationAwareServletProxy

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by info.magnolia.module.blossom.web.InstallationAwareServletProxy
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
InstallationAwareDispatcherServlet

public class InstallationAwareServletProxy
extends javax.servlet.http.HttpServlet

Proxy that postpones initialization of its target servlet while Magnolia is in update/install-mode. The servlet is initialized when it sees the first request after the update/installation phase is finished. It looks for an init parameter named 'servletClass' to find the class of the target servlet. Subclasses can override this behaviour. This is an alternative to running the servlet in the Magnolia filter chain. Any servlets configured in web.xml need to have a bypass configured on the Magnolia filter chain that matches its servlet mapping.

Initialization of the target servlet will happen after all modules have started.

Since:
1.2
See Also:
Serialized Form

Constructor Summary
InstallationAwareServletProxy()
           
 
Method Summary
protected  boolean canInitialize()
           
 void destroy()
           
 void init(javax.servlet.ServletConfig config)
           
protected  javax.servlet.Servlet initTargetServlet()
           
 void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, 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
 

Constructor Detail

InstallationAwareServletProxy

public InstallationAwareServletProxy()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

service

public void service(javax.servlet.ServletRequest req,
                    javax.servlet.ServletResponse res)
             throws javax.servlet.ServletException,
                    IOException
Specified by:
service in interface javax.servlet.Servlet
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

destroy

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

initTargetServlet

protected javax.servlet.Servlet initTargetServlet()
                                           throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

canInitialize

protected boolean canInitialize()


Copyright © 2009-2012 Magnolia International Ltd.. All Rights Reserved.