Skip to content

Instantly share code, notes, and snippets.

@abhirockzz
Created January 20, 2016 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhirockzz/9bdb1bfceb71973c2d14 to your computer and use it in GitHub Desktop.
Save abhirockzz/9bdb1bfceb71973c2d14 to your computer and use it in GitHub Desktop.
Basic JAX-RS injection
@Path("test")
public class JAXRSInjectionTestResource{
@HeaderParam("token")
//Assume that Token has a public ctor with a String param
private Token token;
@GET
@Path("{id}")
@Produces("application/json")
public CustDetails fetch(@PathParam("id") String custID){
//this method will be invoked by a HTTP GET on http://host:port/context-root/test/42
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment