Rohit Bajaj
asked on
how to set common header for all RequestMappings in a controller
Hi,
In my controller i have the following line in each requestMapping method :
There are 4 such methods... Is there any way i can avoid this so as to specify this header only once in controller and
it gets added to all the responses ?
Thanks
In my controller i have the following line in each requestMapping method :
response.setHeader(contentSecurityolicy.getHttpHeader(), contentSecurityPolicy.toString());
There are 4 such methods... Is there any way i can avoid this so as to specify this header only once in controller and
it gets added to all the responses ?
Thanks
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Whats the correct approach as per designing ?
Should i just add it like above in each request mapping.. or create a filter and so controller does not know about adding of this header ?