Reputation: 49441
I can't seem to connect and I dont know what is wrong here. I am debugging and all I get is a 404. My class ApiServer is in this directory A.B.C.api.users
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>
org.glassfish.jersey.servlet.ServletContainer
</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>A.B.C.api</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/users/*</url-pattern>
</servlet-mapping>
.........
@Path("/test")
public class ApiServer {
@GET
@Path("/")
public Response putContainer() {
System.out.println("Hellooo");
..........
curl -v 192.168.92.128:8080/users/
....
Apr 25, 2014 10:26:19 AM org.glassfish.jersey.server.ApplicationHandler initialize
INFO: Initiating Jersey application, version Jersey: 2.7 2014-03-12 18:11:31...
There is nothing after this, does it mean that its not initialized completly? And How can I debug Jax-rs ?
Upvotes: 1
Views: 978
Reputation: 616
If you are deploying a WAR (or EAR) on Glassfish, the URL is going to contain the web application context before your REST path... If your WAR is named myapp.war, the URL would likely be:
http://somehost:8080/myapp/users/
Upvotes: 1
Reputation: 3191
You do not seem to have the @Produces
annotation on your method
@Produces(MediaType.APPLICATION_JSON)
Without @Produces, the default mimetype returned is "text/html"
Upvotes: 2