users@jsr311.java.net

Re: more comments to JSR 311

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Thu, 03 Apr 2008 15:57:27 -0400

On Apr 3, 2008, at 2:45 PM, Stephan Koops wrote:
>
> *WebAppExc in MessageBodyWriter*
> Marc, in https://jsr311.dev.java.net/servlets/ReadMsg?list=dev&msgNo=1077
> you wrote, that MessageBodyWriters and StreamingOutputs are allowed
> to throw WebApplicationExceptions. The specification only defines,
> that a runtime environment must catch it in resource methods. The
> javadoc of WebApplicationExceptions says "This acception may be
> thrown by a Web application if a specific HTTP error response needs
> to be produced." IMO this is a little bit vague, that this is also
> allowed in MessageBodyWriter. If it must be allowed, define clearer
> in javadoc or also in the specification. What about
> MessageBodyReaders? Also allowed?
>
I think its desirable to be able to throw exceptions from readers and
writer but we'll hve to be careful not to end up in an infinite loop
(writer throws exception, runtime calls writer to serialize body of
exception, writer throws exception...). Need to think about this some
more.

> *_at_DefaultValue -> @Default ?*
> Because the annotation list on a parameter or field may be long with
> @*Param("....."), perhaps @Encoded, perhaps @DefaultValue("....."),
> than the type and variable name could get long: What about rename
> @DefaultValue to @Default?
>
I was going to suggest a few renamings, I've never been fond of
@ProduceMime or @ConsumeMime. Lets have that discussion after public
review.

> Marc, the chapter Context starts with a little introduction. The
> second line ends with "Such information is available to both
> resource classes (see". I think it is useful to write "both ROOT
> resource class", because the non-root resource classes are not
> instantiated by the runtime and the variables are not injected.
>
OK.

Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.