public class

CapturingRequestWrapper

extends HttpServletRequestWrapper
java.lang.Object
   ↳ javax.servlet.ServletRequestWrapper
     ↳ javax.servlet.http.HttpServletRequestWrapper
       ↳ com.atlassian.jira.util.http.request.CapturingRequestWrapper

Class Overview

This HttpServletRequestWrapper can capture the data contained within a HttpServletRequest.

As data is read from the HttpServletRequest, it is stored in memory up to a certain limit.

THREAD SAFETY - One of these must be constructed on each HTTP request/response and hence only one thread may write to it at the one time. This suits the whole servlet engine idea,

Summary

[Expand]
Inherited Constants
From interface javax.servlet.http.HttpServletRequest
Public Constructors
CapturingRequestWrapper(HttpServletRequest httpServletRequest, int maxCaptureBytes)
This request wrapper will capture up to maxCaptureBytes of input data as it is read by the application server.
Public Methods
byte[] getBytes()
This returns the bytes that have been captured via the RequestWrapper, This will be no bigger than maxCaptureBytes
ServletInputStream getInputStream()
BufferedReader getReader()
[Expand]
Inherited Methods
From class javax.servlet.http.HttpServletRequestWrapper
From class javax.servlet.ServletRequestWrapper
From class java.lang.Object
From interface javax.servlet.ServletRequest
From interface javax.servlet.http.HttpServletRequest

Public Constructors

public CapturingRequestWrapper (HttpServletRequest httpServletRequest, int maxCaptureBytes)

This request wrapper will capture up to maxCaptureBytes of input data as it is read by the application server.

Parameters
httpServletRequest the underlying HttpServletRequest
maxCaptureBytes the maximum number of bytes to capture

Public Methods

public byte[] getBytes ()

This returns the bytes that have been captured via the RequestWrapper, This will be no bigger than maxCaptureBytes

Returns
  • the bytes that have been captured via the RequestWrapper

public ServletInputStream getInputStream ()

Throws
IOException

public BufferedReader getReader ()

Throws
IOException