August 2018
Intermediate to advanced
314 pages
8h 9m
English
In the following code snippet, we have a JAX-RS resource class, called HelloWorld. This class receives a request and returns a message to the client. Before the execution of the resource logic, AuthenticationInterceptor intercepts a call to a method and processes the authentication logic:
import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.ws.rs.GET;import javax.ws.rs.Path;import javax.ws.rs.core.Context;import javax.ws.rs.core.Response;@Path("helloworld")public class HelloWorld { @GET @Authentication(roles = {"user"}) public Response helloWorld(@Context HttpServletRequest request, @Context HttpServletResponse response) { return Response .ok("Hello World. ...
Read now
Unlock full access