org.szegedi.expose.servlet
Class ExposeServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.szegedi.expose.servlet.ExposeServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ExposeServlet
extends javax.servlet.http.HttpServlet

This is a general-purpose Freemarker servlet with following features:

Supported initialization parameters are:

Version:
1.0
Author:
Attila Szegedi, attila@szegedi.org
See Also:
Serialized Form

Field Summary
protected  boolean debug
           
static long serialVersionUID
           
 
Constructor Summary
ExposeServlet()
           
 
Method Summary
protected  freemarker.template.TemplateCache createCache()
           
protected  HttpRequestParametersHashModel createRequestParametersHashModel(javax.servlet.http.HttpServletRequest request)
           
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void init()
           
protected  void initializeServletContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Called when servlet detects in a request processing that application-global (that is, ServletContext-specific) attributes are not yet set.
protected  void initializeSession(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Called when servlet detects in a request processing that session-global (that is, HttpSession-specific) attributes are not yet set.
protected  void postTemplateProcess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, freemarker.template.Template template, freemarker.template.TemplateModelRoot data)
          Called after the execution returns from template.process().
protected  boolean preTemplateProcess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, freemarker.template.Template template, freemarker.template.TemplateModelRoot data)
          Called before the execution is passed to template.process().
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, 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

serialVersionUID

public static final long serialVersionUID

debug

protected boolean debug
Constructor Detail

ExposeServlet

public ExposeServlet()
Method Detail

init

public void init()
Overrides:
init in class javax.servlet.GenericServlet

createCache

protected freemarker.template.TemplateCache createCache()

doGet

public 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

doPost

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

createRequestParametersHashModel

protected HttpRequestParametersHashModel createRequestParametersHashModel(javax.servlet.http.HttpServletRequest request)

initializeServletContext

protected void initializeServletContext(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)
                                 throws javax.servlet.ServletException,
                                        java.io.IOException
Called when servlet detects in a request processing that application-global (that is, ServletContext-specific) attributes are not yet set. This is a generic hook you might use in subclasses to perform a specific action on first request in the context. By default it does nothing.
Parameters:
request - the actual HTTP request
response - the actual HTTP response

initializeSession

protected void initializeSession(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
Called when servlet detects in a request processing that session-global (that is, HttpSession-specific) attributes are not yet set. This is a generic hook you might use in subclasses to perform a specific action on first request in the session. By default it does nothing.
Parameters:
request - the actual HTTP request
response - the actual HTTP response

preTemplateProcess

protected boolean preTemplateProcess(javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response,
                                     freemarker.template.Template template,
                                     freemarker.template.TemplateModelRoot data)
                              throws javax.servlet.ServletException,
                                     java.io.IOException
Called before the execution is passed to template.process(). This is a generic hook you might use in subclasses to perform a specific action before the template is processed. By default does nothing. A typical action to perform here is to inject application-specific objects into the TemplateModelRoot.
Parameters:
request - the actual HTTP request
response - the actual HTTP response
template - the template that will get executed
data - the data that will be passed to the template
Returns:
true to process the template, false to suppress template processing.

postTemplateProcess

protected void postTemplateProcess(javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response,
                                   freemarker.template.Template template,
                                   freemarker.template.TemplateModelRoot data)
                            throws javax.servlet.ServletException,
                                   java.io.IOException
Called after the execution returns from template.process(). This is a generic hook you might use in subclasses to perform a specific action after the template is processed. It will be invoked even if the template processing throws an exception. By default does nothing.
Parameters:
request - the actual HTTP request
response - the actual HTTP response
template - the template that was executed
data - the data that was passed to the template