Skip to content

Instantly share code, notes, and snippets.

@andreacfm
Created September 30, 2010 19:49
Show Gist options
  • Save andreacfm/605202 to your computer and use it in GitHub Desktop.
Save andreacfm/605202 to your computer and use it in GitHub Desktop.
Servlet that load and use the Railo AfmlEngineFactory
/**
*/
public class CFMLServlet extends HttpServlet implements EngineChangeListener {
private CFMLEngine engine;
/**
* @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
*/
public void init(ServletConfig sg) throws ServletException {
super.init(sg);
engine=CFMLEngineFactory.getInstance(sg,this);
}
/**
* @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
protected void service(HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException {
engine.serviceCFML(this,req,rsp);
}
/**
* @see railo.loader.engine.EngineChangeListener#onUpdate(railo.loader.engine.CFMLEngine)
*/
public void onUpdate(CFMLEngine newEngine) {
try {
engine=CFMLEngineFactory.getInstance(getServletConfig(),this);
} catch (ServletException e) {
engine=newEngine;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment