public final class BasicAuthentication extends Objectimplements HttpRequestInitializer , HttpExecuteInterceptor
Implementation is immutable and thread-safe. It can be used as either an HTTP request initializer or an HTTP request execute interceptor. initialize(HttpRequest) only sets itself as the interceptor. Authentication is actually done in intercept(HttpRequest), which is implemented using HttpHeaders.
| Constructor and Description |
|---|
BasicAuthentication(String
|
| Modifier and Type | Method and Description |
|---|---|
String |
getPassword()
Returns the password.
|
String |
getUsername()
Returns the username.
|
void |
initialize(HttpRequest
Initializes a request.
|
void |
intercept(HttpRequest
Invoked at the start of
HttpRequest before executing the HTTP request.
|
public void initialize(HttpRequestrequest) throws IOException
HttpRequestInitializer
initialize in interface
HttpRequestInitializer
request - HTTP request
IOException
public void intercept(HttpRequestrequest) throws IOException
HttpExecuteInterceptor
HttpRequest.execute() before executing the HTTP request.
intercept in interface
HttpExecuteInterceptor
IOException
public StringgetUsername()
public StringgetPassword()