org.apache.commons.httpclient.methods

Class OptionsMethod

public class OptionsMethod extends HttpMethodBase

Implements the HTTP OPTIONS method.

The HTTP OPTIONS method is defined in section 9.2 of RFC2616:

The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.

Since: 1.0

Version: $Revision: 155418 $

Author: Remy Maucherat Mike Bowler Jeff Dever

Constructor Summary
OptionsMethod()
Method constructor.
OptionsMethod(String uri)
Constructor specifying a URI.
Method Summary
EnumerationgetAllowedMethods()
Get a list of allowed methods.
StringgetName()
Get the name.
booleanisAllowed(String method)
Is the specified method allowed ?
booleanneedContentLength()
Return true if the method needs a content-length header in the request.
protected voidprocessResponseHeaders(HttpState state, HttpConnection conn)

This implementation will parse the Allow header to obtain the set of methods supported by the resource identified by the Request-URI.

Constructor Detail

OptionsMethod

public OptionsMethod()
Method constructor.

Since: 1.0

OptionsMethod

public OptionsMethod(String uri)
Constructor specifying a URI.

Parameters: uri either an absolute or relative URI

Since: 1.0

Method Detail

getAllowedMethods

public Enumeration getAllowedMethods()
Get a list of allowed methods.

Returns: An enumeration of all the allowed methods.

Since: 1.0

getName

public String getName()
Get the name.

Returns: "OPTIONS"

Since: 2.0

isAllowed

public boolean isAllowed(String method)
Is the specified method allowed ?

Parameters: method The method to check.

Returns: true if the specified method is allowed.

Since: 1.0

needContentLength

public boolean needContentLength()

Deprecated: only entity enclosing methods set content length header

Return true if the method needs a content-length header in the request.

Returns: true if a content-length header will be expected by the server

Since: 1.0

processResponseHeaders

protected void processResponseHeaders(HttpState state, HttpConnection conn)

This implementation will parse the Allow header to obtain the set of methods supported by the resource identified by the Request-URI.

Parameters: state the {@link HttpState state} information associated with this method conn the {@link HttpConnection connection} used to execute this HTTP method

Since: 2.0

See Also: OptionsMethod OptionsMethod

Copyright (c) 1999-2005 - Apache Software Foundation