/** * No-arg constructor. * * @since 1.0 */ public HeadMethod() { setFollowRedirects(true); }
/** * Constructor specifying a URI. * * @param uri either an absolute or relative URI * * @since 1.0 */ public HeadMethod(String uri) { super(uri); 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() { super.recycle(); setFollowRedirects(true); }
/** * Constructor specifying a URI. * * @param uri either an absolute or relative URI * * @since 1.0 */ public HeadMethod(String uri) { super(uri); setFollowRedirects(true); }
/** * No-arg constructor. * * @since 1.0 */ public HeadMethod() { setFollowRedirects(true); }
/** * Constructor specifying a URI. * * @param uri either an absolute or relative URI * * @since 1.0 */ public HeadMethod(String uri) { super(uri); setFollowRedirects(true); }
/** * Constructor specifying a URI. * * @param uri either an absolute or relative URI * * @since 1.0 */ public HeadMethod(String uri) { super(uri); setFollowRedirects(true); }
/** * No-arg constructor. * * @since 1.0 */ public HeadMethod() { setFollowRedirects(true); }
/** * No-arg constructor. * * @since 1.0 */ public HeadMethod() { setFollowRedirects(true); }
/** * No-arg constructor. * * @since 1.0 */ public HeadMethod() { setFollowRedirects(true); }
/** * Constructor specifying a URI. * * @param uri either an absolute or relative URI * * @since 1.0 */ public HeadMethod(String uri) { super(uri); 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() { 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() { 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() { 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() { super.recycle(); setFollowRedirects(true); }
HeadMethod head = new HeadMethod("http://www.myfootestsite.com"); head.setFollowRedirects(true); // Header stuff Header[] headers = head.getResponseHeaders();
/** Determine the value for the Content-Length header using a HEAD call * * @param url * @return * @throws HttpException */ public static int getContentLength(String url) throws HttpException, IOException { int result = 0; //Execute a GET method on the URL HeadMethod head = new HeadMethod(url); head.setFollowRedirects(true); head.addRequestHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0)"); try { _httpClient.executeMethod(head); // Retrieve just the Content-Length header value. String length = head.getResponseHeader("Content-Length").getValue(); result = Integer.parseInt(length); } catch (NumberFormatException nfe) { //header not found } finally { head.releaseConnection(); } return result; }