Examples of AuthState


Examples of org.apache.http.client.AuthState

                entity.consumeContent();
            }
           
            int sc = response.getStatusLine().getStatusCode();
           
            AuthState authState = null;
            if (sc == HttpStatus.SC_UNAUTHORIZED) {
                // Target host authentication required
                authState = (AuthState) localContext.getAttribute(ClientContext.TARGET_AUTH_STATE);
            }
            if (sc == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) {
                // Proxy authentication required
                authState = (AuthState) localContext.getAttribute(ClientContext.PROXY_AUTH_STATE);
            }
           
            if (authState != null) {
                System.out.println("----------------------------------------");
                AuthScope authScope = authState.getAuthScope();
                System.out.println("Please provide credentials");
                System.out.println(" Host: " + authScope.getHost() + ":" + authScope.getPort());
                System.out.println(" Realm: " + authScope.getRealm());
               
               
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.