【发布时间】:2014-07-18 05:35:11
【问题描述】:
我正在使用Camel Java DSL 原型模板。我的路线构建器是这样的;
public class SampleRouteBulider extends RouteBuilder {
private static final String CXF_RS_ENDPOINT = "cxfrs://http://localhost:8088?resourceClasses="
+ SampleResource.class.getName();
@Override
public void configure() throws Exception {
from(CXF_RS_ENDPOINT)
.choice()
.when(header(CxfConstants.OPERATION_NAME).isEqualTo("sample"))
.bean(SampleImpl.class, "sample");
}
}
我需要注册路线吗?我的服务不会受到影响。
public class SampleResource {
@GET
@Path("/sample/")
@Produces(MediaType.APPLICATION_JSON)
public Response sample() {
return null;
}
}
【问题讨论】:
-
您是否尝试过使用
http://localhost:8088/rest?esourceClasses=中的URI 路径元素? -
没有。我认为使用 /rest 不是强制性的
-
也许,但你试过了吗?
-
/rest不应该是必需的,但是你的SampleResource的配置也很重要,你能包括吗?此外,您可能需要在choice()之前添加log()以确认未访问该服务。 -
@bgossit 抱歉回复晚了。
SampleResource的配置是什么意思?我会把我的SampleResource上课。
标签: java rest cxf apache-camel