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 classHttpRequest.BuilderA builder forHttpRequestobjects.static classHttpRequest.RequestMethodThe HTTP request method.
-
Field Summary
Fields Modifier and Type Field Description static HttpRequestEMPTY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancacheHit()Returns whether or not an entity was served from cache (with or without validation).booleancacheLookup()Returns whether or not a cache lookup was attempted.booleancacheValidatedWithOriginServer()Returns whether or not the response was validated with the origin server before being served from cache.booleanequals(Object obj)LonggetCacheFillBytes()Returns the number of HTTP response bytes inserted into cache.org.threeten.bp.DurationgetLatency()Returns the processing latency on the server, from the time the request was received until the response was sent.StringgetReferer()Returns the referer URL of the request, as defined in HTTP/1.1 Header Field Definitions.StringgetRemoteIp()Returns the IP address (IPv4 or IPv6) of the client that issued the HTTP request.HttpRequest.RequestMethodgetRequestMethod()Returns the HTTP request method.LonggetRequestSize()Returns the size of the HTTP request message in bytes, including the request headers and the request body.StringgetRequestUrl()Returns the requested URL.LonggetResponseSize()Returns the size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.StringgetServerIp()Returns the IP address (IPv4 or IPv6) of the origin server that the request was sent to.IntegergetStatus()Returns the response code indicating the status of response.StringgetUserAgent()Returns the user agent sent by the client.inthashCode()static HttpRequest.BuildernewBuilder()Returns a builder forHttpRequestobjects.HttpRequest.BuildertoBuilder()Returns a builder for this object.StringtoString()
-
-
-
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 forHttpRequestobjects.
-
-