org.apache.wink.webdav.model
Class Response

java.lang.Object
  extended by org.apache.wink.webdav.model.Response

public class Response
extends Object

The response XML element per the WebDAV specification [RFC 4918]

    Name:       response
    Namespace:  DAV:
    Purpose:    Holds a single response describing the effect of a
    method on resource and/or its properties.
    Description: A particular href MUST NOT appear more than once as the
    child of a response XML element under a multistatus XML element.
    This requirement is necessary in order to keep processing costs for a
    response to linear time.  Essentially, this prevents having to search
    in order to group together all the responses by href.  There are,
    however, no requirements regarding ordering based on href values.
 
    <!ELEMENT response (href, ((href*, status)|(propstat+)),
    responsedescription?) >
 


Field Summary
protected  Error error
           
protected  List<String> href
           
protected  List<Propstat> propstat
           
protected  String responsedescription
           
protected  String status
           
 
Constructor Summary
Response()
           
Response(String href)
           
 
Method Summary
 Error getError()
          Gets the value of the error property.
 List<String> getHref()
          Gets the value of the href property.
 Propstat getOrCreatePropstat(int status, String description, Error error)
          Get a Propstat instance contained within this response that has the provided criteria, or create a new Propstat instance with the provided information if no propstat already exists.
 List<Propstat> getPropstat()
          Gets the value of the propstat property.
 Propstat getPropstat(int status, String description, Error error)
          Get a Propstat instance contained within this response that has the provided criteria.
 String getResponsedescription()
          Gets the value of the responsedescription property.
 String getStatus()
          Gets the value of the status property.
 void setError(Error value)
          Sets the value of the error property.
 void setProperty(Object property, int status)
          Add the provided property to the correct propstat element with the specified Http status.
 void setProperty(Object property, int status, String description, Error error)
          Sets the provided property to the correct propstat element.
 void setPropertyNotFound(Object property)
          Add the provided property to the correct propstat element with an Http status of NOT FOUND.
 void setPropertyOk(Object property)
          Add the provided property to the correct propstat element with an Http status of OK.
 void setResponsedescription(String value)
          Sets the value of the responsedescription property.
 void setStatus(String value)
          Sets the value of the status property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

href

protected List<String> href

status

protected String status

propstat

protected List<Propstat> propstat

error

protected Error error

responsedescription

protected String responsedescription
Constructor Detail

Response

public Response()

Response

public Response(String href)
Method Detail

getHref

public List<String> getHref()
Gets the value of the href property.

This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a set method for the href property.

For example, to add a new item, do as follows:

 getHref().add(newItem);
 

Objects of the following type(s) are allowed in the list String


getStatus

public String getStatus()
Gets the value of the status property.

Returns:
possible object is String

setStatus

public void setStatus(String value)
Sets the value of the status property.

Parameters:
value - allowed object is String

getPropstat

public List<Propstat> getPropstat()
Gets the value of the propstat property.

This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a set method for the propstat property.

For example, to add a new item, do as follows:

 getPropstat().add(newItem);
 

Objects of the following type(s) are allowed in the list Propstat


getPropstat

public Propstat getPropstat(int status,
                            String description,
                            Error error)
Get a Propstat instance contained within this response that has the provided criteria.

Parameters:
status - the Http status code of the propstat to retrieve
description - the description of the propstat to retrieve
error - the error of the propstat to retrieve. Note that when searching for a matching propstat, errors are considered the same only if both errors are null.
Returns:
the Propstat instance if a match is found, or null if no propstats matches all criteria

getOrCreatePropstat

public Propstat getOrCreatePropstat(int status,
                                    String description,
                                    Error error)
Get a Propstat instance contained within this response that has the provided criteria, or create a new Propstat instance with the provided information if no propstat already exists.

Parameters:
status - the Http status code of the propstat to retrieve
description - the description of the propstat to retrieve
error - the error of the propstat to retrieve. Note that when searching for a matching propstat, errors are considered the same only if both errors are null.
Returns:

getError

public Error getError()
Gets the value of the error property.

Returns:
possible object is Error

setError

public void setError(Error value)
Sets the value of the error property.

Parameters:
value - allowed object is Error

getResponsedescription

public String getResponsedescription()
Gets the value of the responsedescription property.

Returns:
possible object is String

setResponsedescription

public void setResponsedescription(String value)
Sets the value of the responsedescription property.

Parameters:
value - allowed object is String

setPropertyOk

public void setPropertyOk(Object property)
Add the provided property to the correct propstat element with an Http status of OK.

See Also:
#setProperty(Object, int, String, Error)}

setPropertyNotFound

public void setPropertyNotFound(Object property)
Add the provided property to the correct propstat element with an Http status of NOT FOUND.

See Also:
#setProperty(Object, int, String, Error)}

setProperty

public void setProperty(Object property,
                        int status)
Add the provided property to the correct propstat element with the specified Http status.

See Also:
#setProperty(Object, int, String, Error)}

setProperty

public void setProperty(Object property,
                        int status,
                        String description,
                        Error error)
Sets the provided property to the correct propstat element. The correct propstat element is selected according to the provided status, description and error parameters.

The following table details the possible Java types of every property (note that the DAV namespace depicts the WebDAV namespace "DAV:")

DAV:creationdate org.apache.wink.webdav.model.Creationdate
DAV:displayname org.apache.wink.webdav.model.Displayname
DAV:getcontentlanguage org.apache.wink.webdav.model.Getcontentlanguage
DAV:getcontentlength org.apache.wink.webdav.model.Getcontentlength
DAV:getcontenttype org.apache.wink.webdav.model.Getcontenttype
DAV:getetag org.apache.wink.webdav.model.Getetag
DAV:getlastmodified org.apache.wink.webdav.model.Getlastmodified
DAV:lockdiscovery org.apache.wink.webdav.model.Lockdiscovery
DAV:resourcetype org.apache.wink.webdav.model.Resourcetype
DAV:supportedlock org.apache.wink.webdav.model.Supportedlock
any other org.w3c.dom.Element

for example, if the property to set is DAV:getcontentlanguage then the property should be an instance of org.apache.wink.webdav.model.Getcontentlanguage.

if the property is K:myprop then the property should be an instance of org.w3c.dom.Element

Parameters:
property - the property to add
status - the status of the property to add
description - the description of the property
error - the error of the property


Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.