users@jersey.java.net

RE: [Jersey] Object injection

From: Grazi, Victor <victor.grazi_at_credit-suisse.com>
Date: Thu, 31 Jul 2008 17:24:02 -0400

Is there any way to access the context directly via injection?
It would be great if we could have an annotation for assigning a context
property
Thanks, Victor

-----Original Message-----
From: Li, Jun
Sent: Thursday, July 31, 2008 5:19 PM
To: users_at_jersey.dev.java.net
Subject: RE: [Jersey] Object injection

Great! We plan to create a resource base class for all the resources.
Thanks,

Jun

-----Original Message-----
From: Marc.Hadley_at_Sun.COM [mailto:Marc.Hadley_at_Sun.COM]
Sent: Thursday, July 31, 2008 5:00 PM
To: users_at_jersey.dev.java.net
Subject: Re: [Jersey] Object injection

Assuming you are using Servlets and the default per-request resource
class lifecycle, then the filter could put the object in the servlet
context and the resource class could extract it in its constructor.

Marc.

On Jul 31, 2008, at 3:47 PM, Li, Jun wrote:

> Hi,
>
> I just wondering if there is a way to inject a object for all the
> GET/PUT/POST/DELETE methods.
> Basically, I have a session filter which extracts an id in the header,

> then I construct a object based on the id.
> And I'd like to pass the object to all the methods in the resources,
> so I don't need to have the exactly same code (although it is just one

> line) in each methods.
>
> Any suggestion?
>
> Thanks,
> Jun
>
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
>
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net
========================================================================
======
Please access the attached hyperlink for an important electronic
communications disclaimer: 
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
========================================================================
======
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net
==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer: 
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================