错误404 Jersey Tomcat Eclipse Web服务1

时间:2018-08-03 13:09:00

标签: hibernate jersey jax-rs

我的球衣项目有问题 当我在URL http://localhost:8080/RestProject1/rest/hi/Franck中测试我的Web服务问候世界时,它显示正确的响应。但是,当我在@path(“ hello”)上更改@path(“ hi”)并在网址http://localhost:8080/RestProject1/rest/hello/Franck中运行时,它显示404错误。

这是我的HelloRest

打包com.spro.rest;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

@Path("/hi")//It show 404 error with url http://localhost:8080/RestProject1/rest/hello/Franck when I change this path for example @Path("/hello")
public class HelloWorldService {

      @GET
      @Path("/{name}")
      @Produces(MediaType.APPLICATION_JSON)
      public String getMessage(@PathParam("name") String name)
      {
        String outMsg = "Hello " + name + "!";
        return outMsg;
      }

}

0 个答案:

没有答案
相关问题