Using: Java EE + JAX-RS (Apache Wink) + WAS.
Let say I have Rest API declared by class Hello, path "/hello"
@Path("/hello")
public class Hello{
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response sayHello() {
Map<String, String> myMap = new LinkedHashMap<String, String>();
myMap.put("firstName", "To");
myMap.put("lastName", "Kra");
myMap.put("message", "Hello World!");
Gson gson = new Gson();
String json = gson.toJson(myMap);
return Response.status(200).entity(json).build();
}
}
How can I get that path from Hello.class
without using reflections ? I can see example in javax.ws.rs.core.UriBuilder
method path(Class clazz)
which can get it somehow, could not find the sources of it.