com.sun.jersey.api.client.filter
Class HTTPBasicAuthFilter

java.lang.Object
  extended by com.sun.jersey.api.client.filter.ClientFilter
      extended by com.sun.jersey.api.client.filter.HTTPBasicAuthFilter
All Implemented Interfaces:
ClientHandler

public final class HTTPBasicAuthFilter
extends ClientFilter

Client filter adding HTTP Basic Authentication header to the HTTP request, if no such header is already present

Author:
Jakub.Podlesak@Sun.COM, Craig.McClanahan@Sun.COM

Constructor Summary
HTTPBasicAuthFilter(java.lang.String username, byte[] password)
          Creates a new HTTP Basic Authentication filter using provided username and password credentials.
HTTPBasicAuthFilter(java.lang.String username, java.lang.String password)
          Creates a new HTTP Basic Authentication filter using provided username and password credentials.
 
Method Summary
 ClientResponse handle(ClientRequest cr)
          Handle a HTTP request as a ClientRequest and return the HTTP response as a ClientResponse.
 
Methods inherited from class com.sun.jersey.api.client.filter.ClientFilter
getNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPBasicAuthFilter

public HTTPBasicAuthFilter(java.lang.String username,
                           byte[] password)
Creates a new HTTP Basic Authentication filter using provided username and password credentials. This constructor allows you to avoid storing plain password value in a String variable.

Parameters:
username -
password -

HTTPBasicAuthFilter

public HTTPBasicAuthFilter(java.lang.String username,
                           java.lang.String password)
Creates a new HTTP Basic Authentication filter using provided username and password credentials.

Parameters:
username -
password -
Method Detail

handle

public ClientResponse handle(ClientRequest cr)
                      throws ClientHandlerException
Description copied from interface: ClientHandler
Handle a HTTP request as a ClientRequest and return the HTTP response as a ClientResponse.

Specified by:
handle in interface ClientHandler
Specified by:
handle in class ClientFilter
Parameters:
cr - the HTTP request.
Returns:
the HTTP response.
Throws:
ClientHandlerException - if the client handler fails to process the request or response.


Copyright © 2013 Oracle Corporation. All Rights Reserved.