Package com.sun.jersey.api.client.filter

Examples of com.sun.jersey.api.client.filter.ClientFilter


    }

    this.ambariWebResource = client.resource(url);

    //Install auth filters
    ClientFilter csrfFilter = new CsrfProtectionFilter("RequestSchedule");
    ClientFilter tokenFilter = new InternalTokenClientFilter(tokenStorage);
    ambariClient.addFilter(csrfFilter);
    ambariClient.addFilter(tokenFilter);

  }
View Full Code Here


*/
public class FilterTest extends TestCase {

    public void testAddRemoveOneFilter() {
        Client client = Client.create();
        ClientFilter filter = new ClientFilter() {

            @Override
            public ClientResponse handle(ClientRequest cr)
                    throws ClientHandlerException {
                return getNext().handle(cr);
View Full Code Here

        assertFalse(client.isFilterPreset(filter));
    }

    public void testAddRemoveMultipleFilters() {
        Client client = Client.create();
        ClientFilter filterOne = new ClientFilter() {

            @Override
            public ClientResponse handle(ClientRequest cr)
                    throws ClientHandlerException {
                return getNext().handle(cr);
            }
        };
        ClientFilter filterTwo = new ClientFilter() {

            @Override
            public ClientResponse handle(ClientRequest cr)
                    throws ClientHandlerException {
                return getNext().handle(cr);
View Full Code Here

    this.ambariClient = client;
    this.ambariWebResource = client.resource(url);

    //Install auth filters
    ClientFilter csrfFilter = new CsrfProtectionFilter("RequestSchedule");
    ClientFilter tokenFilter = new InternalTokenClientFilter(tokenStorage);
    ambariClient.addFilter(csrfFilter);
    ambariClient.addFilter(tokenFilter);

  }
View Full Code Here

    return builder;
  }

  private void addAuthentication( Client client ) {
    for( AuthenticationInfo authentication : authentications ) {
      ClientFilter filter = null;
      if( authentication.getType().equals( AuthenticationType.BASIC ) ) {
        filter = new HTTPBasicAuthFilter( authentication.getUser(), authentication.getPassword() );
      } else if( authentication.getType().equals( AuthenticationType.DIGEST ) ) {
        filter = new HTTPDigestAuthFilter( authentication.getUser(), authentication.getPassword() );
      }
View Full Code Here

  protected NexusClient createNexusClientForRemoteHeader(final String headerName,
                                                         final String headerValue)
  {
    final NexusClient nexusClient = createNexusClientForAnonymous(nexus());
    ((JerseyNexusClient) nexusClient).getClient().addFilter(new ClientFilter()
    {
      @Override
      public ClientResponse handle(final ClientRequest clientRequest) throws ClientHandlerException {
        clientRequest.getHeaders().putSingle(headerName, headerValue);
        return getNext().handle(clientRequest);
View Full Code Here

    return Client.create( config );
  }

  private void addAuthentication( Client client ) {
    for( AuthenticationInfo authentication : authentications ) {
      ClientFilter filter = null;
      if( authentication.getType().equals( AuthenticationType.BASIC ) ) {
        filter = new HTTPBasicAuthFilter( authentication.getUser(), authentication.getPassword() );
      } else if( authentication.getType().equals( AuthenticationType.DIGEST ) ) {
        filter = new HTTPDigestAuthFilter( authentication.getUser(), authentication.getPassword() );
      }
View Full Code Here

    Client client = ApacheHttpClient4.create(clientConfig);
    client.setConnectTimeout(config.getTimeout());
    client.setReadTimeout(config.getTimeout());
    client.addFilter(new HTTPBasicAuthFilter(config.getUsername(), config
        .getPassword()));
    client.addFilter(new ClientFilter() {
      @Override
      public ClientResponse handle(ClientRequest request)
          throws ClientHandlerException {
        request.getHeaders().add(HttpHeaders.USER_AGENT,
            config.getUserAgent());
View Full Code Here

        }
        return props;
    }

    public void install(Client client) {
        client.addFilter(new ClientFilter() {
            @Override
            public ClientResponse handle(ClientRequest cr) throws ClientHandlerException {
                cr.getHeaders().add("User-Agent", userAgent);
                return getNext().handle(cr);
            }
View Full Code Here

        String type = parts[0].trim();
        String userName = parts[1].trim();

        String password = Preconditions.checkNotNull(users.get(userName), "Realm user not found: " + userName);

        ClientFilter filter;
        if ( type.equals("basic") )
        {
            filter = new HTTPBasicAuthFilter(userName, password);
        }
        else if ( type.equals("digest") )
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.filter.ClientFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.