类 BasicAuthenticationInterceptor
java.lang.Object
cn.taketoday.http.client.support.BasicAuthenticationInterceptor
- 所有已实现的接口:
ClientHttpRequestInterceptor
ClientHttpRequestInterceptor to apply a given HTTP Basic Authentication
username/password pair, unless a custom Authorization header has
already been set.- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller, Sam Brannen
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器构造器说明BasicAuthenticationInterceptor(String username, String password) Create a new interceptor which adds Basic Authentication for the given username and password.BasicAuthenticationInterceptor(String username, String password, Charset charset) Create a new interceptor which adds Basic Authentication for the given username and password, encoded using the specified charset. -
方法概要
修饰符和类型方法说明intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) Intercept the given request, and return a response.
-
字段详细资料
-
encodedCredentials
-
-
构造器详细资料
-
BasicAuthenticationInterceptor
Create a new interceptor which adds Basic Authentication for the given username and password.- 参数:
username- the username to usepassword- the password to use- 另请参阅:
-
BasicAuthenticationInterceptor
Create a new interceptor which adds Basic Authentication for the given username and password, encoded using the specified charset.- 参数:
username- the username to usepassword- the password to usecharset- the charset to use- 另请参阅:
-
-
方法详细资料
-
intercept
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException 从接口复制的说明:ClientHttpRequestInterceptorIntercept the given request, and return a response. The givenClientHttpRequestExecutionallows the interceptor to pass on the request and response to the next entity in the chain.A typical implementation of this method would follow the following pattern:
- Examine the request and body.
- Optionally wrap the request to filter HTTP attributes.
- Optionally modify the body of the request.
- Either
- execute the request using
ClientHttpRequestExecution.execute(cn.taketoday.http.HttpRequest, byte[]), - or
- do not execute the request to block the execution altogether.
- Optionally wrap the response to filter HTTP attributes.
- 指定者:
intercept在接口中ClientHttpRequestInterceptor- 参数:
request- the request, containing method, URI, and headersbody- the body of the requestexecution- the request execution- 返回:
- the response
- 抛出:
IOException- in case of I/O errors
-