dev@jsr311.java.net

Re: JSR311: ProviderFactory API needs a bit refactoring?

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 13 Nov 2007 14:16:19 -0500

On Nov 13, 2007, at 1:34 PM, Stefan Tilkov wrote:

> On Nov 8, 2007, at 9:27 PM, Marc Hadley wrote:
>
>> Any further feedback on this before I make the change ? We'd like
>> to include this change in the 0.5 snapshot planned for the end of
>> this week to give the Jersey team a stable target.
>>
>
> Sorry if I'm too late. I thought about including the fact that one's
> a request and the other is a response in the names, but that would
> of course conflict with a potential client API. So:
> +1 (to both the name change and the split into two interfaces).
>
The suggested changes are now part of the 0.5 snapshot:

https://jsr311.dev.java.net/nonav/releases/0.5/index.html

Support for the new split interface is in the trunk of Jersey and
we're working on adding support for provider selection by media type
now.

Marc.


>>
>> On Nov 8, 2007, at 12:54 AM, Liu, Jervis wrote:
>>>>>
>>>> Something like:
>>>>
>>>> public interface MessageBodyReader<T> {
>>>> boolean isReadable(Class<?> type);
>>>> T readFrom(Class<T> type, MediaType mediaType,
>>>> MultivaluedMap<String, String> httpHeaders,
>>>> InputStream entityStream) throws IOException;
>>>> }
>>>>
>>>> and
>>>>
>>>> public interface MessageBodyWriter<T> {
>>>> boolean isWriteable(Class<?> type);
>>>> void writeTo(T t, MediaType mediaType,
>>>> MultivaluedMap<String, Object> httpHeaders,
>>>> OutputStream entityStream) throws IOException;
>>>> long getSize(T t)
>>>> }
>>>>
>>>> with the corresponding:
>>>>
>>>> public abstract class ProviderFactory {
>>>> ...
>>>> public abstract <T> MessageBodyReader<T>
>>>> createMessageBodyReader(Class<T> type, MediaType media);
>>>> public abstract <T> MessageBodyWriter<T>
>>>> createMessageBodyWriter(Class<T> type, MediaType media);
>>>> }
>>>>
>>>
>>> This looks good. Thanks.
>>>
>>> Jervis
>>
>> ---
>> Marc Hadley <marc.hadley at sun.com>
>> CTO Office, Sun Microsystems.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
>> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>

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