Package pl.gsmservice.gateway.utils
Interface Hook.BeforeRequest
-
- All Known Implementing Classes:
Hook.IdempotencyHook,Hooks
- Enclosing class:
- Hook
public static interface Hook.BeforeRequestSpecifies how a request is transformed before sending.
-
-
Field Summary
Fields Modifier and Type Field Description static Hook.BeforeRequestDEFAULTThe default action is to return the request untouched.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.net.http.HttpRequestbeforeRequest(Hook.BeforeRequestContext context, java.net.http.HttpRequest request)Transforms the givenHttpRequestbefore sending.
-
-
-
Field Detail
-
DEFAULT
static final Hook.BeforeRequest DEFAULT
The default action is to return the request untouched.
-
-
Method Detail
-
beforeRequest
java.net.http.HttpRequest beforeRequest(Hook.BeforeRequestContext context, java.net.http.HttpRequest request) throws java.lang.Exception
Transforms the givenHttpRequestbefore sending.Note that
HttpRequestis immutable. To modify the request you can useHttpRequest#newBuilder(HttpRequest, BiPredicate<String, String>)with JDK 16 and later (which will copy the request for modification in a builder). If that method is not available then useHelpers.copy(java.net.http.HttpRequest)(which also returns a builder).- Parameters:
context- context for the hook callrequest- request to be transformed- Returns:
- transformed request
- Throws:
java.lang.Exception- on error
-
-