Module bus.http

Class BridgeInterceptor

java.lang.Object
org.miaixz.bus.http.metric.http.BridgeInterceptor
All Implemented Interfaces:
Interceptor

public final class BridgeInterceptor extends Object implements Interceptor
Bridges from application code to network code. First, it builds a network request from a user request. Then it proceeds to call the network. Finally, it builds a user response from the network response.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • BridgeInterceptor

      public BridgeInterceptor(CookieJar cookieJar)
      Constructs a new BridgeInterceptor.
      Parameters:
      cookieJar - The cookie jar to use for cookie management.
  • Method Details

    • intercept

      public Response intercept(NewChain chain) throws IOException
      Intercepts the request to add necessary headers, handle cookies, and manage content encoding.
      Specified by:
      intercept in interface Interceptor
      Parameters:
      chain - The interceptor chain.
      Returns:
      The response from the server, potentially with modifications (e.g., decompression).
      Throws:
      IOException - if an I/O error occurs during the network call.