I'm doing a Rest Service + Web Site with Wildfly and JAX-RS. My point is to make the Rest Service as some kind of "Controller". I can normally load my index.jsp page, but when it comes to other kind of files (like main.css) it returns 404 HTTP file not found error.
Are those files supposed to be in the same project? Or should I create one Java project for the Rest Service and another for the web site?
My Endpoint looks like this:
@Path("/restservice")
@Produces("text/html; charset=UTF-8")
public class FalkEndpoint {
@GET
public String defaultMessage(@Context HttpServletRequest request,@Context HttpServletResponse response){
return "The server is up! :)";
}
}
My web.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>