Class RemoteUrlPolicyState
@Remote call, for the duration of one
blocking RestRequest.run() (including any internal retries/redirect hops it triggers on the same
thread).
The classic engine shares a single CloseableHttpClient across every request the client issues, whether
@Remote-originated or an ordinary client.get(url) call. Since neither Apache HttpClient's
HttpClientConnectionManager.requestConnection SPI nor its RedirectStrategy SPI receives enough
information to distinguish which caller triggered a given connection lease or redirect decision, this thread-local
flag is set for the duration of exactly one @Remote invocation (which runs synchronously, blocking the
calling thread, per Juneau's classic-engine execution model). While it is set, the client's connection manager
leases connections from a dedicated pool whose connections are all opened through the
org.apache.juneau.http.remote.RemoteUrlPolicy pin, and its redirect strategy defers 3xx handling
to Juneau's revalidating redirect loop — leaving ordinary (non-@Remote) requests on the same client,
and their separate pool, completely unaffected.
The guard of the @Remote request itself also travels on the request's HttpContext, so it holds even
when the request is executed on another thread; this flag additionally guards any other request made on the calling
thread while the call runs.
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidactivate()Marks the calling thread as executing an SSRF-guard-active@Remotecall.static voidEnds oneactivate(); the calling thread's marker is cleared when the outermost guarded call ends.static booleanisActive()Returnstrueif the calling thread is currently executing an SSRF-guard-active@Remotecall.
-
Method Details
-
activate
Marks the calling thread as executing an SSRF-guard-active@Remotecall.Callers must invoke
deactivate()in afinallyblock once the call (including any retries) has completed. Calls nest: the thread stays marked until everyactivate()has been matched by adeactivate(), so a guarded call made while another one is running does not end the outer call's guard. -
deactivate
Ends oneactivate(); the calling thread's marker is cleared when the outermost guarded call ends. -
isActive
Returnstrueif the calling thread is currently executing an SSRF-guard-active@Remotecall.- Returns:
trueif the guard is active on this thread.
-