Class HeadMethod
- java.lang.Object
-
- org.apache.commons.httpclient.HttpMethodBase
-
- org.apache.commons.httpclient.methods.HeadMethod
-
- All Implemented Interfaces:
HttpMethod
public class HeadMethod extends HttpMethodBase
Implements the HTTP HEAD method.The HTTP HEAD method is defined in section 9.4 of RFC2616:
The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification.
- Since:
- 1.0
- Version:
- $Revision: 480424 $
- Author:
- Remy Maucherat, Mike Bowler, Jeff Dever, oleg Kalnichevski
-
-
Field Summary
-
Fields inherited from class org.apache.commons.httpclient.HttpMethodBase
effectiveVersion, statusLine
-
-
Constructor Summary
Constructors Constructor Description HeadMethod()No-arg constructor.HeadMethod(java.lang.String uri)Constructor specifying a URI.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intgetBodyCheckTimeout()Deprecated.UseHttpMethodParamsjava.lang.StringgetName()Returns "HEAD".protected voidreadResponseBody(HttpState state, HttpConnection conn)OverridesHttpMethodBasemethod to not read a response body, despite the presence of a Content-Length or Transfer-Encoding header.voidrecycle()Deprecated.no longer supported and will be removed in the future version of HttpClientvoidsetBodyCheckTimeout(int timeout)Deprecated.UseHttpMethodParams-
Methods inherited from class org.apache.commons.httpclient.HttpMethodBase
abort, addCookieRequestHeader, addHostRequestHeader, addProxyConnectionHeader, addRequestHeader, addRequestHeader, addRequestHeaders, addResponseFooter, addUserAgentRequestHeader, checkNotUsed, checkUsed, execute, generateRequestLine, getAuthenticationRealm, getContentCharSet, getDoAuthentication, getEffectiveVersion, getFollowRedirects, getHostAuthState, getHostConfiguration, getMethodRetryHandler, getParams, getPath, getProxyAuthenticationRealm, getProxyAuthState, getQueryString, getRecoverableExceptionCount, getRequestCharSet, getRequestHeader, getRequestHeaderGroup, getRequestHeaders, getRequestHeaders, getResponseBody, getResponseBody, getResponseBodyAsStream, getResponseBodyAsString, getResponseBodyAsString, getResponseCharSet, getResponseContentLength, getResponseFooter, getResponseFooters, getResponseHeader, getResponseHeaderGroup, getResponseHeaders, getResponseHeaders, getResponseStream, getResponseTrailerHeaderGroup, getStatusCode, getStatusLine, getStatusText, getURI, hasBeenUsed, isAborted, isConnectionCloseForced, isHttp11, isRequestSent, isStrictMode, processCookieHeaders, processResponseBody, processResponseHeaders, processStatusLine, readResponse, readResponseHeaders, readStatusLine, releaseConnection, removeRequestHeader, removeRequestHeader, responseBodyConsumed, setConnectionCloseForced, setDoAuthentication, setFollowRedirects, setHostConfiguration, setHttp11, setMethodRetryHandler, setParams, setPath, setQueryString, setQueryString, setRequestHeader, setRequestHeader, setResponseStream, setStrictMode, setURI, shouldCloseConnection, validate, writeRequest, writeRequestBody, writeRequestHeaders, writeRequestLine
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns "HEAD".- Specified by:
getNamein interfaceHttpMethod- Specified by:
getNamein classHttpMethodBase- Returns:
- "HEAD"
- Since:
- 2.0
-
recycle
public void recycle()
Deprecated.no longer supported and will be removed in the future version of HttpClientRecycles 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.- Specified by:
recyclein interfaceHttpMethod- Overrides:
recyclein classHttpMethodBase- Since:
- 1.0
- See Also:
HttpMethodBase.releaseConnection()
-
readResponseBody
protected void readResponseBody(HttpState state, HttpConnection conn) throws HttpException, java.io.IOException
OverridesHttpMethodBasemethod to not read a response body, despite the presence of a Content-Length or Transfer-Encoding header.- Overrides:
readResponseBodyin classHttpMethodBase- Parameters:
state- thestateinformation associated with this methodconn- theconnectionused to execute this HTTP method- Throws:
java.io.IOException- if an I/O (transport) error occurs. Some transport exceptions can be recovered from.HttpException- if a protocol exception occurs. Usually protocol exceptions cannot be recovered from.- Since:
- 2.0
- See Also:
HttpMethodBase.readResponse(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection),HttpMethodBase.processResponseBody(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection)
-
getBodyCheckTimeout
public int getBodyCheckTimeout()
Deprecated.UseHttpMethodParamsReturns non-compliant response body check timeout.- Returns:
- The period of time in milliseconds to wait for a response body from a non-compliant server. -1 returned when non-compliant response body check is disabled
- See Also:
HttpMethodBase.getParams(),HttpMethodParams,HttpMethodParams.HEAD_BODY_CHECK_TIMEOUT
-
setBodyCheckTimeout
public void setBodyCheckTimeout(int timeout)
Deprecated.UseHttpMethodParamsSets non-compliant response body check timeout.- Parameters:
timeout- The period of time in milliseconds to wait for a response body from a non-compliant server. -1 can be used to disable non-compliant response body check- See Also:
HttpMethodBase.getParams(),HttpMethodParams,HttpMethodParams.HEAD_BODY_CHECK_TIMEOUT
-
-