コード例 #1
0
ファイル: HTTPSession.java プロジェクト: msdsoftware/thredds
 /**
  * Called primarily from HTTPMethod to do the bulk of the execution. Assumes HTTPMethod has
  * inserted its headers into request.
  *
  * @param method
  * @param methoduri
  * @param rb
  * @return Request+Response pair
  * @throws HTTPException
  */
 ExecState execute(HTTPMethod method, URI methoduri, RequestBuilder rb) throws HTTPException {
   this.execution = new ExecState();
   this.requestURI = methoduri;
   AuthScope methodscope = HTTPAuthUtil.uriToAuthScope(methoduri);
   AuthScope target = HTTPAuthUtil.authscopeUpgrade(this.scope, methodscope);
   synchronized (this) { // keep coverity happy
     // Merge Settings;
     Settings merged = HTTPUtil.merge(globalsettings, localsettings);
     if (!this.cachevalid) {
       RequestConfig.Builder rcb = RequestConfig.custom();
       this.cachedconfig = configureRequest(rcb, merged);
       HttpClientBuilder cb = HttpClients.custom();
       configClient(cb, merged);
       setAuthenticationAndProxy(cb);
       this.cachedclient = cb.build();
       rb.setConfig(this.cachedconfig);
       this.cachevalid = true;
     }
   }
   this.execution.request = (HttpRequestBase) rb.build();
   try {
     HttpHost targethost = HTTPAuthUtil.authscopeToHost(target);
     this.execution.response =
         cachedclient.execute(targethost, this.execution.request, this.sessioncontext);
   } catch (IOException ioe) {
     throw new HTTPException(ioe);
   }
   return this.execution;
 }
コード例 #2
0
ファイル: HTTPSession.java プロジェクト: msdsoftware/thredds
 @Deprecated
 public void setCredentialsProvider(String url, CredentialsProvider provider)
     throws HTTPException {
   assert (url != null && provider != null);
   AuthScope scope = HTTPAuthUtil.uriToAuthScope(url);
   setCredentialsProvider(provider, scope);
 }
コード例 #3
0
ファイル: HTTPSession.java プロジェクト: msdsoftware/thredds
 @Deprecated
 public static void setGlobalCredentials(String url, Credentials creds) throws HTTPException {
   assert (url != null && creds != null);
   AuthScope scope = HTTPAuthUtil.uriToAuthScope(url);
   CredentialsProvider provider = new BasicCredentialsProvider();
   provider.setCredentials(scope, creds);
   setGlobalCredentialsProvider(provider, scope);
 }
コード例 #4
0
ファイル: HTTPSession.java プロジェクト: msdsoftware/thredds
 HTTPSession(String uri) throws HTTPException {
   init(HTTPAuthUtil.uriToAuthScope(uri), uri);
 }
コード例 #5
0
ファイル: HTTPSession.java プロジェクト: msdsoftware/thredds
 @Deprecated
 public void setCredentials(String url, Credentials creds) throws HTTPException {
   assert (creds != null);
   AuthScope scope = HTTPAuthUtil.uriToAuthScope(url);
   setCredentials(creds, scope);
 }