| java.lang.Object com.ibm.webdav.protocol.http.ResourceHTTPStub
All known Subclasses: com.ibm.webdav.protocol.http.CollectionHTTPStub,
ResourceHTTPStub | public class ResourceHTTPStub implements IRResource(Code) | | Implements a client-side proxy stub of the Resource interface using HTTP plus WebDAV extensions
as a remote procedure call protocol. It does this by creating a WebDAVURLConnection
and dispatching the request to the servlet ResourceHTTPSkel which in turn dispatches
to ResourceImpl. This is the place to see how the DAV4J client API is mapped to
the WebDAV protocol.
|
Constructor Summary | |
public | ResourceHTTPStub() The default constructor. | public | ResourceHTTPStub(String url) Construct a ResourceHTTPStub with the given URL. | public | ResourceHTTPStub(String protocol, String host, int port, String file) Create a ResourceHTTPStub from the given URL components.
Parameters: protocol - the protocol to use, http:, rmi:, or iiop: Parameters: host - the name or IP addres of the server host. | public | ResourceHTTPStub(String protocol, String host, String file) Create a ResourceHTTPStub from the given URL components. | public | ResourceHTTPStub(URL url, TargetSelector targetSelector) Construct a ResourceHTTPStub with the given URL. | public | ResourceHTTPStub(URL context, String spec) Construct a ResourceP with the given URL specification in the given context. |
Method Summary | |
public void | closeContentsOutputStream(ResourceContext context) This method must be called after the client has completed writing to the contents
output stream that was obtained from getContentsOutputStream() . | public void | closeContentsOutputStream(ResourceContext context, String sContentType) | public MultiStatus | copy(ResourceContext context, String destinationURL, boolean overwrite, Vector propertiesToCopy) Copy this resource to the destination URL.
Partial results are possible, check the returned status for details.
Parameters: destinationURL - the destination Parameters: overwrite - true implies overrite the destination if it exists Parameters: propertiesToCopy - a collection of properties that must be copied orthe method will fail. | public MultiStatus | delete(ResourceContext context) Delete this resouce from the server. | public InputStream | getContentsInputStream(ResourceContext context) Get an InputStream for accessing the contents of this resource. | public OutputStream | getContentsOutputStream(ResourceContext context) Get an OutputStream for setting the contents of this resource. | public void | getMetaInformation(ResourceContext context) This method can be used for obtaining meta-information about this resource without
actually reading the resource contents. | public MultiStatus | getProperties(ResourceContext context) Get all the properties for this resource and (potentially) its children. | public MultiStatus | getProperties(ResourceContext context, PropertyName names) Get the named properties for this resource and (potentially) its children. | public MultiStatus | getPropertyNames(ResourceContext context) Get the names of all properties for this resource and (potentially) its children. | protected byte[] | getResponseEntity() Get the response entity for the previous WebDAVURLConnection request. | protected void | getResults() Cause a WebDAVURLConnection request to be sent and get the
status code and message. | public MultiStatus | lock(ResourceContext context, String scope, String type, int timeout, Element owner) Lock this resource collection and potentially all its members
based on the given parameters. | protected MultiStatus | lockResponseToMultiStatus() Convert the response from a LOCK method (an XML multistatus with a prop element
containing a lockdiscovery) into a MultiStatus. | public MultiStatus | move(ResourceContext context, String destinationURL, boolean overwrite, Vector propertiesToMove) Move this resource to the destination URL.
Partial results are possible, check the returned status for details
Parameters: destinationURL - the destination Parameters: overwrite - true implies overrite the destination if it exists Parameters: propertiesToMove - a collection of properties that must be moved orthe method will fail. | public byte[] | performWith(ResourceContext context, String args) This method treats this resource as a method or service, and sends its parameter to
this resource where it is handled in a resource-specific way. | protected void | putRequestEntity(byte[] value) Write the request entity body to the WebDAVURLConnection. | public MultiStatus | refreshLock(ResourceContext context, String lockToken, int timeout) Refresh the lock on this resource by resetting the lock timeout.
The context must contain the proper authorization for the requesting
principal.
Parameters: lockToken - the lock token identifying the lock. Parameters: timeout - the new timeout in seconds. | protected MultiStatus | responseToMultiStatus() Convert the response (an XML multistatus or simple status code) into
a MultiStatus. | public MultiStatus | setProperties(ResourceContext context, Document updates) Edit the properties of a resource. | protected void | setupRequest(String method) Setup a WebDAVURLConnection by opening a connection and setting the
method. | public MultiStatus | unlock(ResourceContext context, String lockToken) Unlock the lock identified by the lockToken on this resource. |
ResourceHTTPStub | public ResourceHTTPStub()(Code) | | The default constructor. Should be rarely used.
|
ResourceHTTPStub | public ResourceHTTPStub(String url) throws java.io.IOException(Code) | | Construct a ResourceHTTPStub with the given URL. The resource having
the url may not exist as this constructor does not access the resource from
the server. Use exists() or attmept to get the contents of the resource to
see if it exists. Other constructors are provided using parameters for the
various parts of the URL. See java.net.URLConnection for details.
Parameters: url - the URL of the resource. exception: MalformedURLException - exception: java.io.IOException - See Also: URLConnection See Also: com.ibm.webdav.ResourceFactory |
ResourceHTTPStub | public ResourceHTTPStub(String protocol, String host, int port, String file) throws java.io.IOException(Code) | | Create a ResourceHTTPStub from the given URL components.
Parameters: protocol - the protocol to use, http:, rmi:, or iiop: Parameters: host - the name or IP addres of the server host. Using the client host name,or 'localhost' without a port uses local access with no RPC or server required. Parameters: port - the TCP port to use. HTTP uses 80 by default. Parameters: file - the resource URL relative to the server including any query string, etc. exception: java.io.IOException - See Also: URLConnection See Also: com.ibm.webdav.ResourceFactory |
ResourceHTTPStub | public ResourceHTTPStub(String protocol, String host, String file) throws java.io.IOException(Code) | | Create a ResourceHTTPStub from the given URL components. This constructor uses the default
HTTP port.
Parameters: protocol - the protocol to use, http:, rmi:, or iiop: Parameters: host - the name or IP addres of the server host. Using the client host name,or 'localhost' without a port uses local access with no RPC or server required. Parameters: file - the resource URL relative to the server including any query string, etc. exception: java.io.IOException - See Also: URLConnection See Also: com.ibm.webdav.ResourceFactory |
ResourceHTTPStub | public ResourceHTTPStub(URL url, TargetSelector targetSelector) throws WebDAVException(Code) | | Construct a ResourceHTTPStub with the given URL. The resource having
the url may not exist as this constructor does not access the resource from
the server. Use exists() or attmept to get the contents of the resource to
see if it exists. Other constructors are provided using parameters for the
various parts of the URL. See java.net.URLConnection for details.
Parameters: url - the URL of the resource. Parameters: targetSelector - the revision target selector for this Collection exception: com.ibm.webdav.WebDAVException - See Also: URLConnection See Also: com.ibm.webdav.ResourceFactory |
ResourceHTTPStub | public ResourceHTTPStub(URL context, String spec) throws java.io.IOException(Code) | | Construct a ResourceP with the given URL specification in the given context. The resource having
the url may not exist as this constructor does not access the resource from
the server. Use exists() or attmept to get the contents of the resource to
see if it exists. Other constructors are provided using parameters for the
various parts of the URL. See java.net.URLConnection for details.
Parameters: context - a URL giving the context in which the spec is evaluated Parameters: spec - a URL whose missing parts are provided by the context exception: java.io.IOException - See Also: URLConnection See Also: com.ibm.webdav.ResourceFactory |
copy | public MultiStatus copy(ResourceContext context, String destinationURL, boolean overwrite, Vector propertiesToCopy) throws WebDAVException(Code) | | Copy this resource to the destination URL.
Partial results are possible, check the returned status for details.
Parameters: destinationURL - the destination Parameters: overwrite - true implies overrite the destination if it exists Parameters: propertiesToCopy - a collection of properties that must be copied orthe method will fail. propertiesToCopy may have one of the following values:- null - ignore properties that cannot be copied
- empty collection - all properties must be copied or the method will fail
- a collection of URIs - a list of the properties that must be copiedor the method will fail
the status of the copy operation for each resource copied exception: com.ibm.webdav.WebDAVException - |
delete | public MultiStatus delete(ResourceContext context) throws WebDAVException(Code) | | Delete this resouce from the server. The actual effect of the delete operation is
determined by the underlying repository manager. The visible effect to WebDAV
is that the resource is no longer available.
a MultiStatus containing the status of the delete method on eacheffected resource. exception: com.ibm.webdav.WebDAVException - |
getContentsInputStream | public InputStream getContentsInputStream(ResourceContext context) throws WebDAVException(Code) | | Get an InputStream for accessing the contents of this resource. This method may provide
more efficient access for resources that have large contents. Clients may want to create
a Reader to perform appropriate character conversions on this stream.
an InputStream on the contents exception: com.ibm.webdav.WebDAVException - |
getContentsOutputStream | public OutputStream getContentsOutputStream(ResourceContext context) throws WebDAVException(Code) | | Get an OutputStream for setting the contents of this resource. This method may provide
more efficient access for resources that have large contents. Remember to call
closeContentsOutputStream() when all the data has been written.
an OutputStream to set the contents exception: com.ibm.webdav.WebDAVException - |
getMetaInformation | public void getMetaInformation(ResourceContext context) throws WebDAVException(Code) | | This method can be used for obtaining meta-information about this resource without
actually reading the resource contents. This meta-information is maintained by the server
in addition to the resource properties. The meta-information is obtained from an
HTTP HEAD method.
After this call, the resource context has been updated and
getStatusCode() , getStatusMessage() , and getResponseContext()
as well as all the ResourceContext methods return updated values based on the current
state of the resource.
This methods corresponds to the HTTP HEAD method.
Do a getContentsInputStream() to set the response context,
then just don't return the stream.
exception: com.ibm.webdav.WebDAVException - |
getProperties | public MultiStatus getProperties(ResourceContext context) throws WebDAVException(Code) | | Get all the properties for this resource and (potentially) its children.
Parameters: depth - an indicator for immediate members or recursively all children.- thisResource: propeprties of this resource
- immediateMembers: propeprties of this resource and its immediate children
- allMembers: properties of this resource and recursively all its children
a MultiStatus of PropertyResponses exception: com.ibm.webdav.WebDAVException - |
getProperties | public MultiStatus getProperties(ResourceContext context, PropertyName names) throws WebDAVException(Code) | | Get the named properties for this resource and (potentially) its children.
Parameters: names - an arrary of property names to retrieve. Parameters: depth - an indicator for immediate members or recursively all children.- immediateMembers: propeprties of this resource and its immediate children
- allMembers: properties of this resource and recursively all its children
a MultiStatus of PropertyResponses exception: com.ibm.webdav.WebDAVException - |
getPropertyNames | public MultiStatus getPropertyNames(ResourceContext context) throws WebDAVException(Code) | | Get the names of all properties for this resource and (potentially) its children.
Parameters: depth - an indicator for immediate members or recursively all children.- thisResource: propeprties of this resource
- immediateMembers: propeprties of this resource and its immediate children
- allMembers: properties of this resource and recursively all its children
a MultiStatus of PropertyResponses(PropertyValue.value is always null, PropertyValue.status contains the status) exception: com.ibm.webdav.WebDAVException - |
getResults | protected void getResults() throws WebDAVException(Code) | | Cause a WebDAVURLConnection request to be sent and get the
status code and message. After this method has been called,
getResponseEntity() can be called.
exception: com.ibm.webdav.WebDAVException - |
lock | public MultiStatus lock(ResourceContext context, String scope, String type, int timeout, Element owner) throws WebDAVException(Code) | | Lock this resource collection and potentially all its members
based on the given parameters. This allows control of the lock
scope (exclusive or shared) the lock type (write), owner information, etc.
Parameters: scope - the scope of the lock, exclusive or shared Parameters: type - the type of the lock, currently only write Parameters: timeout - the number of seconds before the lock times out or0 for infinite timeout. Parameters: owner - an XML element containing useful information that can beused to identify the owner of the lock. An href to a home page, anemail address, phone number, etc. Can be null if no owner informationis provided. a MultiStatus containing a lockdiscovery property indicatingthe results of the lock operation. exception: com.ibm.webdav.WebDAVException - |
lockResponseToMultiStatus | protected MultiStatus lockResponseToMultiStatus() throws WebDAVException(Code) | | Convert the response from a LOCK method (an XML multistatus with a prop element
containing a lockdiscovery) into a MultiStatus.
a MultiStatus created from the DAV:multistatus from a LOCK method exception: com.ibm.webdav.ServerException - thrown if there is a syntax error in the XML DAV:multistatus |
move | public MultiStatus move(ResourceContext context, String destinationURL, boolean overwrite, Vector propertiesToMove) throws WebDAVException(Code) | | Move this resource to the destination URL.
Partial results are possible, check the returned status for details
Parameters: destinationURL - the destination Parameters: overwrite - true implies overrite the destination if it exists Parameters: propertiesToMove - a collection of properties that must be moved orthe method will fail. propertiesToMove may have one of the following values:- null - ignore properties that cannot be moved
- empty collection - all properties must be moved or the method will fail
- a collection of URIs - a list of the properties that must be movedor the method will fail
the status of the move operation for each resource moved exception: com.ibm.webdav.WebDAVException - |
performWith | public byte[] performWith(ResourceContext context, String args) throws WebDAVException(Code) | | This method treats this resource as a method or service, and sends its parameter to
this resource where it is handled in a resource-specific way. For example,
sending data from an HTML form to a URL representing a Servlet or CGI script that processes
the form data to produce some result.
Parameters: args - a string representing the arguments to the method represented by this URL. Thearguments are in the form ?parameterName1=value1¶meterName2=value2... as specifiedfor URL queries. the results of sending the arguments to the URL exception: com.ibm.webdav.WebDAVException - |
refreshLock | public MultiStatus refreshLock(ResourceContext context, String lockToken, int timeout) throws WebDAVException(Code) | | Refresh the lock on this resource by resetting the lock timeout.
The context must contain the proper authorization for the requesting
principal.
Parameters: lockToken - the lock token identifying the lock. Parameters: timeout - the new timeout in seconds. -1 means infinite timeout. updated information about the lock status of this resource exception: com.ibm.webdav.WebDAVException - |
responseToMultiStatus | protected MultiStatus responseToMultiStatus() throws WebDAVException(Code) | | Convert the response (an XML multistatus or simple status code) into
a MultiStatus.
a MultiStatus constructed from a DAV:multistatus or response code exception: com.ibm.webdav.ServerException - thrown if there is a syntax error in the DAV:multistatus |
setProperties | public MultiStatus setProperties(ResourceContext context, Document updates) throws WebDAVException(Code) | | Edit the properties of a resource. The updates must refer to a Document containing a WebDAV
DAV:propertyupdates element as the document root.
Parameters: updates - an XML Document containing DAV:propertyupdate elementsdescribing the edits to be made a MultiStatus indicating the status of the updates exception: com.ibm.webdav.WebDAVException - |
setupRequest | protected void setupRequest(String method) throws WebDAVException(Code) | | Setup a WebDAVURLConnection by opening a connection and setting the
method. This should be done before outputting any request entity body.
Parameters: method - the HTTP/1.1 or WebDAV request method exception: com.ibm.webdav.WebDAVException - |
unlock | public MultiStatus unlock(ResourceContext context, String lockToken) throws WebDAVException(Code) | | Unlock the lock identified by the lockToken on this resource. The request context
must contain the proper authorization.
Parameters: lockToken - the lock token obtained from the ActiveLock of a previous lock() or getLocks() . a MultiStatus containing any responses on resources that could notbe unlocked. exception: com.ibm.webdav.WebDAVException - |
|
|