public final class BasicAuthentication extends java.lang.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(java.lang.String username,
java.lang.String password) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getPassword()
Returns the password.
|
java.lang.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 BasicAuthentication(java.lang.String username,
java.lang.String password)
public void initialize(HttpRequest request) throws java.io.IOException
HttpRequestInitializerinitialize in interface HttpRequestInitializerrequest - HTTP requestjava.io.IOExceptionpublic void intercept(HttpRequest request) throws java.io.IOException
HttpExecuteInterceptorHttpRequest.execute() before executing the HTTP request.intercept in interface HttpExecuteInterceptorjava.io.IOExceptionpublic java.lang.String getUsername()
public java.lang.String getPassword()
Copyright © 2011-2018 Google. All Rights Reserved.