Package io.muserver.murp
Interface RequestInterceptor
-
public interface RequestInterceptorA hook for intercepting requests before they are sent to the target server.- Version:
- 1.0
- Author:
- Daniel Flower
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidintercept(io.muserver.MuRequest clientRequest, java.net.http.HttpRequest.Builder targetRequestBuilder)This function is called after Murp prepared the request object to the target server, but before it is sent, allowing you to modify request headers.
-
-
-
Method Detail
-
intercept
void intercept(io.muserver.MuRequest clientRequest, java.net.http.HttpRequest.Builder targetRequestBuilder) throws java.lang.ExceptionThis function is called after Murp prepared the request object to the target server, but before it is sent, allowing you to modify request headers.Note that the request body is not available for inspection and cannot be changed as the raw bytes will be streamed asynchronously to the target.
- Parameters:
clientRequest- The original request from the client. Note that changing anything here has no effect, however if you want to pass data from here to aResponseInterceptoryou can useMuRequest.attribute(String, Object)to store state.targetRequestBuilder- the request builder for intercepting the request which sending to target server.- Throws:
java.lang.Exception- Any unhandled exceptions will cause 500 errors
-
-