cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <>
Subject Re: Basic Http Demo and the refactoring that I did, in the course of figuring out how it worked.
Date Thu, 12 May 2011 09:11:06 GMT
Hi Ryan

This all very good and I hope the CXF dev community will be happy to
see your progress and help when needed,
please see some comments inline.

Please keep updating us with your progress as often as possible, just
one suggestion is to minimize the amount of copied code or traces,
etc, copy the most relevant parts and send the complete code to me
privately. That will help to keep messages shorter and for others to
follow them

so, more comments inline, I removed the actual code as it can be seen
in the prev message if needed

thanks, Sergey

On Thu, May 12, 2011 at 7:32 AM, Ryan Zoerner <> wrote:

> JAX_RS/demo
> At cxf/distribution/src/main/release/samples/jax_rs/basic
> (
> is a basic http demo. I found the client code to be large and unwieldly, so
> I refactored
Good :-) That is the old code which needs to be replaced by CXF JAX-RS
WebClient related code and then in due time by JAX-RS 2.0 client api

> it. I also found it hard to understand, at first, but the key, with the GET
> request is
> that the client opens a connection with the server, at the URI associated
> with a given
> resource. The client opens a printStream that is associated with the
> connection, and
> from that connection the client obtains the return information that would
> normally be
> associated with a GET request. It may be that since the only @Path in
> CustomerService
> with "/customerservice/customers/{id}" is the GET method, that the service
> automatically
> just queries that @Path and assumes a GET request, since that method is
> annotated with
> the @GET annotation. If you annotated it with more than one HTTP
> RequestType, I am unsure
> what would happen at the moment.

A given JAX-RS resource method can only have a single HTTP method
annotation, I think CXF will just use the 1st one on a method and
ignore others - should also validate and throw

> That said, here is the refactoring part of
> the code.

All the code looked fined to me, good effort

> "When a top level class or an enum type is annotated with the
> @XmlRootElement annotation,
> then its value is represented as XML element in an XML document."
> I'm not sure what mechanism java EE uses to ensure this, but I think that
> this annotation
> is the reason why that when the CustomerService object returns a Customer
> object, that
> the Service returns the Object in XML format, through the open URL
> connection.

CXF JAX-RS provides JAXBElementProvider which implements JAX-RS
MessageBodyWriter and MessageBodyReader and uses JAXB databinding
technology to have @XmlRootElement annotated class instances written
to the output stream and initialized from the input stream containing
the XML sequence

> That is all for now. I intend to make small steps towards building upon this
> in the future. I hope
> that this will set a good backdrop for discussion and me to ask questions,
> if necessary.
That is good, thanks


> Ryan

Sergey Beryozkin

Application Integration Division of Talend

View raw message