org.apache.webdav.lib.methods
Interface WebdavMethod

All Known Implementing Classes:
WebdavMethodBase

public interface WebdavMethod

WebDAV method.

Author:
Remy Maucherat

Field Summary
static java.lang.String PROTOCOL
          Protocol version.
 
Method Summary
 boolean followRedirects()
          True if this methods should automatically follow redirects.
 void generateHeaders(java.lang.String host, State state)
          Generate additional headers needed by the request.
 java.lang.String generateQuery()
          Generate the query.
 java.lang.String generateRequestLine()
          Generate the HTTP request line.
 Header getHeader(java.lang.String headerName)
          Get header.
 java.util.Enumeration getHeaders()
          Get headers.
 java.lang.String getName()
          Name property getter.
 java.lang.String getPath()
          Path property getter.
 int getStatusCode()
          Status code property getter.
 java.lang.String getStatusText()
          Status text property getter.
 boolean hasBeenUsed()
          Checks if this method's instance has already been used, and has not been recycled.
 boolean isStreamedQuery()
          Is the query body submitted through an InputStream of with a String.
 boolean needContentLength()
          Return true if the method needs a content-length header in the request.
 void parseResponse(java.io.InputStream is)
          Parse response.
 void processResponseHeaders(java.util.Hashtable headers)
          Process response headers.
 void recycle()
          Recycle the method object, so that it can be reused again.
 void removeHeader(java.lang.String headerName)
          Remove header.
 void setDebug(int debug)
          Debug property setter.
 void setHeader(java.lang.String headerName, java.lang.String headerValue)
          Set header.
 void setParameter(java.lang.String parameterName, java.lang.String parameterValue)
          Set URL parameter.
 void setPath(java.lang.String path)
          Path property setter.
 void setQuery(java.lang.String query)
          Set the query String as a XML document.
 void setQueryString(java.lang.String queryString)
          Set query string.
 void setState(State state)
          Set the state token.
 void setStatusCode(int statusCode)
          Status code property setter.
 void setStatusText(java.lang.String statusText)
          Status text property setter.
 void setUsed()
          Set the method as used.
 void streamQuery(java.io.OutputStream out)
          Stream the body of the query.
 boolean validate()
          Ensures the correctness of the request according to criterions which are method dependent.
 

Field Detail

PROTOCOL

public static final java.lang.String PROTOCOL
Protocol version.
Method Detail

setDebug

public void setDebug(int debug)
Debug property setter.
Parameters:
int - Debug

setUsed

public void setUsed()
Set the method as used.

setStatusCode

public void setStatusCode(int statusCode)
Status code property setter.
Parameters:
int - Status code

getStatusCode

public int getStatusCode()
Status code property getter.
Returns:
int Status code

setStatusText

public void setStatusText(java.lang.String statusText)
Status text property setter.
Parameters:
statusText - Status text

getStatusText

public java.lang.String getStatusText()
Status text property getter.
Returns:
String status text

setPath

public void setPath(java.lang.String path)
Path property setter.
Parameters:
path - Absolute path

getPath

public java.lang.String getPath()
Path property getter.
Returns:
String path

getName

public java.lang.String getName()
Name property getter.
Returns:
String name

setHeader

public void setHeader(java.lang.String headerName,
                      java.lang.String headerValue)
Set header.
Parameters:
headerName - Header name
headerValue - Header value

getHeader

public Header getHeader(java.lang.String headerName)
Get header.
Parameters:
headerName - Header name
Returns:
String header value (null if the header doesn't exist)

removeHeader

public void removeHeader(java.lang.String headerName)
Remove header.
Parameters:
headerName - Header name

hasBeenUsed

public boolean hasBeenUsed()
Checks if this method's instance has already been used, and has not been recycled.
Returns:
boolean True if the method's instance has already been used

followRedirects

public boolean followRedirects()
True if this methods should automatically follow redirects.
Returns:
boolean True if auto redirect should be used for this method

setState

public void setState(State state)
Set the state token.

setParameter

public void setParameter(java.lang.String parameterName,
                         java.lang.String parameterValue)
Set URL parameter.
Parameters:
parameterName - Parameter name
parameterValue - Parameter value

setQueryString

public void setQueryString(java.lang.String queryString)
Set query string.
Parameters:
queryString - Query string

validate

public boolean validate()
Ensures the correctness of the request according to criterions which are method dependent.
Returns:
boolean True if the method is valid

recycle

public void recycle()
Recycle the method object, so that it can be reused again. Any attempt to reuse an object without recycling it will throw a WebdavException.

getHeaders

public java.util.Enumeration getHeaders()
Get headers.
Returns:
Enumeration

generateHeaders

public void generateHeaders(java.lang.String host,
                            State state)
Generate additional headers needed by the request.
Parameters:
state - State token

isStreamedQuery

public boolean isStreamedQuery()
Is the query body submitted through an InputStream of with a String. If an InputStream is available, it's used.
Returns:
boolean True if the content is avalable in an InputStream

generateQuery

public java.lang.String generateQuery()
Generate the query.
Returns:
String query

setQuery

public void setQuery(java.lang.String query)
Set the query String as a XML document. If the query string is already given as an XML document this low level function will set the query string directly. This method make only sense in the context of lock, propFind, and propPatch. In all other cases this method call is ignored.

streamQuery

public void streamQuery(java.io.OutputStream out)
                 throws java.io.IOException
Stream the body of the query. This function should be used to send large request bodies.

processResponseHeaders

public void processResponseHeaders(java.util.Hashtable headers)
Process response headers. The contract of this method is that it only parses the response headers.
Parameters:
headers - Headers list

parseResponse

public void parseResponse(java.io.InputStream is)
                   throws java.io.IOException,
                          WebdavException
Parse response.
Parameters:
is - Input stream

generateRequestLine

public java.lang.String generateRequestLine()
Generate the HTTP request line.
Returns:
String request line

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