public class HTTPRequestHeader
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
boolean |
addOrReplaceHeaderField(java.lang.String fieldName,
java.lang.String fieldValue)
Add or replace a HTTP header field.
|
void |
dumpToStdout()
Dump the HTTP request header to stdout.
|
java.lang.String |
getAsString()
Get the full HTTP request header as a single string.
|
HTTPContentType |
getContentType()
Get all parts of the HTTP header field "Content-Type".
|
java.lang.String |
getFirstRequestLine()
Get the first line of the HTTP request header.
|
java.lang.String |
getHeaderField(java.lang.String fieldName)
Get the value of a HTTP header field.
|
java.util.ArrayList<HTTPHeaderField> |
getHeaderFieldList()
Get a list of all HTTP header fields.
|
java.util.ArrayList<java.lang.String> |
getHeaderFields()
Get all HTTP header fields.
|
long |
getHeaderSendTimeMillis()
Get the elapsed time duration for sending the HTTP request header.
|
int |
getHeaderSize()
Get the size of the HTTP request header.
|
java.lang.String |
getHttpRequestMethod()
Get the HTTP request method.
|
long |
getStartHeaderSendTimestamp()
Get the timestamp of the start of sending the HTTP request header.
|
java.lang.String |
getSyntheticHeaderFields()
Get all HTTP request header fields as a single string (without the first line of the HTTP request header).
|
boolean |
hasHeaderField(java.lang.String fieldName)
Get if a HTTP header field exists.
|
boolean |
removeHeaderField(java.lang.String fieldName)
Remove a HTTP header field.
|
void |
replaceParseUrl(ParseURL replaceParseURL)
For HTTP Client debugger only! Completely replace the parsed URL by a new one.
|
void |
setHeaderFieldList(java.util.ArrayList<HTTPHeaderField> headerFieldList)
Set (replace) the list of all HTTP header fields.
|
void |
setHeaderFields(java.util.ArrayList<java.lang.String> headerFields)
Set (replace) all HTTP header fields.
|
void |
setSyntheticHeaderFields(java.lang.String syntheticHeaderFields)
Set (replace) all HTTP request header fields (without the first line of the HTTP request header).
|
JsonObject |
toJsonObject()
Get a JSON object of this instance (first header line, array of header fields and content type).
|
boolean |
updateOriginHeaderField(java.lang.String oldUrl,
java.lang.String newUrl)
Update the 'Origin' header field in case if the protocol, or host, or port of the URL has changed.
|
public java.lang.String getAsString()
public java.lang.String getSyntheticHeaderFields()
setSyntheticHeaderFields(String)
public void setSyntheticHeaderFields(java.lang.String syntheticHeaderFields)
syntheticHeaderFields
- all HTTP request header fields as a single string (without the first line of the HTTP request header)getSyntheticHeaderFields()
public boolean addOrReplaceHeaderField(java.lang.String fieldName, java.lang.String fieldValue)
fieldName
- the header field namefieldValue
- the header field valuepublic boolean updateOriginHeaderField(java.lang.String oldUrl, java.lang.String newUrl) throws java.net.MalformedURLException
oldUrl
- the old URLnewUrl
- the new URLjava.net.MalformedURLException
- if the old URL or the new URL is invalidpublic boolean hasHeaderField(java.lang.String fieldName)
fieldName
- the header field namepublic boolean removeHeaderField(java.lang.String fieldName)
fieldName
- the header field namepublic java.lang.String getHeaderField(java.lang.String fieldName)
fieldName
- the header field namepublic int getHeaderSize()
public java.lang.String getHttpRequestMethod()
public java.lang.String getFirstRequestLine()
public void replaceParseUrl(ParseURL replaceParseURL)
replaceParseURL
- the new parsed URLpublic java.util.ArrayList<HTTPHeaderField> getHeaderFieldList()
public void setHeaderFieldList(java.util.ArrayList<HTTPHeaderField> headerFieldList)
headerFieldList
- the list of all HTTP header fieldspublic java.util.ArrayList<java.lang.String> getHeaderFields()
public void setHeaderFields(java.util.ArrayList<java.lang.String> headerFields)
headerFields
- An array list of all HTTP header fieldsjava.lang.IllegalArgumentException
- if one or multiple HTTP header fields have an invalid formatpublic HTTPContentType getContentType()
public long getStartHeaderSendTimestamp()
public long getHeaderSendTimeMillis()
public void dumpToStdout() throws java.io.IOException
java.io.IOException
- if somewhat failspublic JsonObject toJsonObject()