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

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


     * @return HttpLowLevel object that is completely configured to use.
     */
    public static final HttpLowLevel instantiateBasic(@Nonnull final String url, @Nonnull final String userName, @Nonnull final String password, @Nullable final String token, @Nullable final String requestId)
    {
        final Client client = createClient();
        client.addFilter(new HTTPBasicAuthFilter(userName, password));
        if (token != null) {
            client.addFilter(new SodaTokenFilter(token));
        }
        if (requestId != null) {
            client.addFilter(new SodaRequestIdFilter(requestId));
View Full Code Here


            Logger.getLogger(WookieImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void publish(File widget) {
        HTTPBasicAuthFilter authFilter = new HTTPBasicAuthFilter(WOOKIE_USER,WOOKIE_PASS);
       
        ClientConfig clientConfig = new DefaultClientConfig();
        Client client = Client.create(clientConfig);       
        client.addFilter(authFilter);
        client.addFilter(new LoggingFilter());
View Full Code Here

            Logger.getLogger(OMR.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
   
    public List<OMRService> searchServicesByQuery(String query) throws XmlException, IOException {
        HTTPBasicAuthFilter authFilter = new HTTPBasicAuthFilter(USER,PASS);
       
        ClientConfig clientConfig = new DefaultClientConfig();
        Client client = Client.create(clientConfig);       
        client.addFilter(authFilter);
       
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

    assert client != null;

    @Nullable String username = getUsername();
    @Nullable String password = getPassword();
    if ( username != null && password != null ) {
      client.addFilter( new HTTPBasicAuthFilter( username, password ) );
    }

    return CouchDatabase.create( client, uri, dbName );
  }
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

    @Test public void addRoAndRemoveUserTest() throws IOException, InterruptedException {
       
        assertEquals("OK", addUser("test","pass",false));

        Client client = createClient();
        client.addFilter(new HTTPBasicAuthFilter("test", "pass"));

        client.resource("http://localhost:7474/").accept("application/json").get(String.class);
        client.resource("http://localhost:7474/db/data").get(String.class);

        try {
View Full Code Here

        }
    }

    @Test public void addRwAndRemoveUserTest() throws IOException, InterruptedException {
        Client adminClient = createClient();
        adminClient.addFilter(new HTTPBasicAuthFilter("neo4j", "master"));

        MultivaluedMap<String, String> formData = new MultivaluedMapImpl();
        formData.add("user", "test:pass");

        assertEquals("OK", adminClient.resource("http://localhost:7474/admin/add-user-rw").post(String.class, formData));


        Client client = createClient();
        client.addFilter(new HTTPBasicAuthFilter("test", "pass"));

        client.resource("http://localhost:7474/").accept("application/json").get(String.class);
        client.resource("http://localhost:7474/db/data").get(String.class);

        client.resource("http://localhost:7474/db/data/node").post(String.class);
View Full Code Here

  public void before() throws IOException, URISyntaxException, CouchDbException {
    URI currentUri = getServerUri();
    serverURI = currentUri;

    @Nullable HTTPBasicAuthFilter authFilter = getAuthFilter( );

    this.server = new CouchServer( currentUri, authFilter );
    db = createDb( createNewTestDbName() );
  }
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.