Interceptor | org.apache.wink.server.handlers.HandlersFactory example

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Interceptor | org.apache.wink.server.handlers.HandlersFactory example

flangel
Hi Apache Wink team,

I would like to execute some code just before the REST method is called 
  1. The code would access Http header parameters
  2. I want to bind some information onto the thread that executes the REST method using ThreadLocal
Apache Wink is kind of old (latest post 2010)  and documentation hard to find
  1. Has anyone build an interceptor similar to the one described
  2. Has anyone experience with org.apache.wink.server.handlers.HandlersFactory ? Can I use it for this purpose?
Thanks a lot in advance
Frank

Reply | Threaded
Open this post in threaded view
|

Re: Interceptor | org.apache.wink.server.handlers.HandlersFactory example

Lars-Fredrik Smedberg
Hi Frank

We have been using WebSphere 8.5 for some time now. It uses Wink as the implementation for JAX-RS.

You should have no problem creating CDI Interceptors and applying them to methods in the resource class. We have done that for several use-cases.
Instead of using TLS we use a @RequestScoped bean to pass data around and make it available to the executing thread.

The problem with using the HandlersFactory is that the WINK infrastructure uses new on the class which in turn makes it not CDI managed. 
We then use a similar aproach to the one in DeltaSpike to create and return @ApplicationScoped WINK handlers.

Regards
LF

On Thu, Jun 25, 2015 at 2:45 PM, Frank Langel <[hidden email]> wrote:
Hi Apache Wink team,

I would like to execute some code just before the REST method is called 
  1. The code would access Http header parameters
  2. I want to bind some information onto the thread that executes the REST method using ThreadLocal
Apache Wink is kind of old (latest post 2010)  and documentation hard to find
  1. Has anyone build an interceptor similar to the one described
  2. Has anyone experience with org.apache.wink.server.handlers.HandlersFactory ? Can I use it for this purpose?
Thanks a lot in advance
Frank




--
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at [hidden email], and destroy all copies of this
message and any attachments.
Reply | Threaded
Open this post in threaded view
|

Re: Interceptor | org.apache.wink.server.handlers.HandlersFactory example

flangel
In reply to this post by flangel
Allow a little more precise question

How do I configure wink.handlersFactoryClass without using web.xml ( I am working in an OSGI context). Is there a method that allows me to configure this before starting Apache Wink?

Thanks a lot
Frank


From: Frank Langel <[hidden email]>
Date: Thursday, June 25, 2015 at 2:45 PM
To: <[hidden email]>
Subject: Interceptor | org.apache.wink.server.handlers.HandlersFactory example

Hi Apache Wink team,

I would like to execute some code just before the REST method is called 
  1. The code would access Http header parameters
  2. I want to bind some information onto the thread that executes the REST method using ThreadLocal
Apache Wink is kind of old (latest post 2010)  and documentation hard to find
  1. Has anyone build an interceptor similar to the one described
  2. Has anyone experience with org.apache.wink.server.handlers.HandlersFactory ? Can I use it for this purpose?
Thanks a lot in advance
Frank