Class TransportRequest
All values (URIs, headers, bodies) are evaluated before this object is constructed — suppliers have been
invoked, null-valued parts have been filtered, and the final URI has been assembled with query
parameters and path substitutions applied.
Transport implementations receive a TransportRequest and are responsible for executing it against
the remote server, returning a TransportResponse.
- Since:
- 9.2.1
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic TransportRequest.Builderbuilder()Returns a newTransportRequest.Builder.Returns the per-client special-purpose address ranges that the SSRF guardrail re-permits for this request (seeRestClient.Builder.allowAddressRanges(String...)); they are unioned with the "RestClient.allowAddressRanges" system property.getBody()Returns the request body, ornullif this is a body-less request (e.g.getFirstHeader(String name) Returns the first header with the given name (case-insensitive), ornullif absent.Returns all request headers in the order they should be sent.Returns the HTTP method (e.g.Returns the per-call response timeout, ornullif none was set.getUri()Returns the fully-resolved request URI, including query string.booleanReturnstrueif theallowPrivateUrlsopt-in is in effect for this request, disabling the deny-private / pin-on-connect / redirect-revalidation checks (thehttp/httpsscheme requirement still applies upstream).booleanReturnstrueif this request originated from a@Remote/@Urlcall and is subject to the SSRF guardrail (seeorg.apache.juneau.http.remote.RemoteUrlPolicy).booleanReturnstrueif this request can be transparently re-sent once after a stale-connection failure.booleanReturnstrueif the SSRF guardrail's connect-time machinery (pin-on-connect + Juneau-controlled redirect revalidation) must be applied by the transport for this request:isPolicyEnforced()is set andisAllowPrivateUrls()is not.
-
Method Details
-
builder
Returns a newTransportRequest.Builder. -
getMethod
Returns the HTTP method (e.g."GET","POST").- Returns:
- The method. Never
null .
-
getUri
Returns the fully-resolved request URI, including query string.- Returns:
- The URI. Never
null .
-
getHeaders
Returns all request headers in the order they should be sent.- Returns:
- An unmodifiable list. Never
null .
-
getFirstHeader
Returns the first header with the given name (case-insensitive), ornullif absent.- Parameters:
name- The header name. Must not benull .- Returns:
- The first matching header, or
null if absent.
-
getBody
Returns the request body, ornullif this is a body-less request (e.g. GET, HEAD).- Returns:
- The body, possibly
null .
-
isSafeToReplay
Returnstrueif this request can be transparently re-sent once after a stale-connection failure.A pooled keep-alive socket can be torn down by the server between requests; when a transport then reuses that socket the first write fails before any response is received (e.g. an early
EOFor aNoHttpResponseException). Such a failure is safe to retry on a fresh connection only when replaying the request cannot cause a duplicate side effect, which requires both of:- an idempotent
HTTP method (
GET,HEAD,PUT,DELETE,OPTIONS,TRACE) — neverPOSTor any other non-idempotent method, and - a body that is either absent or
repeatable, so the exact same bytes can be written again.
When in doubt this returns
false— the caller must fail closed rather than risk double-executing a request.- Returns:
trueif the request is provably safe to replay once.
- an idempotent
HTTP method (
-
getTimeout
Returns the per-call response timeout, ornullif none was set.A
nullvalue means the transport's own default applies. Connect timeouts remain a client-level concern. All built-in transports honor this value (JDK, Apache HttpClient 4.5/5, OkHttp, Jetty and the mock transport).- Returns:
- The response timeout, possibly
null .
-
isPolicyEnforced
Returnstrueif this request originated from a@Remote/@Urlcall and is subject to the SSRF guardrail (seeorg.apache.juneau.http.remote.RemoteUrlPolicy).Ordinary (non-
@Remote) requests built directly viaRestClient.get(url)etc. are never policy-covered.- Returns:
trueif the SSRF guardrail applies to this request.
-
isAllowPrivateUrls
Returnstrueif theallowPrivateUrlsopt-in is in effect for this request, disabling the deny-private / pin-on-connect / redirect-revalidation checks (thehttp/httpsscheme requirement still applies upstream).- Returns:
trueif private/loopback/link-local/metadata targets are allowed for this request.
-
getAllowedAddressRanges
Returns the per-client special-purpose address ranges that the SSRF guardrail re-permits for this request (seeRestClient.Builder.allowAddressRanges(String...)); they are unioned with the "RestClient.allowAddressRanges" system property.- Returns:
- The allowed ranges. Never
null ;RemoteUrlPolicy.AllowedRanges#NONEby default.
-
isSsrfGuardActive
Returnstrueif the SSRF guardrail's connect-time machinery (pin-on-connect + Juneau-controlled redirect revalidation) must be applied by the transport for this request:isPolicyEnforced()is set andisAllowPrivateUrls()is not.- Returns:
trueif the transport must pin-on-connect and manually revalidate redirects for this request.
-