You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by hwaastad <he...@waastad.org> on 2016/10/17 09:00:55 UTC

cxf interceptors in 2.0 api

Hi,
does anyone know if it's possible to use cxf interceptors in jax-rs 2.0
client API in tomee 7?

ex LoggingOutInterceptor.
WebClient usage is obviously ok,

/hw



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/cxf-interceptors-in-2-0-api-tp4680333.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: cxf interceptors in 2.0 api

Posted by hwaastad <he...@waastad.org>.
Hi,
yep, That's what I found out aswell, but feature was what I was looking for.

Thx,

hw



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/cxf-interceptors-in-2-0-api-tp4680333p4680335.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: cxf interceptors in 2.0 api

Posted by Romain Manni-Bucau <rm...@gmail.com>.
https://issues.apache.org/jira/browse/CXF-7098


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-10-19 10:32 GMT+02:00 hwaastad <he...@waastad.org>:

> Let me quote Ben Stiller from the movie Starsky and Hutch: " Do It....Do
> It"
> :-)
>
> Please do.
> I think issues having your name on it probably moves up the priority list
> :-)
>
> thx,
> hw
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/cxf-interceptors-in-2-0-api-tp4680333p4680396.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: cxf interceptors in 2.0 api

Posted by hwaastad <he...@waastad.org>.
Let me quote Ben Stiller from the movie Starsky and Hutch: " Do It....Do It"
:-)

Please do. 
I think issues having your name on it probably moves up the priority list
:-)

thx,
hw



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/cxf-interceptors-in-2-0-api-tp4680333p4680396.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: cxf interceptors in 2.0 api

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Think it comes from your async() usage on the client side. CXF has a multi
phase handling and it leads to having 2 threads doing the logging for fast
executions. Feel free to open a ticket on CXF bugtracker (I can do it as
well if you prefer)


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-10-19 9:04 GMT+02:00 hwaastad <he...@waastad.org>:

> Hi,
> just a simple test
>
> https://github.com/hwaastad/Cxf-Debug.git
>
> /hw
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/cxf-interceptors-in-2-0-api-tp4680333p4680394.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: cxf interceptors in 2.0 api

Posted by hwaastad <he...@waastad.org>.
Hi,
just a simple test

https://github.com/hwaastad/Cxf-Debug.git

/hw



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/cxf-interceptors-in-2-0-api-tp4680333p4680394.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: cxf interceptors in 2.0 api

Posted by Romain Manni-Bucau <rm...@gmail.com>.
hmm, would need a sample to be sure but can it be outputstream or writer is
called twice due to a filter or something like that?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-10-18 9:15 GMT+02:00 hwaastad <he...@waastad.org>:

> Well,
> these are:
> okt 18, 2016 9:08:10 AM org.apache.cxf.interceptor.LoggingOutInterceptor
> INFO: Outbound Message
> ---------------------------
>
> not too much info I guess.
>
> Made my own loggingfeature by extending abstractfeature and logging
> interceptor is only added once.
>
> I observe that the payload is splitted.
>
> ex: first 403:
>
> Payload: on Failed","detail":"ACL Exception Insert Failed due to security
> constraints"},"status":"failure"}
>
> Second 403:
> Payload: {"error":{"message":"Operati
>
>
> Should be:
> Payload: {"error":{"message":"Operation Failed","detail":"ACL Exception
> Insert Failed due to security constraints"},"status":"failure"}
>
> /hw
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/cxf-interceptors-in-2-0-api-tp4680333p4680364.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: cxf interceptors in 2.0 api

Posted by hwaastad <he...@waastad.org>.
Well,
these are:
okt 18, 2016 9:08:10 AM org.apache.cxf.interceptor.LoggingOutInterceptor
INFO: Outbound Message
---------------------------

not too much info I guess.

Made my own loggingfeature by extending abstractfeature and logging
interceptor is only added once.

I observe that the payload is splitted.

ex: first 403:

Payload: on Failed","detail":"ACL Exception Insert Failed due to security
constraints"},"status":"failure"}

Second 403:
Payload: {"error":{"message":"Operati


Should be:
Payload: {"error":{"message":"Operation Failed","detail":"ACL Exception
Insert Failed due to security constraints"},"status":"failure"}

/hw



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/cxf-interceptors-in-2-0-api-tp4680333p4680364.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: cxf interceptors in 2.0 api

Posted by Romain Manni-Bucau <rm...@gmail.com>.
The 2 lines before you copy/paste would be interesting as well. Can be a
lot of things like

- bad logging config
- server and client logs being mixed
- feature being added twice
- ...

You can put a breakpoint in the in interceptor and check it is or not the
same instance maybe.

Le 17 oct. 2016 14:36, "hwaastad" <he...@waastad.org> a écrit :

> BTW,
> not sure if this is a cxf or tomee issue, but I've noticed something
> strange.
>
> I'm invoking an async client and if I register the loggingfeature it prints
> out two response, one with payload, the other without.
>
> Like this:
> ID: 1
> Address: https://myapi/service
> Http-Method: POST
> Content-Type: application/json
> Headers: {Accept=[application/json], Content-Type=[application/json]}
> Payload: {"u_name":"3560c","u_produktid":"strv-12345","u_sh_desc":"3560
> svitsj
> bla","u_model_cat":"bceb7454c3031000b959fd251eba8f42","u_manufacturer":"
> 9abf0bf27139f400234e531439ad1ea0"}
> --------------------------------------
> okt 17, 2016 2:21:49 PM org.apache.cxf.interceptor.LoggingInInterceptor
> INFO: Inbound Message
> ----------------------------
> ID: 1
> Response-Code: 401
> Encoding: UTF-8
> Content-Type: application/json;charset=UTF-8
> Headers: {Cache-control=[no-cache,no-store,must-revalidate,max-age=-1],
> connection=[close], content-type=[application/json;charset=UTF-8],
> Date=[Mon, 17 Oct 2016 12:21:48 GMT], Expires=[0],
> Pragma=[no-store,no-cache], Server=[SN],
> Set-Cookie=[BIGipServerpool_myip=562090506.37438.0000; path=/,
> JSESSIONID=E83C9FEA995F803ABCC8E0215F06E36A;Secure; Path=/; HttpOnly],
> Strict-Transport-Security=[max-age=15768000; includeSubDomains;],
> transfer-encoding=[chunked], WWW-Authenticate=[BASIC realm="SN"]}
> Payload: {"error":{"message":"User Not Authenticated","detail":"Required
> to
> provide Auth information"},"status":"failure"}
> --------------------------------------
> okt 17, 2016 2:21:49 PM org.apache.cxf.interceptor.LoggingInInterceptor
> INFO: Inbound Message
> ----------------------------
> ID: 1
> Response-Code: 401
> Encoding: UTF-8
> Content-Type: application/json;charset=UTF-8
> Headers: {Cache-control=[no-cache,no-store,must-revalidate,max-age=-1],
> connection=[close], content-type=[application/json;charset=UTF-8],
> Date=[Mon, 17 Oct 2016 12:21:48 GMT], Expires=[0],
> Pragma=[no-store,no-cache], Server=[SN],
> Set-Cookie=[BIGipServerpool_myapi=562090506.37438.0000; path=/,
> JSESSIONID=E83C9FEA995F803ABCC8E0215F06E36A;Secure; Path=/; HttpOnly],
> Strict-Transport-Security=[max-age=15768000; includeSubDomains;],
> transfer-encoding=[chunked], WWW-Authenticate=[BASIC realm="SN"]}
> --------------------------------------
>
> So consuming entity will return zero.
>
> Seen this before?
>
> /hw
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/cxf-interceptors-in-2-0-api-tp4680333p4680336.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: cxf interceptors in 2.0 api

Posted by hwaastad <he...@waastad.org>.
BTW,
not sure if this is a cxf or tomee issue, but I've noticed something
strange.

I'm invoking an async client and if I register the loggingfeature it prints
out two response, one with payload, the other without.

Like this:
ID: 1
Address: https://myapi/service
Http-Method: POST
Content-Type: application/json
Headers: {Accept=[application/json], Content-Type=[application/json]}
Payload: {"u_name":"3560c","u_produktid":"strv-12345","u_sh_desc":"3560
svitsj
bla","u_model_cat":"bceb7454c3031000b959fd251eba8f42","u_manufacturer":"9abf0bf27139f400234e531439ad1ea0"}
--------------------------------------
okt 17, 2016 2:21:49 PM org.apache.cxf.interceptor.LoggingInInterceptor
INFO: Inbound Message
----------------------------
ID: 1
Response-Code: 401
Encoding: UTF-8
Content-Type: application/json;charset=UTF-8
Headers: {Cache-control=[no-cache,no-store,must-revalidate,max-age=-1],
connection=[close], content-type=[application/json;charset=UTF-8],
Date=[Mon, 17 Oct 2016 12:21:48 GMT], Expires=[0],
Pragma=[no-store,no-cache], Server=[SN],
Set-Cookie=[BIGipServerpool_myip=562090506.37438.0000; path=/,
JSESSIONID=E83C9FEA995F803ABCC8E0215F06E36A;Secure; Path=/; HttpOnly],
Strict-Transport-Security=[max-age=15768000; includeSubDomains;],
transfer-encoding=[chunked], WWW-Authenticate=[BASIC realm="SN"]}
Payload: {"error":{"message":"User Not Authenticated","detail":"Required to
provide Auth information"},"status":"failure"}
--------------------------------------
okt 17, 2016 2:21:49 PM org.apache.cxf.interceptor.LoggingInInterceptor
INFO: Inbound Message
----------------------------
ID: 1
Response-Code: 401
Encoding: UTF-8
Content-Type: application/json;charset=UTF-8
Headers: {Cache-control=[no-cache,no-store,must-revalidate,max-age=-1],
connection=[close], content-type=[application/json;charset=UTF-8],
Date=[Mon, 17 Oct 2016 12:21:48 GMT], Expires=[0],
Pragma=[no-store,no-cache], Server=[SN],
Set-Cookie=[BIGipServerpool_myapi=562090506.37438.0000; path=/,
JSESSIONID=E83C9FEA995F803ABCC8E0215F06E36A;Secure; Path=/; HttpOnly],
Strict-Transport-Security=[max-age=15768000; includeSubDomains;],
transfer-encoding=[chunked], WWW-Authenticate=[BASIC realm="SN"]}
--------------------------------------

So consuming entity will return zero.

Seen this before?

/hw



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/cxf-interceptors-in-2-0-api-tp4680333p4680336.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: cxf interceptors in 2.0 api

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

we purely rely on cxf for that so that's more a cxf question. I know cxf
features (org.apache.cxf.feature.Feature) have been wired on the jaxrs
client API (I often use the old loggingfeature). I only
checked org.apache.cxf.jaxrs.client.spec.ClientImpl.WebTargetImpl#request()
but I don't think interceptors are directly usable but they are always
wrappable in features.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-10-17 11:00 GMT+02:00 hwaastad <he...@waastad.org>:

> Hi,
> does anyone know if it's possible to use cxf interceptors in jax-rs 2.0
> client API in tomee 7?
>
> ex LoggingOutInterceptor.
> WebClient usage is obviously ok,
>
> /hw
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/cxf-interceptors-in-2-0-api-tp4680333.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>