it.could.webdav
Class DAVTransaction

java.lang.Object
  extended byit.could.webdav.DAVTransaction

public class DAVTransaction
extends Object

A simple wrapper isolating the Java Servlet API from this WebDAV implementation.

Author:
Pier Fumagalli

Field Summary
static int INFINITY
          The identifyication of the infinity value in the Depth header.
 
Constructor Summary
DAVTransaction(ServletRequest request, ServletResponse response)
          Create a new DAVTransaction instance.
 
Method Summary
 int getDepth()
          Return the depth requested by the client for this transaction.
 URI getDestination()
          Return a URI
 Date getIfModifiedSince()
          Check if the client requested a date-based conditional operation.
 String getMethod()
          Return the path originally requested by the client.
 String getNormalizedPath()
          Return the path originally requested by the client.
 String getOriginalPath()
          Return the path originally requested by the client.
 boolean getOverwrite()
          Return the overwrite flag requested by the client for this transaction.
 int getStatus()
          Set the HTTP status code of the response.
 boolean hasRequestBody()
          Check if there is a body in the request.
 URI lookup(DAVResource resource)
          Look up the final URI of a DAVResource as visible from the HTTP client requesting this transaction.
 InputStream read()
          Read from the body of the original request.
 void setContentType(String type)
          Set the HTTP Content-Type header.
 void setHeader(String name, String value)
          Set an HTTP header in the response.
 void setStatus(int status)
          Set the HTTP status code of the response.
 OutputStream write()
          Write the body of the response.
 PrintWriter write(String encoding)
          Write the body of the response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INFINITY

public static final int INFINITY

The identifyication of the infinity value in the Depth header.

See Also:
Constant Field Values
Constructor Detail

DAVTransaction

public DAVTransaction(ServletRequest request,
                      ServletResponse response)
               throws ServletException

Create a new DAVTransaction instance.

Method Detail

getMethod

public String getMethod()

Return the path originally requested by the client.


getOriginalPath

public String getOriginalPath()

Return the path originally requested by the client.


getNormalizedPath

public String getNormalizedPath()

Return the path originally requested by the client.


getDepth

public int getDepth()

Return the depth requested by the client for this transaction.


getDestination

public URI getDestination()

Return a URI


getOverwrite

public boolean getOverwrite()

Return the overwrite flag requested by the client for this transaction.


getIfModifiedSince

public Date getIfModifiedSince()

Check if the client requested a date-based conditional operation.


setStatus

public void setStatus(int status)

Set the HTTP status code of the response.


getStatus

public int getStatus()

Set the HTTP status code of the response.


setContentType

public void setContentType(String type)

Set the HTTP Content-Type header.


setHeader

public void setHeader(String name,
                      String value)

Set an HTTP header in the response.


hasRequestBody

public boolean hasRequestBody()
                       throws IOException

Check if there is a body in the request.

This method differs from checking if the return value of the read() method is not null as a request body of length zero will return false in this case, while in the read() method will return an empty InputStream.

Throws:
IOException

read

public InputStream read()
                 throws IOException

Read from the body of the original request.

Throws:
IOException

write

public OutputStream write()
                   throws IOException

Write the body of the response.

Throws:
IOException

write

public PrintWriter write(String encoding)
                  throws IOException

Write the body of the response.

Throws:
IOException

lookup

public URI lookup(DAVResource resource)

Look up the final URI of a DAVResource as visible from the HTTP client requesting this transaction.