/** * No-arg constructor. * * @since 1.0 */ public GetMethod() { setFollowRedirects(true); }
/** * Constructor specifying a URI. * * @param uri either an absolute or relative URI * * @since 1.0 */ public GetMethod(String uri) { super(uri); LOG.trace("enter GetMethod(String)"); setFollowRedirects(true); }
/** * Recycles the HTTP method so that it can be used again. * Note that all of the instance variables will be reset * once this method has been called. This method will also * release the connection being used by this HTTP method. * * @see #releaseConnection() * * @since 1.0 * * @deprecated no longer supported and will be removed in the future * version of HttpClient */ public void recycle() { LOG.trace("enter GetMethod.recycle()"); super.recycle(); setFollowRedirects(true); }
protected GetMethod createRequest(String downloadUrl, Map<String, String> headers) { GetMethod request = new GetMethod(downloadUrl); request.setFollowRedirects(true); if (MapUtils.isNotEmpty(headers)) { for (String key : headers.keySet()) { request.setRequestHeader(key, headers.get(key)); reqHeaders.put(key, headers.get(key)); } } return request; }
protected GetMethod createRequest(String downloadUrl) { GetMethod request = new GetMethod(downloadUrl); request.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, myretryhandler); request.setFollowRedirects(true); if (!toFileSet) { String[] parts = downloadUrl.split("/"); String filename = parts[parts.length - 1]; _toFile = _toDir + File.separator + filename; toFileSet = true; } return request; }
private GetMethod createRequest(String downloadUrl) { GetMethod request = new GetMethod(downloadUrl); request.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, myretryhandler); request.setFollowRedirects(true); return request; }
public S3TemplateDownloader(S3TO s3TO, String downloadUrl, String installPath, DownloadCompleteCallback downloadCompleteCallback, long maxTemplateSizeInBytes, String username, String password, Proxy proxy, ResourceType resourceType) { this.downloadUrl = downloadUrl; this.s3TO = s3TO; this.resourceType = resourceType; this.maxTemplateSizeInByte = maxTemplateSizeInBytes; this.httpClient = HTTPUtils.getHTTPClient(); this.downloadCompleteCallback = downloadCompleteCallback; // Create a GET method for the download url. this.getMethod = new GetMethod(downloadUrl); // Set the retry handler, default to retry 5 times. this.getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, HTTPUtils.getHttpMethodRetryHandler(5)); // Follow redirects this.getMethod.setFollowRedirects(true); // Set file extension. this.fileExtension = StringUtils.substringAfterLast(StringUtils.substringAfterLast(downloadUrl, "/"), "."); // Calculate and set S3 Key. this.s3Key = join(asList(installPath, StringUtils.substringAfterLast(downloadUrl, "/")), S3Utils.SEPARATOR); // Set proxy if available. HTTPUtils.setProxy(proxy, this.httpClient); // Set credentials if available. HTTPUtils.setCredentials(username, password, this.httpClient); }
/** * No-arg constructor. * * @since 1.0 */ public GetMethod() { setFollowRedirects(true); }
/** * No-arg constructor. * * @since 1.0 */ public GetMethod() { setFollowRedirects(true); }
/** * No-arg constructor. * * @since 1.0 */ public GetMethod() { setFollowRedirects(true); }
/** * No-arg constructor. * * @since 1.0 */ public GetMethod() { setFollowRedirects(true); }
/** * Constructor specifying a URI. * * @param uri either an absolute or relative URI * * @since 1.0 */ public GetMethod(String uri) { super(uri); LOG.trace("enter GetMethod(String)"); setFollowRedirects(true); }
/** * Constructor specifying a URI. * * @param uri either an absolute or relative URI * * @since 1.0 */ public GetMethod(String uri) { super(uri); LOG.trace("enter GetMethod(String)"); setFollowRedirects(true); }
/** * Constructor specifying a URI. * * @param uri either an absolute or relative URI * * @since 1.0 */ public GetMethod(String uri) { super(uri); LOG.trace("enter GetMethod(String)"); setFollowRedirects(true); }
/** * Constructor specifying a URI. * * @param uri either an absolute or relative URI * * @since 1.0 */ public GetMethod(String uri) { super(uri); LOG.trace("enter GetMethod(String)"); setFollowRedirects(true); }
public HttpMethod createMethod(String url) { GetMethod getMethod = new GetMethod(url); getMethod.setFollowRedirects(true); return getMethod; } },
GetMethod method = new GetMethod(url); method.setFollowRedirects(false);
/** * Recycles the HTTP method so that it can be used again. * Note that all of the instance variables will be reset * once this method has been called. This method will also * release the connection being used by this HTTP method. * * @see #releaseConnection() * * @since 1.0 * * @deprecated no longer supported and will be removed in the future * version of HttpClient */ public void recycle() { LOG.trace("enter GetMethod.recycle()"); super.recycle(); setFollowRedirects(true); }
/** * Recycles the HTTP method so that it can be used again. * Note that all of the instance variables will be reset * once this method has been called. This method will also * release the connection being used by this HTTP method. * * @see #releaseConnection() * * @since 1.0 * * @deprecated no longer supported and will be removed in the future * version of HttpClient */ public void recycle() { LOG.trace("enter GetMethod.recycle()"); super.recycle(); setFollowRedirects(true); }
public static String fetchSourceHtml( String urlString ) { try { HttpClient httpClient = new HttpClient(); GetMethod getMethod = new GetMethod( urlString ); getMethod.setFollowRedirects( true ); int httpStatus = httpClient.executeMethod( getMethod ); if (httpStatus >= 400) { return ""; } String sourceHtml = getMethod.getResponseBodyAsString(); return sourceHtml; } catch (IOException e) { return ""; } }