Reputation: 2924
Here is the class :-
package com.bablo.rest;
import javax.websocket.server.PathParam;
import javax.ws.rs.Path;
@Path("/")
public class Library {
@Produces("text/plain")
@Path("/books/{name}")
public String getBook(@PathParam("name") String name){
System.out.println(name);
return "My Name is Anthony Goncalves";
}
}
Its giving this as error
A sub-resource locator, public java.lang.String com.bablo.rest.Library.geBook(java.lang.String), can not have an entity parameter. Try to move the parameter to the corresponding resource method.
and
Missing dependency for method public java.lang.String com.bablo.rest.Library.getBook(java.lang.String) at parameter at index 0
I am invoking this webservice through the Browser like this
http://localhost:8080/JAXRS-HelloWorld/rest/books/bablo
Also I am doing curl:
curl -X GET http://localhost:8080/JAXRS-HelloWorld/rest/books/bablo
Upvotes: 5
Views: 5244
Reputation: 51
I encountered the same error message but the reason was different in my case. You could have been using:
@Post (oracle.jdbc.proxy.annotation)
but instead we should be using:
@POST (javax.ws.rs.POST)
Upvotes: 0
Reputation: 279890
I believe you meant to use
javax.ws.rs.PathParam
rather than
javax.websocket.server.PathParam
Upvotes: 3