public final class HttpRequest extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
HttpRequest.Builder
A builder for
HttpRequest objects. |
static class |
HttpRequest.RequestMethod
The HTTP request method.
|
Modifier and Type | Field and Description |
---|---|
static HttpRequest |
EMPTY |
Modifier and Type | Method and Description |
---|---|
boolean |
cacheHit()
Returns whether or not an entity was served from cache (with or without validation).
|
boolean |
cacheLookup()
Returns whether or not a cache lookup was attempted.
|
boolean |
cacheValidatedWithOriginServer()
Returns whether or not the response was validated with the origin server before being served
from cache.
|
boolean |
equals(Object obj) |
Long |
getCacheFillBytes()
Returns the number of HTTP response bytes inserted into cache.
|
org.threeten.bp.Duration |
getLatency()
Returns the processing latency on the server, from the time the request was received until the
response was sent.
|
String |
getReferer()
Returns the referer URL of the request, as defined in HTTP/1.1 Header Field Definitions.
|
String |
getRemoteIp()
Returns the IP address (IPv4 or IPv6) of the client that issued the HTTP request.
|
HttpRequest.RequestMethod |
getRequestMethod()
Returns the HTTP request method.
|
Long |
getRequestSize()
Returns the size of the HTTP request message in bytes, including the request headers and the
request body.
|
String |
getRequestUrl()
Returns the requested URL.
|
Long |
getResponseSize()
Returns the size of the HTTP response message sent back to the client, in bytes, including the
response headers and the response body.
|
String |
getServerIp()
Returns the IP address (IPv4 or IPv6) of the origin server that the request was sent to.
|
Integer |
getStatus()
Returns the response code indicating the status of response.
|
String |
getUserAgent()
Returns the user agent sent by the client.
|
int |
hashCode() |
static HttpRequest.Builder |
newBuilder()
Returns a builder for
HttpRequest objects. |
HttpRequest.Builder |
toBuilder()
Returns a builder for this object.
|
String |
toString() |
public static final HttpRequest EMPTY
public HttpRequest.RequestMethod getRequestMethod()
public String getRequestUrl()
http
, https
), the
host name, the path and the query portion of the URL that was requested. Example: http://example.com/some/info?color=red
.public Long getRequestSize()
public Integer getStatus()
public Long getResponseSize()
public String getUserAgent()
Mozilla/4.0 (compatible; MSIE 6.0;
Windows 98; Q312461; .NET CLR 1.0.3705)
.public String getRemoteIp()
192.168.1.1
, FE80::0202:B3FF:FE1E:8329
.public String getServerIp()
192.168.1.1
, FE80::0202:B3FF:FE1E:8329
.public String getReferer()
public boolean cacheLookup()
false
.public boolean cacheHit()
false
.public boolean cacheValidatedWithOriginServer()
false
. This field is only meaningful if
cacheHit()
is set to true
.public Long getCacheFillBytes()
public org.threeten.bp.Duration getLatency()
public HttpRequest.Builder toBuilder()
public static HttpRequest.Builder newBuilder()
HttpRequest
objects.Copyright © 2023 Google LLC. All rights reserved.