Logged a bug.
https://jersey.dev.java.net/issues/show_bug.cgi?id=404
________________________________
From: animesh sonkar <animesh_smit@yahoo.com>
To: Jersey users <users@jersey.dev.java.net>
Sent: Fri, 30 October, 2009 9:16:21 PM
Subject: Re: [Jersey] Annotation Inheritance
Yeah i solved this one
public interface TestInterface {
@Path("/test")
@GET
@Produces("text/plain")
public String sayHello();
}
Note @path here :
@Path("")
public class TestIMPL implements TestInterface {
public String sayHello() {
// TODO Auto-generated method stub
return "Hello World";
}
This solves my problem. Including @Path just lets the ServletContainer know that this is a Root Resource and no errors are thrown at startup.
The resource is now accessible using "/test".
But i have a doubt, could this be a bug in jersey?
If yes, i cannot rely on @Path("") in IMPL.
Also i obseerved that.
if the impl was
@Path("/dummy")
public class TestIMPL implements TestInterface {
public String sayHello() {
// TODO Auto-generated method stub
return "Hello World";
}
then
"/dummy" worked (sorry about previous post in which i mentioned this did not work)
also
"/dummy/test" gave me the same result....
Fits in the REST context? or another bug in jersey?
Thanks i got the problem. Shifted @Path to TestIMPL and things were smooth
But my whole intention was to provide an interface with @Path("/test")
So an implementaion provider just needs to implement the interface method and the contract to the URL is taken care.
i tried
public interface TestInterface {
@Path("/test")
@GET
@Produces("text/plain")
public String sayHello();
}
@Path("/dummy")
public class TestIMPL implements TestInterface {
public String sayHello() {
// TODO Auto-generated method stub
return "Hello World";
}
}
this time i did not get any exception but neither "/dummy" nor "/test" worked and no errors were genereted.
Any idea how to go about?
________________________________
Try the new Yahoo! India Homepage. Click here.
________________________________
From cricket scores to your friends. Try the Yahoo! India Homepage!
Add whatever you love to the Yahoo! India homepage. Try now!
http://in.yahoo.com/trynew