Java Code Examples for com.google.api.client.http.HttpRequest#getIOExceptionHandler()
The following examples show how to use
com.google.api.client.http.HttpRequest#getIOExceptionHandler() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChainingHttpRequestInitializer.java From hadoop-connectors with Apache License 2.0 | 5 votes |
@Override public void initialize(HttpRequest request) throws IOException { List<HttpIOExceptionHandler> ioExceptionHandlers = new ArrayList<>(); List<HttpUnsuccessfulResponseHandler> unsuccessfulResponseHandlers = new ArrayList<>(); List<HttpExecuteInterceptor> interceptors = new ArrayList<>(); List<HttpResponseInterceptor> responseInterceptors = new ArrayList<>(); for (HttpRequestInitializer initializer : initializers) { initializer.initialize(request); if (request.getIOExceptionHandler() != null) { ioExceptionHandlers.add(request.getIOExceptionHandler()); request.setIOExceptionHandler(null); } if (request.getUnsuccessfulResponseHandler() != null) { unsuccessfulResponseHandlers.add(request.getUnsuccessfulResponseHandler()); request.setUnsuccessfulResponseHandler(null); } if (request.getInterceptor() != null) { interceptors.add(request.getInterceptor()); request.setInterceptor(null); } if (request.getResponseInterceptor() != null) { responseInterceptors.add(request.getResponseInterceptor()); request.setResponseInterceptor(null); } } request.setIOExceptionHandler( makeIoExceptionHandler(ioExceptionHandlers)); request.setUnsuccessfulResponseHandler( makeUnsuccessfulResponseHandler(unsuccessfulResponseHandlers)); request.setInterceptor( makeInterceptor(interceptors)); request.setResponseInterceptor( makeResponseInterceptor(responseInterceptors)); }
Example 2
Source File: MediaUploadErrorHandler.java From google-api-java-client with Apache License 2.0 | 5 votes |
/** * Constructs a new instance from {@link MediaHttpUploader} and {@link HttpRequest}. */ public MediaUploadErrorHandler(MediaHttpUploader uploader, HttpRequest request) { this.uploader = Preconditions.checkNotNull(uploader); originalIOExceptionHandler = request.getIOExceptionHandler(); originalUnsuccessfulHandler = request.getUnsuccessfulResponseHandler(); request.setIOExceptionHandler(this); request.setUnsuccessfulResponseHandler(this); }