Package org.apache.commons.jelly.servlet
Class JellyServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.commons.jelly.servlet.JellyServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
public class JellyServlet
extends jakarta.servlet.http.HttpServlet
Servlet for handling display of Jelly-fied XML files. Modelled after VelocityServlet.
- Version:
- $Revision: 155420 $
- Author:
- Kelvin Tan
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected JellyContextcreateContext(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) seeorg.apache.velocity.servlet.VelocityServlet#createContextprotected voiddoGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected voiddoPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected voiddoRequest(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) Handles all requestsprotected voiderror(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Exception cause) Invoked when there is an error thrown in any part of doRequest() processing.protected URLgetScript(jakarta.servlet.http.HttpServletRequest req) Either use the query parameter "script", or the URI itself to denote the script to run.protected voidrunScript(URL script, JellyContext context, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) seeorg.apache.velocity.servlet.VelocityServlet#mergeTemplateMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
Field Details
-
REQUEST
The HTTP request object context key.- See Also:
-
RESPONSE
The HTTP response object context key.- See Also:
-
-
Constructor Details
-
JellyServlet
public JellyServlet()
-
-
Method Details
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException - Overrides:
doGetin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
doPost
protected void doPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException - Overrides:
doPostin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
doRequest
protected void doRequest(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws jakarta.servlet.ServletException, IOException Handles all requests- Parameters:
req- HttpServletRequest object containing client requestres- HttpServletResponse object for the response- Throws:
jakarta.servlet.ServletExceptionIOException
-
createContext
protected JellyContext createContext(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) seeorg.apache.velocity.servlet.VelocityServlet#createContext- Parameters:
req-res-- Returns:
-
getScript
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, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws IOException, UnsupportedEncodingException, JellyException seeorg.apache.velocity.servlet.VelocityServlet#mergeTemplate- Parameters:
script-context-req-res-- Throws:
IOExceptionUnsupportedEncodingExceptionJellyException
-
error
protected void error(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Exception cause) throws jakarta.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:
jakarta.servlet.ServletExceptionIOException
-