private static final String CXF_RS_ENDPOINT_URI =
"cxfrs://http://localhost:" + CXT + "/rest?resourceClasses=org.apache.camel.component.cxf.jaxrs.testbean.CustomerServiceResource";
private static final String CXF_RS_ENDPOINT_URI2 =
"cxfrs://http://localhost:" + CXT + "/rest2?resourceClasses=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService";
private static final String CXF_RS_ENDPOINT_URI3 =
"cxfrs://http://localhost:" + CXT + "/rest3?"
+ "resourceClasses=org.apache.camel.component.cxf.jaxrs.testbean.CustomerServiceNoAnnotations&"
+ "modelRef=classpath:/org/apache/camel/component/cxf/jaxrs/CustomerServiceModel.xml";
private static final String CXF_RS_ENDPOINT_URI4 =
"cxfrs://http://localhost:" + CXT + "/rest4?"
+ "modelRef=classpath:/org/apache/camel/component/cxf/jaxrs/CustomerServiceDefaultHandlerModel.xml";
private static final String CXF_RS_ENDPOINT_URI5 =
"cxfrs://http://localhost:" + CXT + "/rest5?"
+ "propagateContexts=true&"
+ "modelRef=classpath:/org/apache/camel/component/cxf/jaxrs/CustomerServiceDefaultHandlerModel.xml";
protected RouteBuilder createRouteBuilder() throws Exception {
final Processor testProcessor = new TestProcessor();
final Processor testProcessor2 = new TestProcessor2();
final Processor testProcessor3 = new TestProcessor3();
return new RouteBuilder() {
public void configure() {
errorHandler(new NoErrorHandlerBuilder());
from(CXF_RS_ENDPOINT_URI).process(testProcessor);
from(CXF_RS_ENDPOINT_URI2).process(testProcessor);
from(CXF_RS_ENDPOINT_URI3).process(testProcessor);
from(CXF_RS_ENDPOINT_URI4).process(testProcessor2);
from(CXF_RS_ENDPOINT_URI5).process(testProcessor3);
}
};
}
private static final String CXF_RS_ENDPOINT_URI =
"cxfrs://http://localhost:" + CXT + "/rest?resourceClasses=org.apache.camel.component.cxf.jaxrs.testbean.CustomerServiceResource";
private static final String CXF_RS_ENDPOINT_URI2 =
"cxfrs://http://localhost:" + CXT + "/rest2?resourceClasses=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService";
private static final String CXF_RS_ENDPOINT_URI3 =
"cxfrs://http://localhost:" + CXT + "/rest3?"
+ "resourceClasses=org.apache.camel.component.cxf.jaxrs.testbean.CustomerServiceNoAnnotations&"
+ "modelRef=classpath:/org/apache/camel/component/cxf/jaxrs/CustomerServiceModel.xml";
private static final String CXF_RS_ENDPOINT_URI4 =
"cxfrs://http://localhost:" + CXT + "/rest4?"
+ "modelRef=classpath:/org/apache/camel/component/cxf/jaxrs/CustomerServiceDefaultHandlerModel.xml";
private static final String CXF_RS_ENDPOINT_URI5 =
"cxfrs://http://localhost:" + CXT + "/rest5?"
+ "propagateContexts=true&"
+ "modelRef=classpath:/org/apache/camel/component/cxf/jaxrs/CustomerServiceDefaultHandlerModel.xml";
protected RouteBuilder createRouteBuilder() throws Exception {
final Processor testProcessor = new TestProcessor();
final Processor testProcessor2 = new TestProcessor2();
final Processor testProcessor3 = new TestProcessor3();
return new RouteBuilder() {
public void configure() {
errorHandler(new NoErrorHandlerBuilder());
from(CXF_RS_ENDPOINT_URI).process(testProcessor);
from(CXF_RS_ENDPOINT_URI2).process(testProcessor);
from(CXF_RS_ENDPOINT_URI3).process(testProcessor);
from(CXF_RS_ENDPOINT_URI4).process(testProcessor2);
from(CXF_RS_ENDPOINT_URI5).process(testProcessor3);
}
};
}
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
Camel 2.15 以降では、デフォルトモードの no-op サービス実装クラスとは対照的に、インターフェイスのみを提供するだけでも十分であることに注意してください。
@Path("/customerservice/")
public interface CustomerServiceResource {
@GET
@Path("/customers/{id}/")
Customer getCustomer(@PathParam("id") String id);
@PUT
@Path("/customers/")
Response updateCustomer(Customer customer);
@Path("/{id}")
@PUT()
@Consumes({ "application/xml", "text/plain",
"application/json" })
@Produces({ "application/xml", "text/plain",
"application/json" })
Object invoke(@PathParam("id") String id,
String payload);
}
@Path("/customerservice/")
public interface CustomerServiceResource {
@GET
@Path("/customers/{id}/")
Customer getCustomer(@PathParam("id") String id);
@PUT
@Path("/customers/")
Response updateCustomer(Customer customer);
@Path("/{id}")
@PUT()
@Consumes({ "application/xml", "text/plain",
"application/json" })
@Produces({ "application/xml", "text/plain",
"application/json" })
Object invoke(@PathParam("id") String id,
String payload);
}
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow