我已经在Jboss 7.1.1中成功部署了一个小型RESTful Web服务,但是当我尝试使用此URL测试它时:http://localhost:8080/auth/webresources/test/hello/Jumbu它返回HTTP错误404。该服务代码如下:下面来自部署在Jboss 7.1.1中的RESTful Web服务的HTTP错误404
@Path("/test")
public class TestService {
@GET
@Path("hello/{name}")
public String sayHello(@PathParam("name") String name) {
return "Welcome " + name;
}
}
我ApplicationConfig类给出:
@ApplicationPath("/webresources")
public class ApplicationConfig extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new java.util.HashSet<Class<?>>();
addRestResourceClasses(resources);
return resources;
}
private void addRestResourceClasses(Set<Class<?>> resources) {
resources.add(com.jcjoof.jcjoofaws.TestService.class);
}
}
我真的不能弄清楚什么是错的,请帮助..
是'auth'某处设置为您的Web根? 从你显示的配置看起来你的url应该是: 'http:// localhost:8080/webresources/test/hello/Jumbu' – 2015-01-21 09:46:32
auth是我的web根目录 – jcjoof 2015-01-21 09:54:47
这对我来说真的很奇怪,因为auth是我的上下文根,这就是我使用http:// localhost:8080/auth/webresources/test/hello/Jumbu的原因。我需要帮助.. – jcjoof 2015-01-21 10:00:21