|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet com.atlassian.confluence.servlet.ConfluenceVelocityServlet
public class ConfluenceVelocityServlet
An improved WW VelocityServlet which doesn't load velocity twice!
We have copied code here because we can't override the WebWorkVelocityServlet as it calls VelocityServlet.init() which loads _another_ entire identical instance of Velocity (beyond the VelocityManager's instance), and the two are used interchangeably. http://jira.atlassian.com/browse/CONF-6355
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_CONTENT_TYPE
The default content type for the response |
Constructor Summary | |
---|---|
ConfluenceVelocityServlet()
|
Method Summary | |
---|---|
protected org.apache.velocity.context.Context |
createContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles GET - calls doRequest() |
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handle a POST request - calls doRequest() |
protected void |
doRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles all requests |
protected void |
error(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Exception cause)
Invoked when there is an error thrown in any part of doRequest() processing. |
protected java.lang.String |
getEncoding()
|
org.apache.velocity.Template |
getTemplate(java.lang.String name,
java.lang.String encoding)
Retrieves the requested template with the specified character encoding. |
protected org.apache.velocity.Template |
handleRequest(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
org.apache.velocity.context.Context context)
|
void |
init(javax.servlet.ServletConfig servletConfig)
|
protected void |
mergeTemplate(org.apache.velocity.Template template,
org.apache.velocity.context.Context context,
javax.servlet.http.HttpServletResponse response)
Copy of the method from WebworkVelocityServlet, adding a flush for the writer to get around problems we were having with truncated content when a filter started talking directly to the servletresponse writer without the webwork writer having been flushed in the meanwhile. |
protected void |
setContentType(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Sets the content type of the response. |
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 java.lang.String DEFAULT_CONTENT_TYPE
Constructor Detail |
---|
public ConfluenceVelocityServlet()
Method Detail |
---|
public void init(javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
protected org.apache.velocity.context.Context createContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected org.apache.velocity.Template handleRequest(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, org.apache.velocity.context.Context context) throws java.lang.Exception
java.lang.Exception
protected java.lang.String getEncoding()
public org.apache.velocity.Template getTemplate(java.lang.String name, java.lang.String encoding) throws org.apache.velocity.exception.ResourceNotFoundException, org.apache.velocity.exception.ParseErrorException, java.lang.Exception
name
- The file name of the template to retrieve relative to the
template root.encoding
- the character encoding of the template
org.apache.velocity.exception.ResourceNotFoundException
- if template not found
from any available source.
org.apache.velocity.exception.ParseErrorException
- if template cannot be parsed due
to syntax (or other) error.
java.lang.Exception
- if an error occurs in template initializationpublic 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
javax.servlet.ServletException
java.io.IOException
public 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
javax.servlet.ServletException
java.io.IOException
protected void doRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
request
- HttpServletRequest object containing client requestresponse
- HttpServletResponse object for the response
javax.servlet.ServletException
java.io.IOException
protected void setContentType(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- servlet request from clientresponse
- servlet reponse to clientprotected void mergeTemplate(org.apache.velocity.Template template, org.apache.velocity.context.Context context, javax.servlet.http.HttpServletResponse response) throws org.apache.velocity.exception.ResourceNotFoundException, org.apache.velocity.exception.ParseErrorException, org.apache.velocity.exception.MethodInvocationException, java.io.IOException, java.io.UnsupportedEncodingException, java.lang.Exception
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException
org.apache.velocity.exception.MethodInvocationException
java.io.IOException
java.io.UnsupportedEncodingException
java.lang.Exception
protected void error(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Exception cause) throws javax.servlet.ServletException, java.io.IOException
request
- original HttpServletRequest from servlet container.response
- HttpServletResponse object from servlet container.cause
- Exception that was thrown by some other part of process.
javax.servlet.ServletException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |