@Override public void initialize(HttpRequest request) throws IOException { credential.initialize(request); requestTimeoutInitializer.initialize(request); // TODO(tvartak) : Make request logging configurable. request.setLoggingEnabled(true); }
/** Create a fake HTTP response object populated with the partContent and the statusCode. */ private HttpResponse getFakeResponse(final int statusCode, final InputStream partContent, List<String> headerNames, List<String> headerValues) throws IOException { HttpRequest request = new FakeResponseHttpTransport( statusCode, partContent, headerNames, headerValues).createRequestFactory() .buildPostRequest(new GenericUrl("http://google.com/"), null); request.setLoggingEnabled(false); request.setThrowExceptionOnExecuteError(false); return request.execute(); }
/** * Gets the report HTTP URL connection given report URL and proper information needed to * authenticate the request. * * @param reportUrl the URL of the report response or download * @return the report HTTP URL connection * @throws AuthenticationException If OAuth authorization fails. */ @VisibleForTesting HttpRequestFactory getHttpRequestFactory(final String reportUrl, String version) throws AuthenticationException { final HttpHeaders httpHeaders = createHeaders(reportUrl, version); return httpTransport.createRequestFactory( request -> { request.setHeaders(httpHeaders); request.setConnectTimeout(reportDownloadTimeout); request.setReadTimeout(reportDownloadTimeout); request.setThrowExceptionOnExecuteError(false); request.setLoggingEnabled(true); request.setResponseInterceptor(responseInterceptor); }); }
/** * Gets the report HTTP URL connection given report URL and proper information needed to * authenticate the request. * * @param reportUrl the URL of the report response or download * @return the report HTTP URL connection * @throws AuthenticationException If OAuth authorization fails. */ @VisibleForTesting HttpRequestFactory getHttpRequestFactory(final String reportUrl, String version) throws AuthenticationException { final HttpHeaders httpHeaders = createHeaders(reportUrl, version); return httpTransport.createRequestFactory( request -> { request.setHeaders(httpHeaders); request.setConnectTimeout(reportDownloadTimeout); request.setReadTimeout(reportDownloadTimeout); request.setThrowExceptionOnExecuteError(false); request.setLoggingEnabled(true); request.setResponseInterceptor(responseInterceptor); }); }
headers.set("x-goog-resumable", "start"); req.setHeaders(headers); req.setLoggingEnabled(true); });
headers.set("x-goog-resumable", "start"); req.setHeaders(headers); req.setLoggingEnabled(true); });
contentLength, isLastRequest, effectiveStatus)); req.setHeaders(headers); req.setLoggingEnabled(true); });
contentLength, isLastRequest, effectiveStatus)); req.setHeaders(headers); req.setLoggingEnabled(true); });