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 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(String username, byte[] password)
          Creates a new HTTP Basic Authentication filter using provided username and password credentials.
HttpBasicAuthFilter(String username, 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(String username,
                           String password)
Creates a new HTTP Basic Authentication filter using provided username and password credentials.

Parameters:
username - user name
password - password

HttpBasicAuthFilter

public HttpBasicAuthFilter(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 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 javax.annotation.Priority class-level annotation value.

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


Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.