On Nov 4, 2008, at 7:42 PM, Craig McClanahan wrote:
> Gili wrote:
>> Paul Sandoz wrote:
>>
>>> I like the idea of general support for configuration using a Java
>>> class.
>>>
>>> If say there was a property name:
>>>
>>> com.sun.jersey.multipart.config
>>>
>>> whose value was an instance or a fully qualified class name that
>>> is the class of the instance then it would be very easy to inject
>>> such an instance.
>>>
>>> @JerseyProperty("com.sun.jersey.multipart.config") MailConfig cg;
>>>
>>> Or perhaps define the property name on the MailConfig class instead.
>>>
>>>
>>
>> Alternatively, would this work? Let the MessageReader/Writer
>> expects a
>> MailConfig in its constructor and that instance gets injected by
>> Jersey,
>> Guice or anything else. This approach wouldn't require an explicit
>> property.
>>
> Paul, the InjectableProvider stuff[1] in Jersey would support this,
> right?
Possibly... :-)
> If so, I don't really like the fact that
> ResourceContext is defined in jersey-server (not jersey-core) so it
> would need to be included even on a client application ... but IIRC
> there are some other things that currently require that also.
>
The InjectableProvider functionality is not dependent specifically on
the server, it depends on the implementation of an InjectableProvider.
The general functionality is also used by the client, since message
body readers/writers use it.
The main issue is that the MediaType class, where ever it is, needs to
be registered somehow. If using say Guice then that is no problem. But
if not then it becomes tricker as Jersey does not have such general
component support and i would like to avoid implementing such support
because i am already duplicating some IoC related functionality. Which
is why i suggested registration using the properties and supporting a
simpler mechanism.
Perhaps yet another temptation to depend specifically on an IoC
framework :-) if such a framework can support the requirements of JAX-
RS/Jersey.
Paul.
> Craig
>
> [1] http://blogs.sun.com/sandoz/entry/parameter_beans
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>