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

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


    }

    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 {
View Full Code Here


     * @param password The password.
     * @return The authentication token.
     */
    public String login(String username, String password) {
        WebResource resource = client.getClient().resource(client.uriBuilder("/login").build());
        resource.addFilter(new HTTPBasicAuthFilter(username, password));
        ClientResponse response = resource.get(ClientResponse.class);
        response.close();
        return client.getAuthToken();
    }
View Full Code Here

     * @param password The password.
     * @return The authentication token.
     */
    public String login(String username, String password) {
        WebResource resource = client.getClient().resource(client.uriBuilder("/login").build());
        resource.addFilter(new HTTPBasicAuthFilter(username, password));
        ClientResponse response = resource.get(ClientResponse.class);
        response.close();
        return client.getAuthToken();
    }
View Full Code Here

   * @param apiKey API Key for your user account. See https://appthwack/user/profile.
   * @return fully configured client object.
   */
  private Client getClient(String apiKey) {
    client = Client.create(getClientConfig());
    client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
    return client;
  }
View Full Code Here

  public void createServer() throws URISyntaxException {
    URI currentUri = getServerUri();
    serverURI = currentUri;

    @Nullable HTTPBasicAuthFilter authFilter = getAuthFilter( );
    this.server = new CouchServer( currentUri, authFilter );
  }
View Full Code Here

    if ( username == null || password == null ) {
      return null;
    }

    return new HTTPBasicAuthFilter( username, password );
  }
View Full Code Here

    ClientFilter[] filters;
    @Nullable String username = getUsername();
    @Nullable String password = getPassword();
    if ( username != null && password != null ) {
      filters = new ClientFilter[]{new HTTPBasicAuthFilter( username, password )};
    } else {
      filters = new ClientFilter[0];
    }

    return new CouchDatabase( uri, dbName, filters );
View Full Code Here

    }

    protected void addAuthFilter(String username, String password) {
        if (username == null) return;
        client.addFilter( new HTTPBasicAuthFilter( username, password ) );
    }
View Full Code Here

  }

  public void before() throws IOException, URISyntaxException, CouchDbException {
    client = ApacheHttpClient4.create();

    @Nullable HTTPBasicAuthFilter authFilter = getAuthFilter( );
    if ( authFilter != null ) {
      assert client != null;
      client.addFilter( authFilter );
    }
View Full Code Here

    if ( username == null || password == null ) {
      throw new IllegalStateException( "You need both password *and* user name" );
    }

    return new HTTPBasicAuthFilter( username, password );
  }
View Full Code Here

TOP

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

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.