public final class BerliozServlet
extends javax.servlet.http.HttpServlet
A berlioz servlet can only generate one content type and use one set of XSLT templates, these are defined at
initialisation. See init(ServletConfig)
for details.
This servlet will pass on HTTP parameters to the underlying generators for the service it matches.
The XSLT templates are cached by default unless the XSLT Cache global option property was set to
false
; in other words XSLT templates are parsed once and reused for each call. The special parameter
clear-xsl-cache
can be used to clear the XSLT cache.
The response is considered cacheable if all the generators in the matching service are cacheable; that is if
they implement the Cacheable
interface).
For cacheable responses, Berlioz will return the following Headers:
Expires: [Expiry date 1 year from now] Cache-Control: [Cache control] or "max-age=[max age in seconds], must-revalidate" Etag: [Etag for generator]
The global option HTTP_MAX_AGE can be used to define the maximum age used in the
Cache-Control
HTTP Header of cacheable response.
The Etag
is computed from the list of Etags of each generator and an Etag generated for the
XSLT templates.
Non cacheable responses, always return:
Expires: 0 Cache-Control: no-cache
For security, the Berlioz administration parameters can be secures using a Berlioz control key. The control key is a string that must be supplied as a parameter whenever one of the admin parameters is used. Use the initialisation parameters to define a control key.
Constructor and Description |
---|
BerliozServlet() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
void |
doDelete(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
void |
doHead(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
void |
doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
void |
init(javax.servlet.ServletConfig servletConfig)
Initialises the Berlioz Servlet.
|
protected void |
process(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
boolean includeContent)
Handles requests.
|
doOptions, doTrace, getLastModified, service, service
public void init(javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException
This servlet accepts the following init parameters:
content-type
to specify the content type used by this Berlioz instance.
stylesheet
to specify the XSLT stylesheet to use for this Berlioz instance.
berlioz-control
to specify the Berlioz control key to enable admin parameters.
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
servletConfig
- The servlet configuration.javax.servlet.ServletException
- Should an exception occur.Servlet.init(javax.servlet.ServletConfig)
public void destroy()
destroy
in interface javax.servlet.Servlet
destroy
in class javax.servlet.GenericServlet
public void doHead(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, IOException
doHead
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
public void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, IOException
doGet
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
public void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, IOException
doPost
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
public void doPut(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, IOException
doPut
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
public void doDelete(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, IOException
doDelete
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
protected void process(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, boolean includeContent) throws javax.servlet.ServletException, IOException
req
- The HTTP servlet request.res
- The HTTP servlet response.includeContent
- Whether to include the content in the response.javax.servlet.ServletException
- To wrap any non IO exception.IOException
- For any IO exception.Copyright © 2016 Allette Systems. All rights reserved.