【发布时间】:2015-01-10 07:03:46
【问题描述】:
我有一个与 Spring 集成的球衣 RESTful 服务。web.xml 中映射的基本 url 是 /rest/*
我的服务等级如下:
@Resource
@Scope("request")
@Path("/service/")
@Component
public class ServiceController {
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getApiDetails() {
return Response.ok("area").build();
}
@Path("/area")
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
public Response processConvertCurrency(
@QueryParam("length") String length,
@QueryParam("breadth") String breadth) {
......
}
}
点击以下网址时,会显示可用的服务
<baseurl>/rest/service
output : area
<baseurl>/rest/service/area?length=10&breadth20 也将正确返回其输出。
我的要求是,当有人点击<baseurl>/rest/service/volume 时,它应该像这样输出
Service is unavailable message.
由于只有area 可用我该怎么做。请帮助..(当前显示404错误)
【问题讨论】:
-
您是如何尝试查找此资源的?在浏览器中?
-
是的,用于测试目的。
标签: java spring rest jersey jax-rs