Return-Path: Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: (qmail 42127 invoked from network); 16 Feb 2009 11:13:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Feb 2009 11:13:04 -0000 Received: (qmail 75727 invoked by uid 500); 16 Feb 2009 11:12:49 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 75427 invoked by uid 500); 16 Feb 2009 11:12:48 -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 75406 invoked by uid 99); 16 Feb 2009 11:12:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Feb 2009 03:12:48 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.77.186.17] (HELO mx3.progress.com) (192.77.186.17) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Feb 2009 11:12:40 +0000 Received: from mx3.progress.com (127.0.0.1) by mx3.progress.com (MlfMTA v3.2r9) id hj552g0171sb; Mon, 16 Feb 2009 06:12:19 -0500 (envelope-from ) Received: from progress.com ([192.233.92.16]) by mx3.progress.com (SonicWALL 6.2.2.1073) with ESMTP; Mon, 16 Feb 2009 06:12:19 -0500 Received: from NTEXFE01.bedford.progress.com (ntexfe01 [10.128.10.24]) by progress.com (8.13.8/8.13.8) with ESMTP id n1GBCJRv016840; Mon, 16 Feb 2009 06:12:19 -0500 (EST) Received: from MAIL02.bedford.progress.com ([172.16.2.55]) by NTEXFE01.bedford.progress.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 16 Feb 2009 06:12:18 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C99027.6E7A6F25" Subject: JAXRS: Client API - feedback is needed Date: Mon, 16 Feb 2009 06:12:18 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: JAXRS: Client API - feedback is needed Thread-Index: AcmQJ25GBcW7FHrNS3SdEE0l/UPXwQ== From: "Sergey Beryozkin" To: Cc: X-OriginalArrivalTime: 16 Feb 2009 11:12:18.0703 (UTC) FILETIME=[6E6559F0:01C99027] X-Mlf-Version: 6.2.2.1073 X-Mlf-UniqueId: o200902161112190220666 X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01C99027.6E7A6F25 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, =20 Some initial work has been done for CXF JAXRS have its own Client API. The code is at [1]. Some of the design goals were to come up with at least something different compared to what other JAXRS implementations have (Jersey and RestEasy), reuse the existing JAXRS classes and approaches (use of providers), ensure JAXWS users can start playing fast. =20 =20 I've already done some overview at [2]. =20 In short we've tried to do 3 forms of client api for a start. Proxy-based, http-centric and xml-centric.=20 =20 Proxy based api is about people being able to reuse what they've already done on the server side. Root and sub-resource classes can be reused on a client side as proxies, irrespectively of whether they derive the metadata from interfaces or classes. Currently it's not possible to have @Context parameters in resource method signatures, but I'm realizing while typing this text that they actually have to simply ignored on the client side.=20 This style will also encourage users returning annotated interfaces or concrete classes in sub-resource locators. Proxies can be controlled as http-centric clients, except that they can't explicitly do post()/get() or control the way URI gets built. I thought it would make things a bit 'chaotic' if we allowed to do it, if one works with the interface/class then the methods is what drives the way URI gets built and how invocations are made. =20 Every proxy is a Client [3] so one can customize the request headers or check the actual HTTP (JAXRS) Response. One can easily switch to WebClient while preserving the existing proxy settings and back from WebClients to proxies. This might be of interest when working with a set of services, when interfaces are available for only some of them, when investigating at runtime the possibly unexpected proxy response, etc, etc. =20 HTTP-centric api is really about doing HTTP programming [3]. Every WebClient is a Client. Users can deal with Response or typed object responses. There're some utility methods there for a client to navigate back and forward. You'll likely find quite a bit of similarity here with how say Jersey does the client API - but I can assure you it's really a basic common thing to do, things like WebClient.get(T class) for example, or WebClient.form(new Form()). For example, I've started with WebClient.form(MultivaluedMap) but having a little wrapper on top of MultivaluedMap is an obvious thing to do.=20 =20 Finally, we have xml-centric API (nearly non-existent at the moment). It's a subset of http-centric one. One can obviously do=20 =20 StreamSource source =3D new WebClient("http://bar").get(StreamSource.class) =20 and proceed from there. But we'll enhance the XMLSource utility class to highlight the fact that this form of dealing with XML responses is probably the most flexible and robust one. =20 I'd welcome a lot any constructive feedback. There's actually quite a bit work which still needs to be done (chains, spring injection, etc). But what we already have will make it into CXF 2.2 so we'd like to do it as right as possible. Any ideas on what is missing, what may need to be added or changed will be welcome - please send your feedback to cxf lists or contact me directly. If someone could give it a try with the latest CXF trunk and see how natural the client api fits into a specific task then it would be cool... =20 Cheers, Sergey =20 =20 [1] https://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/ja va/org/apache/cxf/jaxrs/client [2] http://sberyozkin.blogspot.com/2009/02/cxf-jaxrs-client-api-preview.html [3] https://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/ja va/org/apache/cxf/jaxrs/client/Client.java [4] https://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/ja va/org/apache/cxf/jaxrs/client/WebClient.java [5] https://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/ja va/org/apache/cxf/jaxrs/client/XMLSource.java =20 =20 =20 =20 ------_=_NextPart_001_01C99027.6E7A6F25--