java.lang.Object
org.miaixz.bus.http.metric.http.RealInterceptorChain
- All Implemented Interfaces:
NewChain
A concrete interceptor chain that carries the entire interceptor chain: all application interceptors, the Http core,
all network interceptors, and finally the network caller.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
ConstructorsConstructorDescriptionRealInterceptorChain(List<Interceptor> interceptors, Transmitter transmitter, Exchange exchange, int index, Request request, NewCall call, int connectTimeout, int readTimeout, int writeTimeout) -
Method Summary
Modifier and TypeMethodDescriptioncall()Returns the actual call that is ready to execute the request.Returns the connection that will be used to execute the request.intReturns the connect timeout in milliseconds.exchange()Proceeds with the request to the next interceptor in the chain.proceed(Request request, Transmitter transmitter, Exchange exchange) intReturns the read timeout in milliseconds.request()Returns the request currently being processed.withConnectTimeout(int timeout, TimeUnit unit) Sets the connect timeout for this chain.withReadTimeout(int timeout, TimeUnit unit) Configures the read timeout for this chain.withWriteTimeout(int timeout, TimeUnit unit) Configures the write timeout for this chain.intReturns the write timeout in milliseconds.
-
Constructor Details
-
RealInterceptorChain
public RealInterceptorChain(List<Interceptor> interceptors, Transmitter transmitter, Exchange exchange, int index, Request request, NewCall call, int connectTimeout, int readTimeout, int writeTimeout)
-
-
Method Details
-
connection
Description copied from interface:NewChainReturns the connection that will be used to execute the request. This is only available in the network interceptor chain; for application interceptors, this will always be null.- Specified by:
connectionin interfaceNewChain- Returns:
- The connection information.
-
connectTimeoutMillis
public int connectTimeoutMillis()Description copied from interface:NewChainReturns the connect timeout in milliseconds.- Specified by:
connectTimeoutMillisin interfaceNewChain- Returns:
- The connect timeout in milliseconds.
-
withConnectTimeout
Description copied from interface:NewChainSets the connect timeout for this chain.- Specified by:
withConnectTimeoutin interfaceNewChain- Parameters:
timeout- The timeout value.unit- The time unit.- Returns:
- This
NewChaininstance.
-
readTimeoutMillis
public int readTimeoutMillis()Description copied from interface:NewChainReturns the read timeout in milliseconds.- Specified by:
readTimeoutMillisin interfaceNewChain- Returns:
- The read timeout in milliseconds.
-
withReadTimeout
Description copied from interface:NewChainConfigures the read timeout for this chain.- Specified by:
withReadTimeoutin interfaceNewChain- Parameters:
timeout- The timeout value.unit- The time unit.- Returns:
- This
NewChaininstance.
-
writeTimeoutMillis
public int writeTimeoutMillis()Description copied from interface:NewChainReturns the write timeout in milliseconds.- Specified by:
writeTimeoutMillisin interfaceNewChain- Returns:
- The write timeout in milliseconds.
-
withWriteTimeout
Description copied from interface:NewChainConfigures the write timeout for this chain.- Specified by:
withWriteTimeoutin interfaceNewChain- Parameters:
timeout- The timeout value.unit- The time unit.- Returns:
- This
NewChaininstance.
-
transmitter
-
exchange
-
call
Description copied from interface:NewChainReturns the actual call that is ready to execute the request. -
request
Description copied from interface:NewChainReturns the request currently being processed. -
proceed
Description copied from interface:NewChainProceeds with the request to the next interceptor in the chain.- Specified by:
proceedin interfaceNewChain- Parameters:
request- The network request.- Returns:
- The response from the next interceptor.
- Throws:
IOException- if an I/O error occurs.
-
proceed
public Response proceed(Request request, Transmitter transmitter, Exchange exchange) throws IOException - Throws:
IOException
-