On Jan 9, 2009, at 9:06 AM, Paul Sandoz wrote:
>>
>> when developing the WebDAV contribution for Jersey, I noticed two
>> aspects which are rather sad for the programmer. I don't know a
>> good solution, so I wanted to discuss this with you: WebDAV Headers
>> and WebDAV Status Codes.
>>
>> WebDAV adds more HTTP headers and status codes which are often used
>> in a lots of places. So it would be great if the programmer doesn't
>> see a difference in HTTP headers and codes and WebDAV headers and
>> acodes support. Unfortunately this seems to be impossible: The
>> support for HTTP status codes in Jersey is basing on
>> Response.Status which is an enum and as such cannot get extended.
>> But other classes expect exactly that enum as a paramter (or will
>> return it). This cannot get extended in any way! Same for headers:
>> Those are defined in an Interface using abstract methods, so I do
>> not see any chance to convince the actual implementation classes to
>> process any WebDAV headers (without changing the core of Jersey).
>>
>
> and JAX-RS. I think there is a fundamental constraint with enum that
> makes this difficult to do anything about it.
>
Internally ResponseBuilder only uses the int value, see the
implementation of ResponseBuilder.status(Status). There are methods to
set the status code using int and Response.getStatus returns an int.
Response.Status is only provided as a convenience and shouldn't
prevent use of other status codes.
Marc.
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.