Package org.apache.commons.jelly.servlet
Class JellyServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.apache.commons.jelly.servlet.JellyServlet
-
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public class JellyServlet extends javax.servlet.http.HttpServlet
Servlet for handling display of Jelly-fied XML files. Modelled after VelocityServlet.- Version:
- $Revision: 155420 $
- Author:
- Kelvin Tan
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JellyServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JellyContext
createContext(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
seeorg.apache.velocity.servlet.VelocityServlet#createContext
protected void
doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected void
doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected void
doRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
Handles all requestsprotected void
error(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception cause)
Invoked when there is an error thrown in any part of doRequest() processing.protected URL
getScript(javax.servlet.http.HttpServletRequest req)
Either use the query parameter "script", or the URI itself to denote the script to run.protected void
runScript(URL script, JellyContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
seeorg.apache.velocity.servlet.VelocityServlet#mergeTemplate
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
-
-
-
-
Field Detail
-
REQUEST
public static final String REQUEST
The HTTP request object context key.- See Also:
- Constant Field Values
-
RESPONSE
public static final String RESPONSE
The HTTP response object context key.- See Also:
- Constant Field Values
-
-
Method Detail
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
- Overrides:
doGet
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
doPost
protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
- Overrides:
doPost
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
doRequest
protected void doRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, IOException
Handles all requests- Parameters:
req
- HttpServletRequest object containing client requestres
- HttpServletResponse object for the response- Throws:
javax.servlet.ServletException
IOException
-
createContext
protected JellyContext createContext(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
seeorg.apache.velocity.servlet.VelocityServlet#createContext
- Parameters:
req
-res
-- Returns:
-
getScript
protected URL getScript(javax.servlet.http.HttpServletRequest req) throws MalformedURLException
Either use the query parameter "script", or the URI itself to denote the script to run.
Example: script=index.jelly or http://localhost:8080/foo/index.jelly.
seeorg.apache.velocity.servlet.VelocityServlet#getTemplate
- Parameters:
req
-- Returns:
- Throws:
MalformedURLException
-
runScript
protected void runScript(URL script, JellyContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws IOException, UnsupportedEncodingException, JellyException
seeorg.apache.velocity.servlet.VelocityServlet#mergeTemplate
- Parameters:
script
-context
-req
-res
-- Throws:
IOException
UnsupportedEncodingException
JellyException
-
error
protected void error(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception cause) throws javax.servlet.ServletException, IOException
Invoked when there is an error thrown in any part of doRequest() processing.
Default will send a simple HTML response indicating there was a problem.
Ripped from VelocityServlet.- Parameters:
request
- original HttpServletRequest from servlet container.response
- HttpServletResponse object from servlet container.cause
- Exception that was thrown by some other part of process.- Throws:
javax.servlet.ServletException
IOException
-
-