Return-Path: X-Original-To: apmail-cxf-dev-archive@www.apache.org Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C59C819605 for ; Wed, 23 Mar 2016 16:40:51 +0000 (UTC) Received: (qmail 79778 invoked by uid 500); 23 Mar 2016 16:40:51 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 79699 invoked by uid 500); 23 Mar 2016 16:40:51 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Received: (qmail 79687 invoked by uid 99); 23 Mar 2016 16:40:51 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Mar 2016 16:40:51 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id CCE8BC059B for ; Wed, 23 Mar 2016 16:40:50 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id ofXNp918wQXW for ; Wed, 23 Mar 2016 16:40:49 +0000 (UTC) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id F0AA95F1B8 for ; Wed, 23 Mar 2016 16:40:48 +0000 (UTC) Received: by mail-lb0-f179.google.com with SMTP id oe12so14240062lbc.0 for ; Wed, 23 Mar 2016 09:40:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=/+tphMxvQlGX6L7q/RM6/uE0Br521w1N/Xhqb+ccWDo=; b=q7dNtM7sA+UXKpoGmbV0K2qWcpxXH67Awy0n4NOPUEVUu3We5s52NMm8kEnWI1Nu8W iQEWz9cgao3U+3e59kZ119OiH5oKT9Oh+x5WVLSheujxBp9/uq526gTNGvXJQ4XawYwY FjlkNQS3XXHEcuxYFCSHrdiQPDOzxJwIQLr0crNIc4V5yonicrOvDCa/eyiWTl6gEx9u IlvRpQG7sIfxD48gNyj3iaK2T+HEJsvR3LY1Fahh3CrD4fD5norZDrKRd+uzRMOcS66b ecYzCzehErb7V8APzsKmTwIT9GjYbW6GhWV6mRXYvRsSP33KYvfjOrJ5ExLaKwPvrj+L E/OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=/+tphMxvQlGX6L7q/RM6/uE0Br521w1N/Xhqb+ccWDo=; b=XmV8+ofH52AwkhR8ATvr+mtl3ZnuU7NW7EupNymjlZasZcZsSYOSd+y2W8NHo4AJfe 0zwySKdyEDT8T8jw7IrTgMSfFWCSyEYenWXyH7VTi8VWlz+f5O7LLtWI1JAaz9L68FQN H4GtO/3ZSy78VZyn5BZLmVUWQRxw5uSzrP06kgQsCTwtHECOw3UPLqpJYjxrn6uiOhgb AAm/k/lwr5YqXzrzGjnLWEfDC1wI2VYic+MYtFYEo2OJQ8Acbatj4MoLgItCGEJRkgnc VX60OyJ2SsVX9dLjBtMaAuEfgy2Q1/bB4WftpDVlqVF7b2pNsUEjUOgTuJhGneGhFsXg 72yw== X-Gm-Message-State: AD7BkJJJMYZuJG5Qol0E/Ottp12i7MGermwWCTUy+y80FJ2vHEDq4FnSXKLV7e8Ua1FNurGbTiPt+a9vhynA1Q== MIME-Version: 1.0 X-Received: by 10.112.50.80 with SMTP id a16mr1644265lbo.82.1458751247654; Wed, 23 Mar 2016 09:40:47 -0700 (PDT) Received: by 10.112.141.196 with HTTP; Wed, 23 Mar 2016 09:40:47 -0700 (PDT) Received: by 10.112.141.196 with HTTP; Wed, 23 Mar 2016 09:40:47 -0700 (PDT) In-Reply-To: <56F10B05.8090603@gmail.com> References: <56F10B05.8090603@gmail.com> Date: Wed, 23 Mar 2016 17:40:47 +0100 Message-ID: Subject: Re: Using Interceptors on JAX-RS 2.0 Client From: =?UTF-8?B?RWlyaWsgQmrDuHJzbsO4cw==?= To: dev@cxf.apache.org Content-Type: multipart/alternative; boundary=001a1133b3e6eea589052eb9fd1a --001a1133b3e6eea589052eb9fd1a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sergey, Our observation (with 3.0.3 I think) was that the feature was not ignored, but instead initialized once per request. Which added new interceptors to the WebClient on every request. Not sure I understand the intention behind this design. I think I just assumed that I could use Interceptors for JAX-RS clients just like JAX-WS. We could and probably will rewrite these to JAX-RS filters, but it would of course be even sweeter if we could simply reuse the logging interceptors we currently use for our SOAP services. Cheers, Eirik. On Mar 22, 2016 10:08 AM, "Sergey Beryozkin" wrote: > Hi > > It is not possible to register CXF specific Feature or Interceptor > with JAX-RS 2.0 Client API. > > When you do "client.register(new MyLoggingFeature())", assuming it is CXF > Feature, then it will be currently ignored. > > I wonder if it might make sense to create some JAX-RS 2.0 FeatureWrapper > which can wrap an arbitrary CXF Feature...I'll try to experiment with it.= .. > > Sergey > > > > On 22/03/16 01:56, Eirik Bj=C3=B8rsn=C3=B8s wrote: > >> Hello, >> >> Is the CXF implementation of the JAX-RS 2.0 client API designed to allow >> Interceptors to be configured on Clients? If so, how should this be done= ? >> >> Say we have a Client built like this: >> >> Client client =3D ClientBuilder.newClient(); >> >> and we want to configure Logging[In/Out]Interceptors of this client. (Ju= st >> as an example). >> >> First I tried in various ways to get an Endpoint out of the client, but >> failed at that. >> >> Then, after looking through the implementation classes of >> Client/WebTarget, >> I discovered that you can register CXF Features on a Client using >> something >> like >> >> client.register(new MyLoggingFeature()); >> >> However, with this setup MyLoggingFeature.initialize(InterceptorProvider >> ip, Bus bus) is called _once per request_. >> >> Not exactly what I wanted since it lead to the interceptor chains being >> filled up with duplicate LoggingInterceptors. >> >> I might perhaps have misunderstood the lifecycle of Clients and/or >> WebTargets. Should be ok to reuse a JAX-RS 2.0 Client, right? >> >> Can someone please enlighten me? Did I perhaps miss some relevant >> documentation? >> >> Cheers, >> Eirik. >> >> > --001a1133b3e6eea589052eb9fd1a--