3 import org
.apache
.commons
.httpclient
.Credentials
;
4 import org
.apache
.commons
.httpclient
.HostConfiguration
;
5 import org
.apache
.commons
.httpclient
.HttpClient
;
6 import org
.apache
.commons
.httpclient
.HttpConnectionManager
;
7 import org
.apache
.commons
.httpclient
.MultiThreadedHttpConnectionManager
;
8 import org
.apache
.commons
.httpclient
.UsernamePasswordCredentials
;
9 import org
.apache
.commons
.httpclient
.auth
.AuthScope
;
10 import org
.apache
.commons
.httpclient
.params
.HttpConnectionManagerParams
;
11 import org
.apache
.jackrabbit
.webdav
.client
.methods
.PutMethod
;
13 public class WebDavTest
{
18 public static void main(String
[] args
) {
20 HostConfiguration hostConfig
= new HostConfiguration();
21 hostConfig
.setHost("localhost", 8082);
23 HttpConnectionManager connectionManager
= new MultiThreadedHttpConnectionManager();
24 HttpConnectionManagerParams params
= new HttpConnectionManagerParams();
25 int maxHostConnections
= 20;
26 params
.setMaxConnectionsPerHost(hostConfig
, maxHostConnections
);
27 connectionManager
.setParams(params
);
28 HttpClient client
= new HttpClient(connectionManager
);
29 Credentials creds
= new UsernamePasswordCredentials("scanner1",
31 client
.getState().setCredentials(AuthScope
.ANY
, creds
);
32 client
.setHostConfiguration(hostConfig
);
35 PutMethod pm
= new PutMethod(
36 "http://localhost:8082/webdav/scanner1_queque/uploader/image_"
38 String text
= "this is the document content";
39 pm
.setRequestBody(text
);
40 client
.executeMethod(pm
);
41 } catch (Exception e
) {