Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5E4F59181 for ; Tue, 2 Oct 2012 15:48:12 +0000 (UTC) Received: (qmail 1916 invoked by uid 500); 2 Oct 2012 15:48:12 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 1865 invoked by uid 500); 2 Oct 2012 15:48:12 -0000 Mailing-List: contact commits-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 commits@cxf.apache.org Received: (qmail 1857 invoked by uid 99); 2 Oct 2012 15:48:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Oct 2012 15:48:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Oct 2012 15:48:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D470E2388A3D for ; Tue, 2 Oct 2012 15:47:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r833758 - in /websites/production/cxf/content: cache/docs.pageCache docs/27-migration-guide.html docs/jax-rs-basics.html docs/jax-rs-client-api.html Date: Tue, 02 Oct 2012 15:47:26 -0000 To: commits@cxf.apache.org From: buildbot@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121002154726.D470E2388A3D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: buildbot Date: Tue Oct 2 15:47:26 2012 New Revision: 833758 Log: Production update by buildbot for cxf Modified: websites/production/cxf/content/cache/docs.pageCache websites/production/cxf/content/docs/27-migration-guide.html websites/production/cxf/content/docs/jax-rs-basics.html websites/production/cxf/content/docs/jax-rs-client-api.html Modified: websites/production/cxf/content/cache/docs.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/cxf/content/docs/27-migration-guide.html ============================================================================== --- websites/production/cxf/content/docs/27-migration-guide.html (original) +++ websites/production/cxf/content/docs/27-migration-guide.html Tue Oct 2 15:47:26 2012 @@ -125,8 +125,8 @@ Apache CXF -- 2.7 Migration Guide
  • New UDP Transport.
  • New optional HTTP transport based on Apache HTTP Components HttpAsyncClient.
  • Support for the SOAP over UDP.
  • Ability to only apply schema validation to incoming or outgoing messages by setting the "schema-validation-enabled" property to "IN", "OUT", "BOTH", or "NONE". @SchemaValidationEnabled annotation updated to have a type=IN|OUT|BOTH|NONE parameter.
  • Support for WS-Discovery.
    • Services can send Hello/Bye when started/stopped as well as respond to Probe requests
    • API for sending probes and resolving to EndpointReferences
    -
  • Initial support for parts of the JAX-RS 2.0 specification -
    • Additional methods on WebClient to provide asynchronous invocations
    +
  • Initial support for parts of the JAX-RS 2.0 (JSR-339) specification +
    • Additional methods on WebClient to provide asynchronous invocations
    • Support for new filters, interceptors, dynamic features, exception classes, and more, please see JAX-RS Basics for more information.
@@ -139,7 +139,7 @@ Apache CXF -- 2.7 Migration Guide
  • The WS-Addressing related VersionTransformer and MAPCodec classes have been changed to not encode the WS-Addressing headers to DOM elements and instead just use the Header list on the SoapMessage directly. This did change the parameters on the encode methods to take the JAXBContext instead of the Marshaller. Any custom VersionTransformers will need to be updated. (very rare)
-
  • All methods that took or returned org.apache.cxf.feature.AbstractFeatures have been changed to just use org.apache.cxf.feature.Feature.
+
  • All methods that took or returned org.apache.cxf.feature.AbstractFeatures have been changed to just use org.apache.cxf.feature.Feature.
  • JAX-RS: 3 classes have been removed from the org.apache.cxf.jaxrs.client package: ResponseReader, ServerWebApplicationException, ClientWebApplicationException. The first class in the list is not needed with JAX-RS 2.0 Response class, the latter two are replaced by javax.ws.rs.WebApplicationException and javax.ws.rs.client.ClientException
Modified: websites/production/cxf/content/docs/jax-rs-basics.html ============================================================================== --- websites/production/cxf/content/docs/jax-rs-basics.html (original) +++ websites/production/cxf/content/docs/jax-rs-basics.html Tue Oct 2 15:47:26 2012 @@ -124,7 +124,23 @@ Apache CXF -- JAX-RS Basics

JAX-RS : Understanding the Basics

+
+ +

What is New in JAX-RS 2.0

+ +

Client API

+

Asynchronous API

+

Response interface updates

+ +

Filters

+

Interceptors

+

Dynamic Features

+

Exceptions

+

Suspended invocations

+

Parameter converters

+

Bean parameters

+

Updates to the matching algorithm

+

Injection into subresources

Resource class

@@ -312,6 +328,14 @@ The former option may be a better one wh

One can also register a custom CXF out fault interceptor which can handle all the exceptions by writing directly to the HttpServletResponse stream or XMLStreamWriter (as XMLFaultOutInterceptor does). For example, see this test interceptor.

+

Customizing default WebApplicationException mapper

+ +

CXF ships a WebApplicationException mapper, org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper. By default it logs a stack trace at a warning level and returns Response available in the captured exception.
+It can be configured to log a stack trace at a trace level, by setting a 'printStackTrace' property to 'false'. Alternatively, if org.apache.cxf.logging.FaultListener is registered (as a contextual property) and indicates that it handled a given exception, then no more logging is done.

+ +

A simple text error message can also be optionally reported, by setting an 'addMessageToResponse' property to 'true'.
+Note that the custom WebApplicationException mapper, if registered, will be preferred to the default one.

+

Dealing with Parameters

PathParam annotation is used to map a given Path template variable to a method parameter.
Modified: websites/production/cxf/content/docs/jax-rs-client-api.html ============================================================================== --- websites/production/cxf/content/docs/jax-rs-client-api.html (original) +++ websites/production/cxf/content/docs/jax-rs-client-api.html Tue Oct 2 15:47:26 2012 @@ -124,7 +124,19 @@ Apache CXF -- JAX-RS Client API

+

JAX-RS 2.0 Client API

+ +

To be supported

+ +

JAX-RS 2.0 and CXF specific API

+ +

CXF proxy and WebClient client code has been retrofitted to support all the new JAX-RS 2.0 client constructs except for the client API itself.
+Specifically, JAX-RS 2.0 client filters, reader and writer interceptors, new exception classes and Response API all can be used in scope of working with proxy or WebClient API.

+ +

Additionally, WebClient supports JAX-RS 2.0 AsyncInvoker interface and offers few shortcuts, please see more about it below.

+ +

Users can expect WebClient API maintained in the next CXF releases as it offers a light-weight fluent API alternative.

Proxy-based API

@@ -229,24 +241,25 @@ BookStore proxy2 = JAXRSClientFactory.fr

There are a couple of ways you can handle remote exceptions with proxies.
One approach is to register a ResponseExceptionMapper as a provider either from Spring using a jaxrs:client or using a corresponding JAXRSClientFactory utility method. This way you can map remote error codes to expected checked exceptions or runtime exceptions if needed.

-

If no ResponseExceptionMapper is available when a remote invocation failed then an org.apache.cxf.jaxrs.client.ServerWebApplicationException (which is an instance of JAX-RS WebApplication) will be thrown. At this point of time you can check the actual Response and proceed from there:

+

If no ResponseExceptionMapper is available when a remote invocation failed then an instance of javax.ws.rs.WebApplicationException will be thrown (Note org.apache.cxf.jaxrs.client.ServerWebApplicationException is used to represent the server exceptions before CXF 2.7.0.). At this point of time you can check the actual Response and proceed from there:

 BookStore proxy = JAXRSClientFactory.create("http://books", BookStore.class);
 try {
     proxy.getBook();
-} catch(ServerWebApplicationException ex) {
+} catch(WebApplicationException ex) {
   Response r = ex.getResponse();
   String message = ex.getMessage();
 }
 
- -

org.apache.cxf.jaxrs.client.ClientWebApplicationException will be thrown if the exception has occurred for one of two reasons:

+

javax.ws.rs.client.ClientException will be thrown if the exception has occurred for one of two reasons:

  • the remote invocation succeeded but no proper MessageBodyReader has been found on the client side; in this case the Response object representing the result of the invocation will still be available
  • the remote invocation has failed for whatever reasons on the client side, example, no MessageBodyWriter is available.
+

Note org.apache.cxf.jaxrs.client.ClientWebApplicationException is used to represent the client processing exceptions before CXF 2.7.0.

+

Configuring proxies in Spring

When creating a proxy with JAXRSClientFactory, you can pass a Spring configuration location as one of the arguments. Or you can create a default bus using Spring configuration and all proxies will pick it up:

@@ -283,6 +296,8 @@ BusFactory.setDefaultBus(bus);

Proxy sub-resource methods returning Objects can not be invoked. Prefer to have sub-resource methods returning typed classes: interfaces, abstract classes or concrete implementations.

+

The following applies to CXF 2.6.x-2.4.x only:

+

When a proxy method returning a JAX-RS Response is invoked, the returned Response.getEntity() will return a response InputStream by default. Starting with CXF 2.3.2 one can register an org.apache.cxf.jaxrs.client.ResponseReader provider and cast the Response.getEntity() to more specific application classes:

@@ -313,7 +328,7 @@ JAXRSClientFactory.createFromModel(BookNoAnnotations is either an interface or concrete class with no JAX-RS annotations. Both client proxies and server endpoints can 'turn' it into a RESTful resource by applying an external user model.

-

HTTP-centric clients

+

CXF WebClient API

HTTP centric clients are WebClient instances which also implement the Client interface. In addition to setting various Client request properties, you can also make an explicit HTTP invocation with an HTTP verb being the name of a given operation :

@@ -332,13 +347,10 @@ WebClient client = WebClient.create(client.path("bookstore/books"); client.type("text/xml").accept("text/xml") Response r = client.post(new Book()); -InputStream is = (InputStream)r.getEntity(); -Book b = getFromInputStreamUsingJaxb(is); +Book b = r.readEntity(Book.class);
-

org.apache.cxf.jaxrs.client.ResponseReader can be registered to make it possible to cast Response.getEntity() to specific types.

-

WebClient lets you get back to a base URI or to a previous path segment and move forward, it can be handy for getting a number of individual entries from a service with ids embedded in path segments :

@@ -372,6 +384,10 @@ Book book = WebClient.create(When reusing the same WebClient instance for multiple invocations, one may want to reset its state with the help of the reset() method, for example, when the Accept header value needs to be changed and the current URI needs to be reset to the baseURI (as an alternative to a back(true) call). The resetQuery() method may be used to reset the query values only. Both options are available for proxies too.

+

Asynchronous invocations

+ +

Starting from CXF 2.7.0

+

Working with explicit collections

Example :

@@ -388,7 +404,7 @@ Collection<? Handling exceptions -

You can handle remote exceptions by either explicitly getting a Response object as shown above and handling error statuses as needed or you can catch either ServerWebApplicationException or ClientWebApplicationException exceptions, the same way it can be done with proxies.

+

You can handle remote exceptions by either explicitly getting a Response object as shown above and handling error statuses as needed or you can catch either javax.ws.rs.WebApplicationException or javax.ws.rs.client.ClientException exceptions, the same way it can be done with proxies.

Configuring HTTP clients in Spring