Hi
Please check the jaxrs/https demo in the CXF distribution, it's a
basic demo which also shows how to configure HTTPS.
Also see [1] and [2] for more info.
The recommended approach to develop RESTFul services in CXF is to use
JAX-RS [2]. Here is a basic approach which you can follow:
1. Create a root resource class which is top-level handler for a
specific application URI sub-space, example:
@Path("store")
public class BookStore {
private Map<Integer, Book> books = new HashMap<Integer, Book>();
@GET
@Path("{id}")
@Produces("application/xml")
public Book getBook(@PathParam("id") Integer bookId) {
return books.get(bookId);
}
@POST
@Consumes("application/xml")
public Response addBook(Book book) {
books.put(book.getid(), book);
return Response.status(201).build();
}
}
Check [2] on how to register this resource, example :
<jaxrs:server serviceClass="org.foo.BookStore" address="/"/>
Suppose you have created a books.war and deployed into a container
listening on localhost:8080.
The BookStore endpoint will handle the request URIs starting from
http://localhost:8080/books/store.
More specifically:
1. GET http://localhost:8080/books/store/1
will be handled by the getBook() method with '1' being mapped to its
bookId parameter. Assuming Book is a JAXB bean, JAXB will serialize
it.
2. POST http://localhost:8080/books/store/
<Book><id>1</id><title>The Book</title></Book>
will be handled by the addBook(Book) method.
Hope this little micro-tutorial will help you to get started :-).
You might also want to consider checking out the growing collection of
JAX-RS demos at [3]
Cheers, Sergey
[1] http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html
[2] http://cxf.apache.org/docs/jax-rs.html
[3] http://www.talend.com/resources/documentation.php#SF
On Wed, Feb 9, 2011 at 6:43 AM, Siva <[email protected]> wrote:
> Dear all,
>
> I’m comfortable with java(I work in .Net) but I’m new to
> Apache CXF. I’m looking at developing RESTful services in CFX and expose it
> over https. Can you point me to some basic tutorials on developing a RESTful
> service from scratch in CFX and expose it over https? Thanks in advance.
>
> --
> Siva
>