Package com.google.cloud.logging
Class HttpRequest.Builder
java.lang.Object
com.google.cloud.logging.HttpRequest.Builder
- Enclosing class:
- HttpRequest
A builder for
HttpRequest
objects.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates aHttpRequest
object for this builder.setCacheFillBytes
(long cacheFillBytes) Sets the number of HTTP response bytes inserted into cache.setCacheHit
(boolean cacheHit) Sets whether or not an entity was served from cache (with or without validation).setCacheLookup
(boolean cacheLookup) Sets whether or not a cache lookup was attempted.setCacheValidatedWithOriginServer
(boolean cacheValidatedWithOriginServer) Sets whether or not the response was validated with the origin server before being served from cache.setLatency
(org.threeten.bp.Duration latency) Sets the latency on the server, from the time the request was received until the response was sent.setReferer
(String referer) Sets the referer URL of the request, as defined in HTTP/1.1 Header Field Definitions.setRemoteIp
(String remoteIp) Sets the IP address (IPv4 or IPv6) of the client that issued the HTTP request.setRequestMethod
(HttpRequest.RequestMethod requestMethod) Sets the HTTP request method.setRequestSize
(long requestSize) Sets the size of the HTTP request message in bytes, including the request headers and the request body.setRequestUrl
(String requestUrl) Sets the requested URL.setResponseSize
(long responseSize) Sets the size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.setServerIp
(String serverIp) Sets the IP address (IPv4 or IPv6) of the origin server that the request was sent to.setStatus
(int status) Sets the response code indicating the status of response.setUserAgent
(String userAgent) Sets the user agent sent by the client.
-
Method Details
-
setRequestMethod
@CanIgnoreReturnValue public HttpRequest.Builder setRequestMethod(HttpRequest.RequestMethod requestMethod) Sets the HTTP request method. -
setRequestUrl
Sets 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
. -
setRequestSize
Sets the size of the HTTP request message in bytes, including the request headers and the request body. -
setStatus
Sets the response code indicating the status of response. -
setResponseSize
Sets the size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body. -
setUserAgent
Sets the user agent sent by the client. Example:Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)
. -
setRemoteIp
Sets the IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples:192.168.1.1
,FE80::0202:B3FF:FE1E:8329
. -
setServerIp
Sets 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
. -
setReferer
Sets the referer URL of the request, as defined in HTTP/1.1 Header Field Definitions.- See Also:
-
setCacheLookup
Sets whether or not a cache lookup was attempted. If not set,false
is used. -
setCacheHit
Sets whether or not an entity was served from cache (with or without validation). If not set,false
is used. -
setCacheValidatedWithOriginServer
@CanIgnoreReturnValue public HttpRequest.Builder setCacheValidatedWithOriginServer(boolean cacheValidatedWithOriginServer) Sets whether or not the response was validated with the origin server before being served from cache. This field is only meaningful ifsetCacheHit(boolean)
is set totrue
. If not set,false
is used. -
setCacheFillBytes
Sets the number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted. -
setLatency
Sets the latency on the server, from the time the request was received until the response was sent. -
build
Creates aHttpRequest
object for this builder.
-