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

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


    }

    private Client client() {
        Client client = Client.create();
        if (username != null) {
            client.addFilter(new HTTPBasicAuthFilter(username, password));
        }
        return client;
    }
View Full Code Here


        try {
            JSONObject request = createRequest(offset, CHUNK_SIZE);
            Client c = Client.create();
            if (squeezeboxServerUsername != null && squeezeboxServerUsername.length() > 0) {
                if (squeezeboxServerPassword != null && squeezeboxServerPassword.length() > 0) {
                    c.addFilter(new HTTPBasicAuthFilter(squeezeboxServerUsername, squeezeboxServerPassword));
                } else if (squeezeboxServerPasswordHash != null && squeezeboxServerPasswordHash.length() > 0) {
                    c.addFilter(new HTTPBasicAuthFilter(squeezeboxServerUsername, squeezeboxServerPasswordHash));
                }
            }
            JSONObject response = null;
            if (squeezeboxServerPasswordHash != null && squeezeboxServerPasswordHash.length() > 0) {
                response = c.resource(SERVICE_URL).accept("application/json").header("X-Scanner", 1).post(JSONObject.class, request);
View Full Code Here

    final ClientConfig config = new DefaultClientConfig();
    config.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, true);
    config.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, timeout);
    this.client = Client.create(config);
    this.client.addFilter(new CookiesHandlerFilter()); // must be inserted before HTTPBasicAuthFilter
    this.client.addFilter(new HTTPBasicAuthFilter(username, password));
    this.majorVersion = "999";
    this.minorVersion = "999";
    this.releaseVersion = "999";
    this.buildVersion = "999";
    this.milestoneVersion = "999";
View Full Code Here

    private void initRestService() {
      ClientConfig clientConfig = new DefaultClientConfig();
      clientConfig.getClasses().add(MultiPartWriter.class);
      clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
      client = Client.create(clientConfig);
      client.addFilter(new HTTPBasicAuthFilter(username, password));
    }
View Full Code Here

    String url = "http://localhost:8080/pentaho";

    final ClientConfig config = new DefaultClientConfig();
    config.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, true);
    Client client = Client.create(config);
    client.addFilter(new HTTPBasicAuthFilter("joe", "password"));

    final WebResource resource = client.resource(url + "/api/repo/files/children?depth=-1&filter=*");
    final RepositoryFileTreeDto tree = resource.path("").accept(MediaType.APPLICATION_XML_TYPE).get(RepositoryFileTreeDto.class);

    printDebugInfo(tree);
View Full Code Here

     */
    private WebResource.Builder prepareClient(String additionalResourceUrl)
    {
      final Client client = Client.create();
        if (configuration.isAuthorisation()) {
            client.addFilter(new HTTPBasicAuthFilter(
                           configuration.getAdminUser(),
                           configuration.getAdminPassword()));
        }
        client.addFilter(new CsrfProtectionFilter());
        return client.resource(this.adminBaseUrl + additionalResourceUrl).accept(MediaType.APPLICATION_XML_TYPE);
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

    if (headerParams.containsKey("BASIC"))
    {
      user = headerParams.get("BASIC").split(":")[0];
      password = headerParams.get("BASIC").split(":")[1];
      headerParams.remove("BASIC");
      client.addFilter(new HTTPBasicAuthFilter(user, password));
    }
    else if (!headerParams.containsKey("Authorization")) // add oauth header if not present
    {
      headerParams.put("Authorization", "Bearer " + findSystemDefaultAccessToken());
    }
View Full Code Here

public class HttpClientFactory {

    public Client createClient() {
        Client client = ApacheHttpClient.create();
        client.setFollowRedirects(true);
        client.addFilter(new HTTPBasicAuthFilter("management/admin", "Pyi1bo1r"));
        client.addFilter(new ApplicationKeyFilter());
        return client;
    }
View Full Code Here

        }
        config.getProperties().put(ApacheHttpClientConfig.PROPERTY_READ_TIMEOUT, READ_TIMEOUT_IN_MILLIS);

        Client client = ApacheHttpClient.create(config);
        client.setFollowRedirects(true);
        client.addFilter(new HTTPBasicAuthFilter(platformParameters.getPrincipal(), platformParameters.getPassword()));
       
        return client;
    }
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.