org.apache.commons.httpclient.methods
Class OptionsMethod

java.lang.Object
  |
  +--org.apache.commons.httpclient.HttpMethodBase
        |
        +--org.apache.commons.httpclient.methods.OptionsMethod
All Implemented Interfaces:
HttpMethod
Direct Known Subclasses:
UrlOptionsMethod

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: 1.12.2.2 $
Author:
Remy Maucherat, Mike Bowler, Jeff Dever

Fields inherited from class org.apache.commons.httpclient.HttpMethodBase
USER_AGENT
 
Constructor Summary
OptionsMethod()
          Method constructor.
OptionsMethod(String uri)
          Constructor specifying a URI.
 
Method Summary
 Enumeration getAllowedMethods()
          Get a list of allowed methods.
 String getName()
          Get the name.
 boolean isAllowed(String method)
          Is the specified method allowed ?
 boolean needContentLength()
          Return true if the method needs a content-length header in the request.
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.
 
Methods inherited from class org.apache.commons.httpclient.HttpMethodBase
, addAuthorizationRequestHeader, addContentLengthRequestHeader, addCookieRequestHeader, addHostRequestHeader, addProxyAuthorizationRequestHeader, addProxyConnectionHeader, addRequestHeader, addRequestHeader, addRequestHeaders, addResponseFooter, addUserAgentRequestHeader, checkNotUsed, checkUsed, execute, fakeResponse, generateRequestLine, getAuthenticationRealm, getContentCharSet, getDoAuthentication, getFollowRedirects, getHostConfiguration, getMethodRetryHandler, getPath, getProxyAuthenticationRealm, getQueryString, getRecoverableExceptionCount, getRequestCharSet, getRequestContentLength, getRequestHeader, getRequestHeaderGroup, getRequestHeaders, getResponseBody, getResponseBodyAsStream, getResponseBodyAsString, getResponseCharSet, getResponseContentLength, getResponseFooter, getResponseFooters, getResponseHeader, getResponseHeaderGroup, getResponseHeaders, getResponseStream, getResponseTrailerHeaderGroup, getStatusCode, getStatusLine, getStatusText, getURI, hasBeenUsed, isConnectionCloseForced, isHttp11, isStrictMode, processResponseBody, processStatusLine, readResponse, readResponseBody, readResponseHeaders, readStatusLine, recycle, releaseConnection, removeRequestHeader, responseBodyConsumed, setConnectionCloseForced, setDoAuthentication, setFollowRedirects, setHostConfiguration, setHttp11, setMethodRetryHandler, setPath, setQueryString, setQueryString, setRequestHeader, setRequestHeader, setResponseStream, setStrictMode, shouldCloseConnection, validate, writeRequest, writeRequestBody, writeRequestHeaders, writeRequestLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

getName

public String getName()
Get the name.
Overrides:
getName in class HttpMethodBase
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

getAllowedMethods

public Enumeration getAllowedMethods()
Get a list of allowed methods.
Returns:
An enumeration of all the allowed methods.
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.

Overrides:
processResponseHeaders in class HttpMethodBase
Parameters:
state - the state information associated with this method
conn - the connection used to execute this HTTP method
Since:
2.0
See Also:
HttpMethodBase.readResponse(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection), HttpMethodBase.readResponseHeaders(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection)

needContentLength

public boolean needContentLength()
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


Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.