try { getMethod = completionService.take().get(); URI uri = getMethod.getURI(); String instance = endpointsToServers.get(uri.getHost() + ":" + uri.getPort()); if (getMethod.getStatusCode() >= 300) {
public String getDownloadUrl() { try { return getMethod.getURI().toString(); } catch (URIException e) { return null; } }
@Override public byte[] extractResult(GetMethod method) throws IOException { if (method.getStatusCode() == SC_NOT_FOUND) { //no result throw new FileNotFoundException("Not found " + method.getURI()); } return method.getResponseBody(); }
@Override public byte[] extractResult(GetMethod method) throws IOException { if (method.getStatusCode() == SC_NOT_FOUND) { //no result throw new FileNotFoundException("Not found " + method.getURI()); } return method.getResponseBody(); }
private JSONObject executeMethod(HttpClient httpClient, GetMethod method) throws IOException { try { LOGGER.debug(method.getURI()); httpClient.executeMethod(method); JSONObject config = extractConfig(method.getResponseBodyAsString()); LOGGER.debug(config); return config; } finally { method.releaseConnection(); } }
@Override public int read(byte[] buffer, int offset, int length) throws IOException { int count = super.read(buffer, offset, length); totalCount += count; if (totalCount - lastLogCount > 1024 * 128) { DavGatewayTray.debug(new BundleMessage("LOG_DOWNLOAD_PROGRESS", String.valueOf(totalCount / 1024), method.getURI())); DavGatewayTray.switchIcon(); lastLogCount = totalCount; } return count; }
/** * Execute test method from checkConfig, with proxy credentials, but without Exchange credentials. * * @param httpClient Http client instance * @param method Http method * @return Http status * @throws IOException on error */ public static int executeTestMethod(HttpClient httpClient, GetMethod method) throws IOException { // do not follow redirects in expired sessions method.setFollowRedirects(false); int status = httpClient.executeMethod(method); if (status == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED && acceptsNTLMOnly(method) && !hasNTLMorNegotiate(httpClient)) { resetMethod(method); LOGGER.debug("Received " + status + " unauthorized at " + method.getURI() + ", retrying with NTLM"); addNTLM(httpClient); status = httpClient.executeMethod(method); } return status; }
@Override public Version getBundleVersion(String bundleSymbolicName) throws OsgiClientException { GetMethod method = new GetMethod(repositoryInfo.getUrl() + "system/console/bundles.json"); HttpClient client = getHttpClient(); try { int result = client.executeMethod(method); if (result != HttpStatus.SC_OK) { throw new HttpException("Got status code " + result + " for call to " + method.getURI()); } JSONObject object = new JSONObject(method.getResponseBodyAsString()); JSONArray bundleData = object.getJSONArray("data"); for (int i = 0; i < bundleData.length(); i++) { JSONObject bundle = bundleData.getJSONObject(i); String remotebundleSymbolicName = bundle.getString("symbolicName"); Version bundleVersion = new Version(bundle.getString("version")); if (bundleSymbolicName.equals(remotebundleSymbolicName)) { return bundleVersion; } } return null; } catch (HttpException e) { throw new OsgiClientException(e); } catch (IOException e) { throw new OsgiClientException(e); } catch (JSONException e) { throw new OsgiClientException(e); } finally { method.releaseConnection(); } }
params[i++] = new NameValuePair("hash", hash); method.setQueryString(params); logger.debug("Sending GET message to " + method.getURI().getURI() + " with parameters " + Arrays.toString(params)); int statusCode = client.executeMethod(method);
&& acceptsNTLMOnly(method) && !hasNTLMorNegotiate(httpClient)) { resetMethod(method); LOGGER.debug("Received " + status + " unauthorized at " + method.getURI() + ", retrying with NTLM"); addNTLM(httpClient); status = httpClient.executeMethod(method); LOGGER.warn("GET failed with status " + status + " at " + method.getURI()); if (status != HttpStatus.SC_NOT_FOUND && status != HttpStatus.SC_FORBIDDEN) { LOGGER.warn(method.getResponseBodyAsString());
); actualDocumentIRI = method.getURI().toString(); byte[] response = method.getResponseBody();
try buildLogger.addBuildLogEntry("Trying to retrieve Tomcat details from " + getMethod.getURI()); client.executeMethod(getMethod);
_classUnderTest.service(request, response); parser.parse(new FileInputStream(tmp), method.getURI().getURI()); assertTrue(!collector.getStatements().isEmpty()); verify(response).setStatus(HttpServletResponse.SC_OK);
String sessionId = config.getString("sessionId"); String referer = getMethod.getURI().toString();