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:
  • Field Details

  • Method Details

    • 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:
    • cacheLookup

      public boolean cacheLookup()
      Returns whether or not a cache lookup was attempted. If not set, this method returns false.
    • cacheHit

      public boolean cacheHit()
      Returns whether or not an entity was served from cache (with or without validation). If not set, this method returns false.
    • 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 returns false. This field is only meaningful if cacheHit() is set to true.
    • 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.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toBuilder

      public HttpRequest.Builder toBuilder()
      Returns a builder for this object.
    • newBuilder

      public static HttpRequest.Builder newBuilder()
      Returns a builder for HttpRequest objects.