public final class BasicAuthentication extends Object implements 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.setBasicAuthentication(String, String).
| Constructor and Description |
|---|
BasicAuthentication(String username,
String password) |
| Modifier and Type | Method and Description |
|---|---|
String |
getPassword()
Returns the password.
|
String |
getUsername()
Returns the username.
|
void |
initialize(HttpRequest request)
Initializes a request.
|
void |
intercept(HttpRequest request)
Invoked at the start of
HttpRequest.execute() before executing the HTTP request. |
public void initialize(HttpRequest request) throws IOException
HttpRequestInitializerinitialize in interface HttpRequestInitializerrequest - HTTP requestIOExceptionpublic void intercept(HttpRequest request) throws IOException
HttpExecuteInterceptorHttpRequest.execute() before executing the HTTP request.intercept in interface HttpExecuteInterceptorIOExceptionpublic String getUsername()
public String getPassword()
Copyright © 2011–2025 Google. All rights reserved.