public class HttpRequestUtils
extends java.lang.Object
Constructor and Description |
---|
HttpRequestUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getPostDataAsString(javax.servlet.http.HttpServletRequest request)
Reads the POST data from a request into a String and returns it.
|
static java.lang.String |
getReaderContentAsString(java.io.Reader reader)
Reads the content of a Reader instance and returns it as a String.
|
static java.lang.String |
getRequestDump(java.lang.String fromMethod,
javax.servlet.http.HttpServletRequest request,
boolean includePostData)
Build a String containing a multi-line dump of an HTTP request.
|
static java.lang.String |
getShortRequestDump(java.lang.String fromMethod,
boolean includeHeaders,
javax.servlet.http.HttpServletRequest request)
Build a String containing a short multi-line dump of an HTTP request.
|
static java.lang.String |
getShortRequestDump(java.lang.String fromMethod,
javax.servlet.http.HttpServletRequest request)
Build a String containing a very short multi-line dump of an HTTP request.
|
static java.lang.String |
maskPrivateToken(java.lang.String s)
Masks the PRIVATE-TOKEN header value with "********".
|
public static java.lang.String getShortRequestDump(java.lang.String fromMethod, javax.servlet.http.HttpServletRequest request)
fromMethod
- the method that this method was called fromrequest
- the HTTP request build the request dump frompublic static java.lang.String getShortRequestDump(java.lang.String fromMethod, boolean includeHeaders, javax.servlet.http.HttpServletRequest request)
fromMethod
- the method that this method was called fromrequest
- the HTTP request build the request dump fromincludeHeaders
- if true will include the HTTP headers in the dumppublic static java.lang.String getRequestDump(java.lang.String fromMethod, javax.servlet.http.HttpServletRequest request, boolean includePostData)
fromMethod
- the method that this method was called fromrequest
- the HTTP request build the request dump fromincludePostData
- if true will include the POST data in the dumppublic static java.lang.String getPostDataAsString(javax.servlet.http.HttpServletRequest request) throws java.io.IOException
request
- the HTTP request containing the POST datajava.io.IOException
- if any error occurs while reading the POST datapublic static java.lang.String getReaderContentAsString(java.io.Reader reader) throws java.io.IOException
reader
- the Reader instance to read the data fromjava.io.IOException
- if any error occurs while reading the POST datapublic static java.lang.String maskPrivateToken(java.lang.String s)
s
- a String containing HTTP request info, usually logging info