See: Description
Interface | Description |
---|---|
DavMethod |
DavMethod ... |
Class | Description |
---|---|
AclMethod |
AclMethod ... |
BaselineControlMethod |
BaselineControlMethod ... |
BindMethod |
BindMethod creates a new binding to a resource. |
CheckinMethod |
CheckinMethod ... |
CheckoutMethod |
CheckoutMethod ... |
CopyMethod |
CopyMethod ... |
DavMethodBase |
DavMethodBase ... |
DeleteMethod |
DeleteMethod ... |
LabelMethod |
LabelMethod ... |
LockMethod |
LockMethod ... |
MergeMethod |
MergeMethod ... |
MkActivityMethod |
MkActivityMethod ... |
MkColMethod |
MkColMethod ... |
MkWorkspaceMethod |
MkWorkspaceMethod ... |
MoveMethod |
MoveMethod ... |
OptionsMethod |
OptionsMethod ... |
OrderPatchMethod |
OrderPatchMethod ... |
PollMethod |
PollMethod implementation. |
PropFindMethod |
PropFindMethod , as specified in
RFC 4918, Section 9.1 |
PropPatchMethod |
PropPatchMethod ... |
PutMethod |
PutMethod ... |
RebindMethod |
RebindMethod replaces a binding to a resource (atomic version of move). |
ReportMethod |
ReportMethod ... |
SearchMethod |
SearchMethod ... |
SubscribeMethod |
SubscribeMethod ... |
UnbindMethod |
UnbindMethod removes a binding to a resource (semantically equivalent to delete). |
UncheckoutMethod |
UncheckoutMethod ... |
UnLockMethod |
UnLockMethod ... |
UnSubscribeMethod |
UnSubscribeMethod ... |
UpdateMethod |
UpdateMethod ... |
VersionControlMethod |
VersionControlMethod ... |
XmlRequestEntity |
XmlRequestEntity ... |
This package contains classes and utilities used to build a WebDAV client
implementation.
Currently it consists of DAV-specific extensions to the
Jakarta Commons HttpClient,
namely a set of methods.
String uri = "http://your-webdav-server"; HostConfiguration hostConfig = new HostConfiguration(); hostConfig.setHost(uri);Define a HttpConnectionManager, which also is responsible for eventual multithreading support:
HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams params = new HttpConnectionManagerParams(); int maxHostConnections = 20; params.setMaxConnectionsPerHost(hostConfig, maxHostConnections); connectionManager.setParams(params);Create the HttpClient object and eventually pass the Credentials:
HttpClient client = new HttpClient(connectionManager); client.setHostConfiguration(hostConfig); Credentials creds = new UsernamePasswordCredentials("userId", "pw"); client.getState().setCredentials(AuthScope.ANY, creds);In order to execute a WebDAV request, choose the appropriate DavMethod. For example, a PROPFIND request could look as follows:
String propfindUri = "http://your-webdav-server/anyresource"; DavMethod method = new PropFindMethod(propfindUri, DavConstants.PROPFIND_ALL_PROP, DavConstants.DEPTH_1); client.executeMethod(method);The DavMethod interface defines two methods that allows you to determine if the request was successfully executed without need to evaluate the status line and knowing about the required status codes:
method.checkSuccess();In case of success you can retrieve the response body in an appropriate formate and process it according to you needs,
MultiStatus multiStatus = method.getResponseBodyAsMultiStatus();
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.