|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--freemarker.ext.servlet.FreeMarkerServlet
This is a general-purpose FreeMarker servlet with following features:
FastHash
,
special wrapper classes are used that implement the TemplateHashModel
interface.Supported initialization parameters are:
600
(ten minutes)
- NoCache if set to true, generates headers in the response
that advise the HTTP client not to cache the returned page. Default
false
Field Summary | |
protected boolean |
debug
|
protected int |
maximumAge
|
static long |
serialVersionUID
|
protected long |
updateInterval
|
Constructor Summary | |
FreeMarkerServlet()
|
Method Summary | |
protected TemplateCache |
createCache()
Creates the TemplateCache to be used for this
servlet. |
protected HttpRequestParametersHashModel |
createRequestParametersHashModel(javax.servlet.http.HttpServletRequest request)
Get the request parameters from the servlet as a FreeMarker hash model. |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Implement the "GET" method for HTTP requests. |
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Implement the "POST" method for HTTP requests. |
protected java.lang.String |
getTemplatePath()
Retrieve the template path. |
void |
init()
Initialise the servlet. |
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,
Template template,
TemplateModelRoot data)
Called after the execution returns from template.process(). |
protected boolean |
preprocessRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Called as the first step in request processing, before the templating mechanism is put to work. |
protected boolean |
preTemplateProcess(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Template template,
TemplateModelRoot data)
Called before the execution is passed to template.process(). |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, 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 |
public static final long serialVersionUID
protected boolean debug
protected long updateInterval
protected int maximumAge
Constructor Detail |
public FreeMarkerServlet()
Method Detail |
public void init()
init
in class javax.servlet.GenericServlet
protected TemplateCache createCache()
TemplateCache
to be used for this
servlet.public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
doGet
in class javax.servlet.http.HttpServlet
request
- the servlet requestresponse
- the servlet responsepublic void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
doPost
in class javax.servlet.http.HttpServlet
request
- the servlet requestresponse
- the servlet responseprotected boolean preprocessRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
request
- the HTTP requestresponse
- the HTTP responseprotected final java.lang.String getTemplatePath()
TemplateCache
.protected HttpRequestParametersHashModel createRequestParametersHashModel(javax.servlet.http.HttpServletRequest request)
request
- the servlet request parameters as an HttpServletRequest
TemplateHashModel
protected void initializeServletContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
request
- the actual HTTP requestresponse
- the actual HTTP responseprotected void initializeSession(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
request
- the actual HTTP requestresponse
- the actual HTTP responseprotected boolean preTemplateProcess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Template template, TemplateModelRoot data) throws javax.servlet.ServletException, java.io.IOException
TemplateModelRoot
.request
- the actual HTTP requestresponse
- the actual HTTP responsetemplate
- the template that will get executeddata
- the data that will be passed to the templateprotected void postTemplateProcess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Template template, TemplateModelRoot data) throws javax.servlet.ServletException, java.io.IOException
request
- the actual HTTP requestresponse
- the actual HTTP responsetemplate
- the template that was executeddata
- the data that was passed to the template
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |