本文整理了Java中com.google.api.client.http.HttpRequest.setInterceptor()
方法的一些代码示例,展示了HttpRequest.setInterceptor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.setInterceptor()
方法的具体详情如下:
包路径:com.google.api.client.http.HttpRequest
类名称:HttpRequest
方法名:setInterceptor
暂无
代码示例来源:origin: googleapis/google-cloud-java
@Override
public void initialize(HttpRequest request) throws IOException {
checkNotNull(request);
if (this.initializer != null) {
this.initializer.initialize(request);
}
request.setInterceptor(new CensusHttpExecuteInterceptor(request.getInterceptor()));
}
}
代码示例来源:origin: com.google.api-client/google-api-client-appengine
@Override
public void initialize(HttpRequest request) throws IOException {
request.setInterceptor(this);
}
代码示例来源:origin: com.google.api-client/google-api-client
public void initialize(HttpRequest request) {
request.setInterceptor(this);
}
代码示例来源:origin: XeroAPI/Xero-Java
public void initialize(HttpRequest request) throws IOException
{
request.setInterceptor(this);
}
代码示例来源:origin: GoogleCloudPlatform/java-docs-samples
final HttpUnsuccessfulResponseHandler backoffHandler =
new HttpBackOffUnsuccessfulResponseHandler(new ExponentialBackOff()).setSleeper(sleeper);
request.setInterceptor(wrappedCredential);
request.setUnsuccessfulResponseHandler(
new HttpUnsuccessfulResponseHandler() {
代码示例来源:origin: com.google.oauth-client/google-oauth-client-extensions
public void initialize(HttpRequest request) throws IOException {
request.setInterceptor(authInterceptor);
request.setUnsuccessfulResponseHandler(authInterceptor);
}
代码示例来源:origin: com.google.enterprise.cloudsearch/google-cloudsearch-connector-sdk
@Override
public void initialize(HttpRequest request) throws IOException {
chainedRequestInitializer.initialize(request);
request.setInterceptor(req -> eventList.stream().forEach(e -> e.onStart()));
}
}
代码示例来源:origin: com.google.api-client/google-api-client-android
@Override
public void initialize(HttpRequest request) {
RequestHandler handler = new RequestHandler();
request.setInterceptor(handler);
request.setUnsuccessfulResponseHandler(handler);
}
代码示例来源:origin: org.ctoolkit.restapi/ctoolkit-rest-facade-adapter
public void initialize( HttpRequest request )
{
configureHttpRequest( request, numberOfRetries, readTimeout );
request.setInterceptor( interceptor );
if ( responseInterceptor != null )
{
request.setResponseInterceptor( responseInterceptor );
}
}
}
代码示例来源:origin: com.google.oauth-client/google-oauth-client-extensions
public void initialize(HttpRequest request) throws IOException {
checkIntializationStatus();
request.setInterceptor(authInterceptor);
request.setUnsuccessfulResponseHandler(authInterceptor);
}
代码示例来源:origin: com.google.oauth-client/google-oauth-client-extensions
public void initialize(HttpRequest request) throws IOException {
checkIntializationStatus();
request.setInterceptor(authInterceptor);
request.setUnsuccessfulResponseHandler(authInterceptor);
}
代码示例来源:origin: com.google.cloud/google-cloud-core-http
@Override
public void initialize(HttpRequest request) throws IOException {
checkNotNull(request);
if (this.initializer != null) {
this.initializer.initialize(request);
}
request.setInterceptor(new CensusHttpExecuteInterceptor(request.getInterceptor()));
}
}
代码示例来源:origin: winstonli/writelatex-git-bridge
@Override
protected void onBeforeRequest(
HttpRequest request
) throws IOException {
if (oauth2 != null) {
request.setInterceptor(request1 -> {
new BasicAuthentication(
USERNAME,
PASSWORD
).intercept(request1);
oauth2.intercept(request1);
});
} else {
request.setInterceptor(request1 -> {
new BasicAuthentication(
USERNAME,
PASSWORD
).intercept(request1);
});
}
}
代码示例来源:origin: com.google.cloud.bigdataoss/util
request.setInterceptor(null);
request.setUnsuccessfulResponseHandler(
makeUnsuccessfulResponseHandler(unsuccessfulResponseHandlers));
request.setInterceptor(
makeInterceptor(interceptors));
request.setResponseInterceptor(
代码示例来源:origin: GoogleCloudPlatform/bigdata-interop
request.setInterceptor(null);
request.setUnsuccessfulResponseHandler(
makeUnsuccessfulResponseHandler(unsuccessfulResponseHandlers));
request.setInterceptor(
makeInterceptor(interceptors));
request.setResponseInterceptor(
代码示例来源:origin: org.apache.beam/beam-examples-java
/** Initializes the given request. */
@Override
public final void initialize(final HttpRequest request) {
request.setReadTimeout(2 * ONEMINITUES); // 2 minutes read timeout
final HttpUnsuccessfulResponseHandler backoffHandler =
new HttpBackOffUnsuccessfulResponseHandler(new ExponentialBackOff()).setSleeper(sleeper);
request.setInterceptor(wrappedCredential);
request.setUnsuccessfulResponseHandler(
(request1, response, supportsRetry) -> {
if (wrappedCredential.handleResponse(request1, response, supportsRetry)) {
// If credential decides it can handle it, the return code or message indicated
// something specific to authentication, and no backoff is desired.
return true;
} else if (backoffHandler.handleResponse(request1, response, supportsRetry)) {
// Otherwise, we defer to the judgement of our internal backoff handler.
LOG.info("Retrying " + request1.getUrl().toString());
return true;
} else {
return false;
}
});
request.setIOExceptionHandler(
new HttpBackOffIOExceptionHandler(new ExponentialBackOff()).setSleeper(sleeper));
}
}
代码示例来源:origin: com.google.cloud.bigdataoss/util
@Override
public void initialize(HttpRequest request) {
request.setInterceptor(credential);
代码示例来源:origin: GoogleCloudPlatform/bigdata-interop
@Override
public void initialize(HttpRequest request) {
request.setInterceptor(credential);
代码示例来源:origin: GoogleCloudPlatform/cloud-pubsub-samples-java
new ExponentialBackOff())
.setSleeper(sleeper);
request.setInterceptor(wrappedCredential);
request.setUnsuccessfulResponseHandler(
new HttpUnsuccessfulResponseHandler() {
代码示例来源:origin: GoogleCloudPlatform/cloud-pubsub-samples-java
new ExponentialBackOff())
.setSleeper(sleeper);
request.setInterceptor(wrappedCredential);
request.setUnsuccessfulResponseHandler(
new HttpUnsuccessfulResponseHandler() {
内容来源于网络,如有侵权,请联系作者删除!