本文整理了Java中org.apache.http.auth.AuthState.setAuthScope()
方法的一些代码示例,展示了AuthState.setAuthScope()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AuthState.setAuthScope()
方法的具体详情如下:
包路径:org.apache.http.auth.AuthState
类名称:AuthState
方法名:setAuthScope
[英]Sets actual AuthScope.
[中]设置实际的AuthScope。
代码示例来源:origin: robolectric/robolectric
authState.setAuthScope(authScope);
authState.setCredentials(creds);
代码示例来源:origin: robovm/robovm
authState.setAuthScope(authScope);
authState.setCredentials(creds);
代码示例来源:origin: robolectric/robolectric
targetAuthState.setAuthScope(null);
proxyAuthState.setAuthScope(null);
this.targetAuthState.setAuthScope(null);
this.proxyAuthState.setAuthScope(null);
代码示例来源:origin: robovm/robovm
this.targetAuthState.setAuthScope(null);
this.proxyAuthState.setAuthScope(null);
代码示例来源:origin: robolectric/robolectric
this.proxyAuthState.setAuthScope(null);
代码示例来源:origin: robovm/robovm
this.proxyAuthState.setAuthScope(null);
代码示例来源:origin: net.sf.ahtutils/ahtutils-jsf
@Override
public void process(org.apache.http.HttpRequest request, HttpContext context) throws HttpException, IOException
{
AuthState authState = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE);
authState.setAuthScope(org.apache.http.auth.AuthScope.ANY);
authState.setCredentials(new UsernamePasswordCredentials(username,password));
authState.setAuthScheme(new BasicScheme());
}
}
代码示例来源:origin: stackoverflow.com
private StringBuffer readFromServer(String url) {
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpRequestInterceptor preemptiveAuth = new HttpRequestInterceptor() {
public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
AuthState authState = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE);
if (authState.getAuthScheme() == null) {
Credentials credentials = new UsernamePasswordCredentials(
Constants.SERVER_USERNAME,
Constants.SERVER_PASSWORD);
authState.setAuthScheme(new BasicScheme());
authState.setAuthScope(AuthScope.ANY);
authState.setCredentials(credentials);
}
}
};
httpclient.addRequestInterceptor(preemptiveAuth, 0);
HttpGet httpget = new HttpGet(url);
HttpResponse response;
InputStream instream = null;
StringBuffer result = new StringBuffer();
try {
response = httpclient.execute(httpget);
代码示例来源:origin: stackoverflow.com
httclient.addRequestInterceptor(new HttpRequestInterceptor() {
public void process(HttpRequest arg0, HttpContext context) throws HttpException, IOException {
AuthState state = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE);
if (state.getAuthScheme() == null) {
BasicScheme scheme = new BasicScheme();
CredentialsProvider credentialsProvider = (CredentialsProvider) context.getAttribute(ClientContext.CREDS_PROVIDER);
Credentials credentials = credentialsProvider.getCredentials(AuthScope.ANY);
if (credentials == null) {
System.out.println("Credential >>" + credentials);
throw new HttpException();
}
state.setAuthScope(AuthScope.ANY);
state.setAuthScheme(scheme);
state.setCredentials(credentials);
}
}
}, 0);
代码示例来源:origin: MobiVM/robovm
authState.setAuthScope(authScope);
authState.setCredentials(creds);
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
authState.setAuthScope(authScope);
authState.setCredentials(creds);
代码示例来源:origin: com.gluonhq/robovm-rt
authState.setAuthScope(authScope);
authState.setCredentials(creds);
代码示例来源:origin: com.github.japgolly.android.test/robolectric
authState.setAuthScope(authScope);
authState.setCredentials(creds);
代码示例来源:origin: FlexoVM/flexovm
authState.setAuthScope(authScope);
authState.setCredentials(creds);
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
this.targetAuthState.setAuthScope(null);
this.proxyAuthState.setAuthScope(null);
代码示例来源:origin: MobiVM/robovm
this.targetAuthState.setAuthScope(null);
this.proxyAuthState.setAuthScope(null);
代码示例来源:origin: FlexoVM/flexovm
this.targetAuthState.setAuthScope(null);
this.proxyAuthState.setAuthScope(null);
代码示例来源:origin: com.gluonhq/robovm-rt
this.proxyAuthState.setAuthScope(null);
代码示例来源:origin: MobiVM/robovm
this.proxyAuthState.setAuthScope(null);
代码示例来源:origin: com.github.japgolly.android.test/robolectric
this.proxyAuthState.setAuthScope(null);
内容来源于网络,如有侵权,请联系作者删除!