Examples of AuthCache


Examples of org.apache.http.client.AuthCache

          httpclient.getCredentialsProvider().setCredentials(
                new AuthScope(AuthScope.ANY),
                this.credentials);
       
          // Create AuthCache instance
          AuthCache authCache = new BasicAuthCache();
          // Generate BASIC scheme object and add it to the local auth cache
          BasicScheme basicAuth = new BasicScheme();
          authCache.put(targetHost, basicAuth);

          // Add AuthCache to the execution context
          BasicHttpContext localcontext = new BasicHttpContext();
          localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);
        } else {
View Full Code Here

Examples of org.apache.http.client.AuthCache

      ((AbstractHttpClient) httpclient).getCredentialsProvider().setCredentials(
              new AuthScope(hostName, port),
              this.credentials);
     
      // Create AuthCache instance
      AuthCache authCache = new BasicAuthCache();
      // Generate BASIC scheme object and add it to the local auth cache
      BasicScheme basicAuth = new BasicScheme();
   
      authCache.put(targetHost, basicAuth);

      // Add AuthCache to the execution context
      BasicHttpContext localcontext = new BasicHttpContext();
      localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);
    }
View Full Code Here

Examples of org.apache.http.client.AuthCache

    httpClient.getCredentialsProvider().setCredentials(
        new AuthScope( host, port ),
        new UsernamePasswordCredentials( serverAdminUser, serverAdminPassword )
        );

    AuthCache authCache = new BasicAuthCache();
    authCache.put(
        new HttpHost( host, port, "http" ),
        new BasicScheme()
        );

    BasicHttpContext localContext = new BasicHttpContext();
View Full Code Here

Examples of org.apache.http.client.AuthCache

    try {
      HttpHost targetHost = new HttpHost(builder.getHost(), builder.getPort(), builder.getScheme());

      HttpClientContext localcontext = HttpClientContext.create();
      if (isAuthConfigured) {
        AuthCache authCache = new BasicAuthCache();
        BasicScheme basicAuth = new BasicScheme();
        authCache.put(targetHost, basicAuth);
        localcontext.setAuthCache(authCache);
      }

      response = httpclient.execute(targetHost, method, localcontext);
      int statusCode = response.getStatusLine().getStatusCode();
View Full Code Here

Examples of org.apache.http.client.AuthCache

      BasicHttpContext localcontext = new BasicHttpContext();
      if (isAuthConfigured) {
        // Preemptive authentication enabled - see
        // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d5e1032
        HttpHost targetHost = new HttpHost(builder.getHost(), builder.getPort(), builder.getScheme());
        AuthCache authCache = new BasicAuthCache();
        BasicScheme basicAuth = new BasicScheme();
        authCache.put(targetHost, basicAuth);
        localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);
      }

      HttpResponse response = httpclient.execute(method, localcontext);
      int statusCode = response.getStatusLine().getStatusCode();
View Full Code Here

Examples of org.apache.http.client.AuthCache

        // Add AuthCache to the execution context
        BasicHttpContext localcontext = new BasicHttpContext();

        // Generate BASIC scheme object and add it to the local auth cache
        AuthCache authCache = new BasicAuthCache();
        authCache.put(targetHost, new BasicScheme());
        localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);

        HttpResponse response = null;

        maxit = 10;
View Full Code Here

Examples of org.apache.http.client.AuthCache

        // Add AuthCache to the execution context
        BasicHttpContext localcontext = new BasicHttpContext();

        // Generate BASIC scheme object and add it to the local auth cache
        AuthCache authCache = new BasicAuthCache();
        authCache.put(targetHost, new BasicScheme());
        localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);

        HttpResponse response = null;

        maxit = 10;
View Full Code Here

Examples of org.apache.http.client.AuthCache

            String host = url.getHost();
            int port = url.getPort() > -1 ? url.getPort() : AuthScope.ANY_PORT;

            httpClient.getCredentialsProvider().setCredentials( new AuthScope( host, port ), creds );

            AuthCache authCache = new BasicAuthCache();
            BasicScheme basicAuth = new BasicScheme();
            HttpHost targetHost = new HttpHost( url.getHost(), url.getPort(), url.getProtocol() );
            authCache.put( targetHost, basicAuth );

            localContext = new BasicHttpContext();
            localContext.setAttribute( ClientContext.AUTH_CACHE, authCache );
        }
    }
View Full Code Here

Examples of org.apache.http.client.AuthCache

            String host = getRepository().getHost();
            int port = getRepository().getPort() > -1 ? getRepository().getPort() : AuthScope.ANY_PORT;

            client.getCredentialsProvider().setCredentials( new AuthScope( host, port ), creds );

            AuthCache authCache = new BasicAuthCache();
            BasicScheme basicAuth = new BasicScheme();
            HttpHost targetHost = new HttpHost( repository.getHost(), repository.getPort(), repository.getProtocol() );
            authCache.put( targetHost, basicAuth );

            localContext = new BasicHttpContext();
            localContext.setAttribute( ClientContext.AUTH_CACHE, authCache );
        }
View Full Code Here

Examples of org.apache.http.client.AuthCache

    protected Response handleStream(final String url) {
        final AuthScope scope = ((PreemptiveAuthHttpRequestFactory) getRestTemplate().getRequestFactory()).
                getAuthScope();
        final HttpHost targetHost = new HttpHost(scope.getHost(), scope.getPort(), scope.getScheme());
        final BasicHttpContext localcontext = new BasicHttpContext();
        final AuthCache authCache = new BasicAuthCache();
        authCache.put(targetHost, new BasicScheme());
        localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);

        final HttpGet getMethod = new HttpGet(url);
        try {
            final HttpResponse httpResponse =
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.