----- Original Message -----
From: "Pill, Juergen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 22, 2001 8:41 AM
Subject: client-webdav-method header setting


> Hello,
>
> The client WebdavMethods have two possibilities to set their headers:
>
> 1) setHeader(name, value);
> 2) some specialized method to set some special headers (not available for
> all methods): setOverwrite, setdepth, ...
>
> Unfortunately the setHeader method can not be used to set the special
> headers, but instead the specialized method needs to be used.
> This is a little bit unfortunate, because it causes some additional coding
> in the application, if the header pair is already known in a generic
> application (see coding example at the end).

We're not the only one, actually. The Servlet API does the same with content
length, among others. That's confusing IMO.

> I want to suggest following change:
>
> All client WebdavMethod classes stay with their special implementation of
> the specific header setting methods (as it is today) and these classes
> additionally overwrite the setHeader method in a way, that if a special
> header is set, the specific header setting method is called, else the call
> is delegated to the super(...) method (this would reduce our fillheader
> method to few lines and we would be sure we covered all special headers).
>
> e.g.
>
> setHeader(String name, String value) {
> if (value.equalsIgnoreCase("depth") {
> setDepth(value.toInteger()); // will not really compile
> }
> else {
> super(name, value);
> }
> }
>
>
>
> What do you think?

+1
Of course, there is no way to enforce it, but it's a good idea that at least
our methods are designed like that.

I'm considering moving the XML formatter and facades to
org.apache.slide.webdav.logger (in the WebDAV server tree), since it's
servlet related classes. Or maybe I could put it in the org.apache.util
package.

Remy

Reply via email to