- All Known Implementing Classes:
RealInterceptorChain
public interface NewChain
A chain of interceptors that can process an HTTP request and response.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
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.Proceeds with the request to the next interceptor in the chain.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.
-
Method Details
-
request
Request request()Returns the request currently being processed.- Returns:
- The network request.
-
proceed
Proceeds with the request to the next interceptor in the chain.- Parameters:
request- The network request.- Returns:
- The response from the next interceptor.
- Throws:
IOException- if an I/O error occurs.
-
connection
Connection connection()Returns 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.- Returns:
- The connection information.
-
call
NewCall call()Returns the actual call that is ready to execute the request.- Returns:
- The
NewCallinstance.
-
connectTimeoutMillis
int connectTimeoutMillis()Returns the connect timeout in milliseconds.- Returns:
- The connect timeout in milliseconds.
-
withConnectTimeout
Sets the connect timeout for this chain.- Parameters:
timeout- The timeout value.unit- The time unit.- Returns:
- This
NewChaininstance.
-
readTimeoutMillis
int readTimeoutMillis()Returns the read timeout in milliseconds.- Returns:
- The read timeout in milliseconds.
-
withReadTimeout
Configures the read timeout for this chain.- Parameters:
timeout- The timeout value.unit- The time unit.- Returns:
- This
NewChaininstance.
-
writeTimeoutMillis
int writeTimeoutMillis()Returns the write timeout in milliseconds.- Returns:
- The write timeout in milliseconds.
-
withWriteTimeout
Configures the write timeout for this chain.- Parameters:
timeout- The timeout value.unit- The time unit.- Returns:
- This
NewChaininstance.
-