Send feedback
Class HttpRequest.Builder (3.10.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version 3.10.0 keyboard_arrow_down
public static final class HttpRequest . Builder
A builder for HttpRequest
objects.
Methods
build()
public HttpRequest build ()
Creates a HttpRequest
object for this builder.
Returns
setCacheFillBytes(long cacheFillBytes)
public HttpRequest . Builder setCacheFillBytes ( long cacheFillBytes )
Sets the number of HTTP response bytes inserted into cache. Set only when a cache fill was
attempted.
Parameter
Name Description cacheFillBytes long
Returns
setCacheHit(boolean cacheHit)
public HttpRequest . Builder setCacheHit ( boolean cacheHit )
Sets whether or not an entity was served from cache (with or without validation). If not set,
false
is used.
Parameter
Returns
setCacheLookup(boolean cacheLookup)
public HttpRequest . Builder setCacheLookup ( boolean cacheLookup )
Sets whether or not a cache lookup was attempted. If not set, false
is used.
Parameter
Returns
setCacheValidatedWithOriginServer(boolean cacheValidatedWithOriginServer)
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 if #setCacheHit(boolean) is set to
true
. If not set, false
is used.
Parameter
Name Description cacheValidatedWithOriginServer boolean
Returns
setLatency(Duration latency)
public HttpRequest . Builder setLatency ( Duration latency )
Sets the latency on the server, from the time the request was received until the response was
sent.
Parameter
Name Description latency org.threeten.bp.Duration
Returns
setReferer(String referer)
public HttpRequest . Builder setReferer ( String referer )
Parameter
Returns
setRemoteIp(String remoteIp)
public HttpRequest . Builder setRemoteIp ( String remoteIp )
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
.
Parameter
Returns
setRequestMethod(HttpRequest.RequestMethod requestMethod)
public HttpRequest . Builder setRequestMethod ( HttpRequest . RequestMethod requestMethod )
Sets the HTTP request method.
Parameter
Returns
setRequestSize(long requestSize)
public HttpRequest . Builder setRequestSize ( long requestSize )
Sets the size of the HTTP request message in bytes, including the request headers and the
request body.
Parameter
Name Description requestSize long
Returns
setRequestUrl(String requestUrl)
public HttpRequest . Builder setRequestUrl ( String requestUrl )
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
.
Parameter
Name Description requestUrl String
Returns
setResponseSize(long responseSize)
public HttpRequest . Builder 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.
Parameter
Name Description responseSize long
Returns
setServerIp(String serverIp)
public HttpRequest . Builder setServerIp ( String serverIp )
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
.
Parameter
Returns
setStatus(int status)
public HttpRequest . Builder setStatus ( int status )
Sets the response code indicating the status of response.
Parameter
Returns
setUserAgent(String userAgent)
public HttpRequest . Builder setUserAgent ( String userAgent )
Sets the user agent sent by the client. Example: Mozilla/4.0 (compatible; MSIE 6.0;
Windows 98; Q312461; .NET CLR 1.0.3705)
.
Parameter
Name Description userAgent String
Returns
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-05 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-05 UTC."],[],[]]