Just a small tip: Wink contains Spring integration module, and Spring
supports @PostConstruct
and @PreDestroy annotations and also other ways to define such a
functionality.
So if you are already using Spring or if you can declare your resources in
Spring, you can benefit from this technology.

On Tue, Dec 15, 2009 at 2:51 PM, bharathchinnadurai <
[email protected]> wrote:

>
> Hi Bryant,
> Thanks for your reply.
>
> Yes you are right. I was meaninig to those annotations like @PostConstruct
> and @PreDestroy. Do we have any similar annotations that can work with
> Wink?
>
> Using URIInfo seem to solve my problem. But i am concerned that the
> getMatchedResources is returning a list of resource objects. Is there a
> case
> were we can have more than one resource mapped to the same uri? If so can
> you please give an example.
>
> Thanks,
> Bharath C M.
>
>
>
>
> Bryant Luk wrote:
> >
> > Hi,
> >
> > When you ask for annotations, are you talking about annotations like
> > @PostConstruct and @PreDestroy in JSR-250?
> >
> > You could try using RuntimeContext.getUriInfo() and then
> > UriInfo.getMatchedResources() if you want the instance of the class
> > without getting into internal APIs.
> >
> > On Fri, Dec 11, 2009 at 6:28 AM, bharathchinnadurai
> > <[email protected]> wrote:
> >>
> >> Hi all,
> >>
> >> I am writing a rest style web service using Wink and ran into a problem.
> >> The
> >> problem is, I need to execute some code particular to a resource before
> >> and
> >> after the resource is invoked.
> >>
> >> To give a high level background of my software, all my registered
> >> resources
> >> extend from one main resource class. In that main resource class i have
> >> defined few abstract methods, which are implemented by all concrete
> >> resource
> >> classes. I need these abstract methods be called before and after a
> >> resource
> >> is invoked.
> >>
> >> One way to do this is to, get a handle of the resource instance in
> >> request/response handlers using searchresult and call methods we desire
> >> using that instance. I find this a crude way as we are using an internal
> >> class which can change in future. I was wondering if there are any
> >> annotation which can help me in this case.
> >>
> >> I also welcome any design suggestion too.
> >>
> >> Thanks,
> >> Bharath C M
> >>
> >> --
> >> View this message in context:
> >>
> http://n2.nabble.com/resource-pre-post-processing-tp4150945p4150945.html
> >> Sent from the Apache Wink Users mailing list archive at Nabble.com.
> >>
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/resource-pre-post-processing-tp4150945p4169734.html
> Sent from the Apache Wink Users mailing list archive at Nabble.com.
>

Reply via email to