Hi
Rama
If you
want to display the client-server communication from the client, you can turn on
debug output:
-d
command line option or "set debug on" from the command line.
The
version that you are using doesn't display the XML responses (it was added 3
days ago)
the
following patch should do the trick... (replace the 2
methods)
or you
can use the latest cvs version or a recent nightly build.
Dirk
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/XMLResponseMethodBase.java
========================================================
protected void
parseXMLResponse(InputStream
input)
throws IOException, HttpException {
if (builder == null) {
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
throw new HttpException
("XML Parser Configuration error: " + e.getMessage());
}
}
try {
responseDocument = builder.parse(new InputSource(input));
} catch (Exception e) {
throw new IOException
("XML parsing error; response stream is not valid XML: "
+ e.getMessage());
}
// init the response table to display the responses during debugging
if (debug > 10) {
initResponseHashtable();
}
}
throws IOException, HttpException {
if (builder == null) {
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
throw new HttpException
("XML Parser Configuration error: " + e.getMessage());
}
}
try {
responseDocument = builder.parse(new InputSource(input));
} catch (Exception e) {
throw new IOException
("XML parsing error; response stream is not valid XML: "
+ e.getMessage());
}
// init the response table to display the responses during debugging
if (debug > 10) {
initResponseHashtable();
}
}
private synchronized void
initResponseHashtable() {
if (responseHashtable == null) {
responseHashtable = new Hashtable();
int status = getStatusCode();
if (status == WebdavStatus.SC_MULTI_STATUS) {
Element multistatus =
getResponseDocument().getDocumentElement();
NodeList list = multistatus.getChildNodes();
if (list != null) {
for (int i = 0; i < list.getLength(); i++) {
try {
Element child = (Element) list.item(i);
String name = DOMUtils.getElementLocalName(child);
String namespace = DOMUtils.getElementNamespaceURI
(child);
if (Response.TAG_NAME.equals(name) &&
"DAV:".equals(namespace)) {
Response response =
new ResponseWithinMultistatus(child);
responseHashtable.put(response.getHref(),
response);
if (debug>10)
System.out.println(response);
}
} catch (ClassCastException e) {
}
}
}
} else if (responseDocument != null) {
Response response = new SingleResponse(responseDocument,
getPath(), status);
responseHashtable.put(response.getHref(), response);
if (debug>10)
System.out.println(response);
}
}
}
if (responseHashtable == null) {
responseHashtable = new Hashtable();
int status = getStatusCode();
if (status == WebdavStatus.SC_MULTI_STATUS) {
Element multistatus =
getResponseDocument().getDocumentElement();
NodeList list = multistatus.getChildNodes();
if (list != null) {
for (int i = 0; i < list.getLength(); i++) {
try {
Element child = (Element) list.item(i);
String name = DOMUtils.getElementLocalName(child);
String namespace = DOMUtils.getElementNamespaceURI
(child);
if (Response.TAG_NAME.equals(name) &&
"DAV:".equals(namespace)) {
Response response =
new ResponseWithinMultistatus(child);
responseHashtable.put(response.getHref(),
response);
if (debug>10)
System.out.println(response);
}
} catch (ClassCastException e) {
}
}
}
} else if (responseDocument != null) {
Response response = new SingleResponse(responseDocument,
getPath(), status);
responseHashtable.put(response.getHref(), response);
if (debug>10)
System.out.println(response);
}
}
}
