Reputation: 99
import javax.ws.rs.Path;
@Path()
public interface IDriver {
public String GetDriverByID(int id);
}
In this code @Path
an error pops up telling "the annotation path must define the attribute value". When I click on resolve it does this @Path(value="")
.
What should is the value ?? I am working in eclipse, and it is a maven project.
Upvotes: 0
Views: 3267
Reputation: 6479
@Path
Identifies the URI path that a resource class or class method will serve requests for.
In your example, if you set path to "drivers":
@Path("drivers")
public interface IDriver {
@Get
public String GetDriverByID(int id);
}
And the application path is myapplication and the application is deployed at http://example.com/, then GET requests for http://example.com/myapplication/drivers
will be handled by the GetDriverByID
method.
See Path.
Upvotes: 2
Reputation: 124
If you want your customers to access service you must provide them a path that they can use :
For this service:
@Path("/product") public class ProductService
You can access it by http request :
host:port/servicename/rest/product
The /rest/ part depends on the web xml configuration (web.xml).
Upvotes: 1