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 2000/12/12 07:11:22 UTC

Headers

Please, consider of the below.

==============================================

CLASS: OptionsMethod
CODE: (required to add)

    public void generateHeaders(String host, State state) {
        super.generateHeaders(host, state);

        setHeader("Connection", "TE, Keep-Alive");
        setHeader("TE", "trailers");
        setHeader("Keep-Alive", "");
    }

CLASS: CopyMethod, MoveMethod
CODE: (required to add)  (need to think of "source:remote to destination:remote")

   public void generateHeaders(String host, State state) {
        super.generateHeaders(host, state);

        setHeader("Connection", "TE");
        setHeader("TE", "trailers");
        setHeader("Destination", destination);
        setHeader("Content-Type", "text/xml; charset=utf-8");

        if (headers.containsKey("cookie")) {
            Vector cookies = state.getCookies();
            setHeader("Cookie", (String) state.getCookies());
        }

        if (!isOverwrite())
            setHeader("Overwrite", "F");

        if (sourceLockToken != null || destinationLockToken != null) {
            StringBuffer sb = new StringBuffer();
            if (sourceLockToken != null) {
                sb.append('<');
                sb.append("http://" + host + path); // rel_URL  getHost(), getPath()?
                sb.append(">  (<");
                sb.append(sourceLockToken);
                sb.append(">)");
            }
            if (sourceLockToken != null && destinationLockToken != null) {
                sb.append(' ');
            }
            if (destinationLockToken != null) {
                sb.append('<');
                sb.append(destination); // abs_URL
                sb.append("> (<");
                sb.append(destinationLockToken);
                sb.append(">)");
            }
            setHeader("If", sb.toString());
        }

        this.state = state;
    }


----- Original Message ----- 
From: "Remy Maucherat" <re...@apache.org>
To: <sl...@jakarta.apache.org>
Sent: Saturday, December 09, 2000 1:46 PM
Subject: Re: yet to use State in WebdavClient?


> > How to distinguish  the local and remote lock token with State in
> WebdavClient.java?
> 
> It should always match a token on the server. So it's remote.
> 
> > And need to think of the request path and destination lock token in COPY,
> MOVE?
> 
> If you own the lock (by using LOCK beforehand), the state should contain the
> appropriate lock token. However, they are not yet added in a "If" header as
> they should be. Coming soon.
> I think locking in the client is not done yet; we're focused on DAV level 1
> functionality right now.
> 
> Remy
> 

Re: Headers

Posted by Remy Maucherat <re...@apache.org>.
> Please, consider of the below.
>
> ==============================================
>
> CLASS: OptionsMethod
> CODE: (required to add)
>
>     public void generateHeaders(String host, State state) {
>         super.generateHeaders(host, state);
>
>         setHeader("Connection", "TE, Keep-Alive");
>         setHeader("TE", "trailers");
>         setHeader("Keep-Alive", "");
>     }

The connection management is taken care of in the WebdavClient. Actually, in
HTTP/1.1, you don't need to add any header to have a persistent connection.
You can set "Connection" to "close" to tell the server to close the
connection after processing the request, and that's it.

"Connection" with value "Keep-Alive" is used for HTTP/1.0 connection
keep-alive. This is something I won't support, because :
- It's obsolete (80% of the webservers out there are HTTP/1.1 compliant)
- It can't be used with dynamic content (it requires that the server sets
the content-length), and a good 50% of the DAV requests are PROPFIND
requests (which are dynamic, so that the connection would have to be closed
anyway)
- WebDAV is an extension to HTTP/1.1

Also, I don't advertize that I support tailing headers yet because I don't
support them ;) Maybe later (it's useful for transfering checksums of the
entity body).

Remy