com.atlassian.jira.web.servlet
Class BufferingRequestDispatcher

java.lang.Object
  extended by com.atlassian.jira.web.servlet.BufferingRequestDispatcher

public class BufferingRequestDispatcher
extends Object

Dispatches requests, buffering the contents of the response and returning it as a String. This is needed because JIRA's velocity manager doesn't allow writing to a writer, it only returns the content as a String, so the JSP can't write directly to the responses writer. This class is intended for use in velocity templates to include JSPs.


Constructor Summary
BufferingRequestDispatcher(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
 CharArrayWriter include(String path)
          Return the contents of the given path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferingRequestDispatcher

public BufferingRequestDispatcher(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)
Method Detail

include

public CharArrayWriter include(String path)
                        throws javax.servlet.ServletException,
                               IOException
Return the contents of the given path. This is called include because its functionally the same as a jsp:include when used in a velocity template.

Parameters:
path - The path to dispatch the request to.
Returns:
A CharArrayWriter with the output of the JSP. This is a little more efficient than returning a String, because you can use CharArrayWriter.writeTo() to write the output directly to another writer.
Throws:
javax.servlet.ServletException - If an error occured dispatching the request.
IOException - If an error occured dispatching the request.


Copyright © 2002-2013 Atlassian. All Rights Reserved.