geozwey geozwey - 1 month ago 16
Java Question

Grizzly Jersey - Only @Path("/") works

I try to run a Jersey(1.17) resource on a Grizzly(2.2.21) server using HTTPS and Basic Auth and get everything working except the resource.

@Path("/")
public class Helloworld {

@GET
public String helloworld2() {
return "asdf2";
}

@Path("helloworld")
@GET
public String helloworld() {
return "asdf";
}
}


Yea it's just the Helloworld example and it still freaks me out.
I can access localhost:port/ and it works fine, but localhost:port/somethingother also returns "asdf2". Especially localhost:port/helloworld also returns "asdf2".

I also tryed

@Path("/")
public class Helloworld {

@GET
@Path("/helloworld")
public String helloworld() {
return "asdf";
}
}


and

@Path("/helloworld")
public class Helloworld {

@GET
public String helloworld() {
return "asdf";
}
}


In both cases i get 404 in Firebug for every request.

Does someone has a solution?
Thx

Edit:

To create the server and so on i use this example code (without the server truststore):
https://svn.java.net/svn/jersey~svn/trunk/jersey/samples/https-clientserver-grizzly/src/main/java/com/sun/jersey/samples/https_grizzly/

Answer

adding registration.addMapping("/*"); to my initialization code worked.

Thanks ver much alexey