org.glassfish.jersey.client.filter
Class HttpBasicAuthFilter

java.lang.Object
  extended by org.glassfish.jersey.client.filter.HttpBasicAuthFilter
All Implemented Interfaces:
ClientRequestFilter

public final class HttpBasicAuthFilter
extends java.lang.Object
implements ClientRequestFilter

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

Author:
Jakub Podlesak (jakub.podlesak at oracle.com), Craig McClanahan

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
 void filter(ClientRequestContext rc)
          Filter method called before a request has been dispatched to a client transport layer.
 
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,
                           java.lang.String password)
Creates a new HTTP Basic Authentication filter using provided username and password credentials.

Parameters:
username - user name
password - password

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 - user name
password - password
Method Detail

filter

public void filter(ClientRequestContext rc)
            throws java.io.IOException
Description copied from interface: ClientRequestFilter
Filter method called before a request has been dispatched to a client transport layer. Filters in the filter chain are ordered according to their priority (see Priority).

Specified by:
filter in interface ClientRequestFilter
Parameters:
rc - request context.
Throws:
java.io.IOException - if an I/O exception occurs.


Copyright © 2007-2013 Oracle Corporation. All Rights Reserved. Use is subject to license terms.