java - Cant hit my API, have i the wrong URL? -
i have dynamic java web project jersey libs called myapi...
the apache tomcat server starts ok ... http 404 status no mattr url enter. have 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"> <servlet> <servlet-name>myapi</servlet-name> <servlet-class>org.glassfish.jersey.servlet.servletcontainer</servlet-class> <init-param> <param-name>jersey.config.server.provider.packages</param-name> <!-- package resource classes --> <param-value>ws</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>myapi</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>
a java class...
package ws; import javax.ws.rs.*; import javax.ws.rs.core.*; @path("test") public class connect { @get @path("test") @produces(mediatype.text_plain) public string hello(){ return "hello world"; } }
your web.xml list jersey packages ws
(uppercase) java class in package ws
(lowercase). maybe problem? or part of problem anyway.
Comments
Post a Comment