I am working on RESTFul (JAX-RS) application and will be having a java class file in a jar file separated from war file which needs to access Headers from HttpServletRequest.
If the java class is in war file, i know i can access HttpHeaders using @Context in the resource method or on the resource class as @Context private HttpServletRequest httpRequest OR i can listen to events from ServletListener and get the HttpHeaders as well.
Since the jar file SHOULD NOT depend on war file, i am not sure how to get headers from HTTPServletRequest.
Is there a possible way we can get HTTPheaders by annotations or CDI?
EDIT: Actually, i need to get the header value (e.g., id) from the http request in WAR project (JAX-RS project, lets call it as WAR1) and then refer or use it in another java project(so that i can use it for processing some business logic or querying database) that can be copied or deployed as jar file to the WAR1 project.