Author: areshetnyak
Date: 2009-12-29 09:02:02 -0500 (Tue, 29 Dec 2009)
New Revision: 1236
Modified:
jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
Log:
EXOJCR-330 : The cluster.test.client was changed.
Modified:
jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
===================================================================
---
jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java 2009-12-29
13:38:10 UTC (rev 1235)
+++
jcr/branches/1.12.0-JBCCACHE/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java 2009-12-29
14:02:02 UTC (rev 1236)
@@ -20,6 +20,7 @@
import javax.ws.rs.core.HttpHeaders;
+import org.exoplatform.common.http.client.CookieModule;
import org.exoplatform.common.http.client.HTTPConnection;
import org.exoplatform.common.http.client.HTTPResponse;
import org.exoplatform.common.http.client.HttpHeaderElement;
@@ -50,6 +51,8 @@
{
super(host, port);
+ CookieModule.setCookiePolicyHandler(null);
+
this.user = user;
this.pass = password;
this.realm = realm;
@@ -58,16 +61,18 @@
addBasicAuthorization(this.realm, this.user, this.pass);
}
- public void addNode(String name, byte[] data) throws IOException, ModuleException
+ public HTTPResponse addNode(String name, byte[] data) throws IOException,
ModuleException
{
- Put(workspacePath + name, data).getStatusCode();
+ HTTPResponse response = Put(workspacePath + name, data);
+ response.getStatusCode();
+ return response;
}
public void addNode(String name, String nodeType, byte[] data) throws IOException,
ModuleException
{
NVPair[] headers = new NVPair[1];
headers[0] = new NVPair("File-NodeType", nodeType);
- Put(workspacePath + name, data).getStatusCode();
+ Put(workspacePath + name, data, headers).getStatusCode();
}
public HTTPResponse addNode(String name, HttpOutputStream stream) throws IOException,
ModuleException
@@ -93,7 +98,7 @@
}
- public void addProperty(String nodeName, String property) throws IOException,
ModuleException
+ public HTTPResponse addProperty(String nodeName, String property) throws IOException,
ModuleException
{
String xmlBody =
"<?xml version='1.0' encoding='utf-8' ?>" +
"<D:propertyupdate xmlns:D='DAV:'>" + "<D:set>" +
"<D:prop>" + "<"
@@ -103,10 +108,13 @@
headers[0] = new NVPair(HttpHeaders.CONTENT_TYPE, "text/xml;
charset='utf-8'");
headers[1] = new NVPair(HttpHeaders.CONTENT_LENGTH,
Integer.toString(xmlBody.length()));
- ExtensionMethod("PROPPATCH", workspacePath + nodeName,
xmlBody.getBytes(), headers).getStatusCode();
+ HTTPResponse response = ExtensionMethod("PROPPATCH", workspacePath +
nodeName, xmlBody.getBytes(), headers);
+ response.getStatusCode();
+
+ return response;
}
- public void setProperty(String nodeName, String property, String value) throws
IOException, ModuleException
+ public HTTPResponse setProperty(String nodeName, String property, String value) throws
IOException, ModuleException
{
String xmlBody =
"<?xml version='1.0' encoding='utf-8' ?>" +
"<D:propertyupdate xmlns:D='DAV:'>" + "<D:set>" +
"<D:prop>" + "<"
@@ -119,9 +127,28 @@
HTTPResponse response = ExtensionMethod("PROPPATCH", workspacePath +
nodeName, xmlBody.getBytes(), headers);
response.getStatusCode();
+ return response;
}
+
+ public HTTPResponse getProperty(String nodeName, String property) throws IOException,
ModuleException
+ {
+ String xmlBody =
+ "<?xml version='1.0' encoding='utf-8' ?>"
+ + "<D:propfind xmlns:D='DAV:' >"
+ + "<D:prop><" + property +
"/></D:prop>"
+ + "</D:propfind>";
- public void removeProperty(String nodeName, String property) throws IOException,
ModuleException
+ NVPair[] headers = new NVPair[2];
+ headers[0] = new NVPair(HttpHeaders.CONTENT_TYPE, "text/xml;
charset='utf-8'");
+ headers[1] = new NVPair(HttpHeaders.CONTENT_LENGTH,
Integer.toString(xmlBody.length()));
+
+ HTTPResponse response = ExtensionMethod("PROPFIND", workspacePath +
nodeName, xmlBody.getBytes(), headers);
+ response.getStatusCode();
+
+ return response;
+ }
+
+ public HTTPResponse removeProperty(String nodeName, String property) throws
IOException, ModuleException
{
String xmlBody =
"<?xml version='1.0' encoding='utf-8' ?>"
@@ -132,7 +159,10 @@
headers[0] = new NVPair(HttpHeaders.CONTENT_TYPE, "text/xml;
charset='utf-8'");
headers[1] = new NVPair(HttpHeaders.CONTENT_LENGTH,
Integer.toString(xmlBody.length()));
- ExtensionMethod("PROPPATCH", workspacePath + nodeName,
xmlBody.getBytes(), headers).getStatusCode();
+ HTTPResponse response = ExtensionMethod("PROPPATCH", workspacePath +
nodeName, xmlBody.getBytes(), headers);
+ response.getStatusCode();
+
+ return response;
}
public String lock(String nodeName) throws IOException, ModuleException
@@ -203,7 +233,7 @@
{
MkCol(workspacePath + path).getStatusCode();
}
-
+
public void restore(String node, String version) throws IOException, ModuleException
{
NVPair[] query = new NVPair[1];