You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by "Park, Sung-Gu" <je...@thinkfree.com> on 2001/02/05 15:29:22 UTC

Correctly setting the query, XML document

We need to use the query XML document again in a cycle of WebdavClient.
If the request is required to set the authorization, the next following
request in a cycle must be same with the right before XML document.   For
example, except authorization, It occurs in Apache with mod_dav.  Because of
the cookie problem in Apache.  And it's considered for the condition,
propertyNames.hasMoreElements() in PropFindMethod is false, after the first
request.


WebdavMethodBase.java
========================
    /*
     * Holds the query body if set by setQuery.
     */
    protected String query = null;

<snip>

    public void recycle() {
+       query = null;

<snip>




 PropFindMethod.java
========================

    /**
     * Generate the query body.
     *
     * @return String query
     */
    public String generateQuery() {

        /*
         * If the query XML document is already  present,
         * we should use it.
         */
       if (query != null && !query.equals(""))
            return query;

        /*
         * Generate the query body.
         */
        WebdavXMLPrinter printer = new WebdavXMLPrinter();

<snip>
        printer.writeElement("D", "propfind", WebdavXMLPrinter.CLOSING);

+        query = printer.toString();
        if (debug > 1) {
            System.out.println("Request body:");
            System.out.println(query);
        }

+        return query;

PropPatchMethod.java
==================================
<snip>
    public String generateQuery() {

        /*
         * If the query XML document is already  present,
         * use it.
         */
+        if (query != null && !query.equals(""))
            return query;

        /*
         * Generate the query body.
         */
        WebdavXMLPrinter printer = new WebdavXMLPrinter();
<snip>
        printer.writeElement("D", "propertyupdate",
WebdavXMLPrinter.CLOSING);

        query = printer.toString();

+        return query;


LockMethod.java
====================
<snip>
    public String generateQuery() {

        /*
         * If the query XML document is already  present,
         * use it.
         */
        if (query != null && !query.equals(""))
            return query;

-        String result = null;
        /*
         * Generate the query body.
         */
        if (!isRefresh()) {

-                result = stringWriter.getBuffer().toString();
+                query = stringWriter.getBuffer().toString();
            } catch (DOMException e) {
            } catch (ParserConfigurationException e) {
            }
        }

-        return result;
+        return query;