hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
191 stars 98 forks source link

Possiblitity to pre-/post-process outgoing and incoming http request and response #59

Closed diroza closed 10 years ago

diroza commented 10 years ago

Hello Holger! We are enthusiastic users of your jax-rs-connector and we love it ;-)

Now we are at a point where we need to post-process the outgoing http REST call, e.g. to include a session-id as http header. We also need to pre-process an incoming REST call, e.g. to check for specific HTTP error codes etc.

I am not sure whether an adaption of your jax-rs-connector is needed or we can do this via Jersey Runtime. What we need is a kind of hook mechanism wherer we can interfere the sending/receiving of REST calls.

Thanks for your help. Dirk

larsp commented 10 years ago

Hello Dirk,

this can be done via ContainerResponseFilterand ContainerRequestFilter you just have to make sure it has the proper @Provider annotation and it is registered to the OSGi Service Registry.

Jersey-Filter: https://jersey.java.net/documentation/latest/filters-and-interceptors.html

Hope that helped. Lars

hstaudacher commented 10 years ago

Thanks Lars, will close this issue now.

diroza commented 10 years ago

Hi Lars,

thanks a lot, that's exactly what we needed. And it works perfectly!

Dirk