dev@jersey.java.net

RE: [Jersey][WebDAV] is Response.status(WebDavStatus) needed?

From: Markus KARG <markus.karg_at_gmx.net>
Date: Mon, 26 Jan 2009 20:03:52 +0100

Paul,

 

I do not agree with anything that you wrote, but please read again my
original posting: I was not asking you to do anything, I asked whether we
can live with the fact that people must write that little ".getStatusCode()"
or whether I really shall supply a complete set of Response and
ResponseBuilder just for this small inconvenience. I personally think we can
live with the fact that ".getStatusCode()" must be written unless JAX-RS 1.1
will enhance the enum by HttpStatus, as I proposed in the tracker. But maybe
all the others think that this is absolutely a no-go and there must be a
special Response and ResponseBuilder. THAT is what I actually wanted to
discuss, maybe I didn't explain clearly enoug...

 

BTW, the WebDAV fluent API I described is not for building the response but
solely for building the entity body (seems this was not clear).

 

Thanks

Markus

 

From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
Sent: Montag, 26. Januar 2009 13:07
To: dev_at_jersey.dev.java.net
Subject: Re: [Jersey][WebDAV] is Response.status(WebDavStatus) needed?

 

Hi Markus,

 

As we have discussed before there is not much we can do about status codes
for enums as the "enum" is not extensible so we can never define an
extensible set, and we can never define a complete, because anything can
extend HTTP. So i think we are discussing stuff we cannot do much about. In
hindsight i wish we never provided an enum of status codes because of such
restrictions.

 

Also Response.ResponseBuilder is not extensible and it is not designed for
ease of use of creating WebDAV specific responses. The solution of a
specific builder, even if there is some duplication, is i think the best
approach and as you indicate in your email on the Fluent API would be most
useful for easily creating WebDAV-based responses.

 

Paul.

 

On Jan 25, 2009, at 7:03 PM, Markus KARG wrote:





WebDAV defines several not HTTP status codes, which currently I have covered
with my own enum. Unfortunately Response.status() does only accept int or
JAX-RS Response.Status (not anything else, e.g . like "everything
implementing a hypothetical Status interface" which would allow for
extensibility).

 

So currently to return a WebDav status code, one must write:

 

return Response.status(ResponseStatus.INSUFFICIENT_STORAGE.getStatusCode())

 

what is not sice nice, since the "getStatusCode()" method must be called to
transform the enum into an int.

 

To solve this, in JAX-RS there is no other solution that to not use Response
but WebDavResponse -- which has to be implemented exactly like Response,
what is a lot of double code and work... :-(

 

So the question is: Is it really annoying that "getStatusCode()" must be
written or do I worry too much about this inconvenience?

 

What do you think? Can we live with that, or is a WebDavResponse class
needed...?

 

Thanks!

Markus