我只是java的新手rest-api;因此,我尝试构建一个使用java,eclipse和wildfly 10的简单restful-api项目。该项目已部署,但我无法通过浏览器通过URL调用API。我是否有错误或未设置配置?有人帮助我,非常感谢。 我也不擅长英语,如果很难理解,请道歉
package it_kickstart;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("/rest")
public class KickStartService {
@GET
@Path("/html")
@Produces("text/html")
public String getHTML() {
return "<p>JAX-WS with JBoss WildFly 10.x</p>";
}
@GET
@Path("/text")
@Produces("text/plain")
public String getText() {
return "JAX-WS with JBoss WildFly 10.x";
}
}
我的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>Rest_API_1</display-name>
</web-app>