##### Overview

- Features
- News
- Status
- Download
- Wiki
- User Guide
  - Authentication Guide
  - Character Encodings
  - Cookies
  - Exception Handling
  - Logging Guide
  - Methods
  - Optimization Guide
  - Preference Architecture
  - Redirects Handling
  - Sample Code
  - SSL Guide
  - Threading
  - Trouble Shooting
  - Tutorial
- Developer Guide

##### Project Documentation

- About
- Project Info
- Project Reports
- Development Process

##### Legend

- External Link
- Opens in a new window

## Introduction

The HEAD method is identical to the GET method 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 allows a client to obtain meta-information about a resource without actually transferring the resource itself.

The head method is often used for testing hyperlinks, accessibility and for determining if a document has been recently modifed.

When your program is implementing caching, it is important to note that if the HEAD response indicates that the cached entity differs from the current entity, such as by a change in the Content-Length, Content-MD5, ETag or Last-Modified, the cache must treat the cached entry as stale.

## Typical Usage

Typically the head method is used to retrieve the meta-information for a resource, perhaps to check if the resource has been modifed. There are no methods specific to HeadMethod as the headers can be retreived using `getResponseHeaders()` as with any other method.

            HeadMethod head = new HeadMethod("http://jakarta.apache.org");
            // execute the method and handle any error responses.
            ...
            // Retrieve all the headers.
            Header[] headers = head.getResponseHeaders();

            // Retrieve just the last modified header value.
            String lastModified =
                head.getResponseHeader("last-modified").getValue();

## Common Problems

None.

## RFC Section

The head method is defined in section 8.2 of RFC1945 and similarly redefined for HTTP 1.1 in section 9.4 of RFC2616.