I have Liferay 7.2.
I created a module rest.
I created a method GET
I want to read headers of incoming request. I need to read authentication bearer token. how can i do that?
This is my example code
@GET
@Path("/get-request-headers")
public String jsonGetRequestHeaders() throws Exception {
String authtoken = ?????;
return authtoken;
}
I found the solution:
@GET
@Path("/get-request-headers")
public String jsonGetRequestHeaders(
@HeaderParam("Authorization") String token
) throws Exception {
String authtoken = token;
return authtoken;
}