I am having trouble navigating to my restful service using resteasy 2.1 on localhost and was hoping someone here might be able to help me.
I have built an EAR file with a WAR inside and is seems to compile and deploy to JBoss5 ok.
My service simplified:
@Path("RequestReply")
public class Replier {
@GET
@Path("request")
public String getReply(@QueryParam("id") @DefaultValue("") String id){
if (id.length > 0){
return "ACK";
}
return "NACK";
}
}
My web.xml file is standard:
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<display-name>Test service</display-name>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
So I try to access my API using
But I get 404 errors.
Can anyone tell me what I am doing wrong?
Application.xml:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="java.sun.com/xml/ns/javaee"; xmlns:xsi="w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="java.sun.com/xml/ns/javaee java.sun.com/xml/ns/javaee/application_5.xsd"; version="5">
<display-name>Reseasy</display-name>
<module>
<java>simple.jar</java>
</module>
</application>
Ok so I would suggest trying something like:
Here the Replier.war refers to the name of the WAR file you create and /api refers to the base of your request URL. So it should look like:
Give that a shot!