휴식 전화를 걸려고하는데 작동하지 않습니다.휴식 서비스가 작동하지 않습니다.
내 프로젝트 탐색기는;
내 web.xml을이다;
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>HelloRest</display-name>
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
IHello.java;
@Path("hello")
public interface IHello {
@GET
@Path("sayHello")
public String sayHello(@QueryParam("name") String name);
}
Hello.java;
public class Hello implements IHello {
@Override
public String sayHello(String name) {
return "Hello: " + name;
}
}
나는 브라우저에서 호출합니다.
http://localhost/HelloRest/rest/hello/sayHello?name=me
하지만 찾지 못함을 반환합니다.
내가 전화하면;
http://localhost/HelloRest/aa/index.html,
나는 index.hmtl의 내용을 볼 수 있습니다.
내 문제는 무엇이며 어떻게 해결할 수 있습니까?
참고 : 나는 아래로 서블릿 배포 코드를 변경 제이보스 - 10.1
주석 주셔서 감사 합니다만, standalone.xml에서 포트를 8080에서 80으로 변경하므로'http : // localhost'가 맞습니다. 나머지는 web.xml에서 응용 프로그램 경로를 설정하므로 응용 프로그램을 확장 할 필요가 없으므로'http : // localhost/HelloRest/rest'도 수정됩니다. 그러나 잘못된 것이 있으며 그것을 모른다. – xxlali