how can I write the following in correct Java?:
@GET
@Path("{blah}/{blahh}")
public String getAnything(@PathParam("blah") String blah,
@PathParam("blahh") String blahh,
@Path String path) {
return "<a href=" + path + ">Hi</a>";
}
I want to get the whole requested Path in a variable. How do I do this? I'm using Jersey, JAX-RS and Tomcat.
You should add the UriInfo
parameter:
@GET
@Path("{blah}/{blahh}")
public String getAnything(@PathParam("blah") String blah,
@PathParam("blahh") String blahh,
@Context UriInfo uriInfo) {
return "<a href='" + uriInfo.getAbsolutePath() + "'>Hi</a>";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With