On Jun 25, 2009, at 10:59 PM, Meeraj Kunnumpurath wrote:
> Thanks Paul, pls see my comments below.
>
> On Thu, Jun 25, 2009 at 9:25 AM, Paul Sandoz <Paul.Sandoz_at_sun.com>
> wrote:
>
> On Jun 24, 2009, at 10:00 PM, Meeraj Kunnumpurath wrote:
>
>> Thanks for the quick reply Paul. Please see my comments inline ..
>>
>> On Wed, Jun 24, 2009 at 8:17 PM, Paul Sandoz <Paul.Sandoz_at_sun.com>
>> wrote:
>> Hi Meeraj,
>>
>> Using a MessageBodyReader is not really the write place to do this.
>>
>> The quick solution, using Jersey specific stuff, do the following:
>>
>>
>> @Path("/myResource")
>> public MyResource {
>> @GET
>> public String myMethod(@Context ResourceContext rc) {
>> CustomType ct = rc.get(CustomType.class);
>> }
>> }
>> Are there any convetions on CustomType? Also, can I annotate
>> injection sites within CustomType with @QueryParam, @PathParam etc?
>
> I do not understand your question, can you present an example?
> For eg, does the custom type need to follow Java beans pattern for
> query parameters, form parameters etc to be injected.
>
> public class CustomType {
> private String foo;
> private double bar;
>
> @QueryParam
> public void setFoo(String foo) {
> this.foo = foo;
> }
>
> @Formparam
> public void setBar(int bar) {
> this.bar = bar;
> }
>
> }
>
> Or does it support field level injection, constructor injection etc?
It supports all the injection semantics one would expect on root
resource classes: constructor, method and field.
Paul.