We are using jersey 2 for our REST web services in Java.
We have created the javax.ws.rs.container.ContainerRequestFilter
and javax.ws.rs.container.ContainerResponseFilter
We have headers while sending a request like appKey, secret, token etc. If we hit a request from Postman, it gives all the header with their values as follows:
{
host=[localhost:8080],
connection=[keep-alive],
authorization=[bearer <token>],
cache-control=[no-cache],
x-request-id=[<request-id>],
x-api-secret=[<secret>],
user-agent=[Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36],
x-api-key=[api-key],
postman-token=[<postman-token>],
accept=[*/*],
accept-encoding=[gzip, deflate, br],
accept-language=[en-US,en;q=0.9]
}
and if we hit a request from our web client, it gives values under access-control-request-headers
as follows (only keys, not their values):
{
host=[localhost:8080],
connection=[keep-alive],
access-control-request-method=[GET],
origin=[http://resttesttest.com],
user-agent=[Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36],
access-control-request-headers=[authorization,x-api-key,x-api-secret,x-request-id],
accept=[*/*],
accept-encoding=[gzip, deflate, br],
accept-language=[en-US,en;q=0.9]
}
why it does not give header parameters values?
How to get those?
Please guide me on this. Thanks in advance!