Code example for AuthState

Methods: getAuthScheme

0
      } 
      // add authorization 
      if (authInfo != null) {
        final AuthState authState = (AuthState)context.getAttribute(ClientContext.TARGET_AUTH_STATE);
        final HttpHost targetHost = (HttpHost)context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
        if (authState.getAuthScheme() == null && authInfo.host.equals(targetHost.getHostName())) {
          final String creds = "Basic " + Base64.encodeBytes((authInfo.login + ":" + authInfo.password).getBytes());
          request.addHeader(HEADER_AUTH, creds);
        } 
      } 
    } 
 
    @Override 
    public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException {
      // Inflate any responses compressed with gzip 
      final HttpEntity entity = response.getEntity();
      final Header encoding = entity.getContentEncoding();
      if (encoding != null) {
        for (final HeaderElement element : encoding.getElements()) {
          if (element.getName().equalsIgnoreCase(ENCODING_GZIP)) {
            response.setEntity(new InflatingEntity(response.getEntity()));