Package com.google.cloud.logging
Class HttpRequest
- java.lang.Object
-
- com.google.cloud.logging.HttpRequest
-
- All Implemented Interfaces:
Serializable
public final class HttpRequest extends Object implements Serializable
Objects of this class represent information about the (optional) HTTP request associated with a log entry.- See Also:
- Http Request, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HttpRequest.Builder
A builder forHttpRequest
objects.static class
HttpRequest.RequestMethod
The HTTP request method.
-
Field Summary
Fields Modifier and Type Field Description static HttpRequest
EMPTY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 forHttpRequest
objects.HttpRequest.Builder
toBuilder()
Returns a builder for this object.String
toString()
-
-
-
Field Detail
-
EMPTY
public static final HttpRequest EMPTY
-
-
Method Detail
-
getRequestMethod
public HttpRequest.RequestMethod getRequestMethod()
Returns the HTTP request method.
-
getRequestUrl
public String getRequestUrl()
Returns the requested URL. Request URL contains the scheme (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
.
-
getRequestSize
public Long getRequestSize()
Returns the size of the HTTP request message in bytes, including the request headers and the request body.
-
getStatus
public Integer getStatus()
Returns the response code indicating the status of response.
-
getResponseSize
public 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.
-
getUserAgent
public String getUserAgent()
Returns the user agent sent by the client. Example:Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)
.
-
getRemoteIp
public String getRemoteIp()
Returns the IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples:192.168.1.1
,FE80::0202:B3FF:FE1E:8329
.
-
getServerIp
public String getServerIp()
Returns the IP address (IPv4 or IPv6) of the origin server that the request was sent to. Examples:192.168.1.1
,FE80::0202:B3FF:FE1E:8329
.
-
getReferer
public String getReferer()
Returns the referer URL of the request, as defined in HTTP/1.1 Header Field Definitions.- See Also:
- HTTP/1.1 Header Field Definitions
-
cacheLookup
public boolean cacheLookup()
Returns whether or not a cache lookup was attempted. If not set, this method returnsfalse
.
-
cacheHit
public boolean cacheHit()
Returns whether or not an entity was served from cache (with or without validation). If not set, this method returnsfalse
.
-
cacheValidatedWithOriginServer
public boolean cacheValidatedWithOriginServer()
Returns whether or not the response was validated with the origin server before being served from cache. If not set, this method returnsfalse
. This field is only meaningful ifcacheHit()
is set totrue
.
-
getCacheFillBytes
public Long getCacheFillBytes()
Returns the number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted.
-
getLatency
public org.threeten.bp.Duration getLatency()
Returns the processing latency on the server, from the time the request was received until the response was sent.- Returns:
- the latency, for null if not populated.
-
toBuilder
public HttpRequest.Builder toBuilder()
Returns a builder for this object.
-
newBuilder
public static HttpRequest.Builder newBuilder()
Returns a builder forHttpRequest
objects.
-
-