How to Create an Apache CXF REST Web Service in Apache Camel

SampleResource.java

import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

@Path("sample")
public final class SampleResource {

  @Path("{param1}/{param2}")
  public Object sampleOperation(@PathParam("param1") final String param1, @PathParam("param2") final String param2) {
    return null;
  }

}

SampleRouteBuilder.java

import org.apache.camel.builder.RouteBuilder;

public final class SampleRouteBuilder extends RouteBuilder {

  @Override
  public void configure() {
    from("cxfrs:http://0.0.0.0:8080?resourceClasses=SampleResource")... // as per the doc, resourceClass should work
  }

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s