public class HttpRequest extends Object
| Constructor and Description |
|---|
HttpRequest(InputStream inputStream) |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
getBodyAsStream()
This returns the body of the request as a stream
Please note it is the user needs to close this stream if connection is to be reused
|
long |
getContentLength() |
String |
getHeader(String headerName)
This returns an HTTP header by name, if there are more then one header with this name, the first one will be
returned, if header with this name does not exist, null is returned.
|
HttpRequestHeaders |
getHeaders() |
List<String> |
getHeaders(String headerName)
This returns headers by name, if there are more then one header with this name, all of them will be returned, if
headers with this name don't exist, an empty list is returned The name is not case-sensitive.
|
String |
getHost() |
String |
getMethod() |
URL |
getUrl() |
String |
getVersion() |
boolean |
hasMultipartBody() |
boolean |
isBodyCompressed() |
boolean |
isContentChunked() |
byte[] |
readBodyAsBytes()
This reads the body of the request and returns it as an array of bytes
|
String |
readBodyAsString()
This reads the body of the request and returns it as a string
|
RequestValues |
readBodyAsValues()
This reads the body of the request and parses it assuming it contains HTML Form data
|
String |
toString() |
public HttpRequest(InputStream inputStream) throws IOException
IOExceptionpublic String getMethod()
public URL getUrl()
public String getVersion()
public String getHost()
public long getContentLength()
public boolean isContentChunked()
public boolean hasMultipartBody()
public String getHeader(String headerName)
public List<String> getHeaders(String headerName)
public String readBodyAsString() throws IOException
IOExceptionpublic byte[] readBodyAsBytes()
throws IOException
IOExceptionpublic RequestValues readBodyAsValues() throws IOException
IOExceptionpublic InputStream getBodyAsStream()
public HttpRequestHeaders getHeaders()
public boolean isBodyCompressed()
Copyright © 2019. All rights reserved.