• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP page setHeader issues  RSS feed

 
selva raja
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to set the header in the response object like the following in my jsp (jsp page):
<%
response.setHeader("Authorization", "test");
%>

i did something like the following in my servlet(spring MVC MultiActionController) page to see the result:

request.getHeader("Authorization");


the result is "null".

any idea?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66153
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Response headers are sent to the browser. They are not sent to the server.

Why would you think that a response header would be sent as part of the next request?
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello selva raja.

You really need that info in the header? Are you sure?

You could send it into a request and grab it in your Servlet.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66153
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hebert Coelho wrote:You could send it into a request and grab it in your Servlet.

No. A request-scoped variable would suffer the same fate.

Until we find out what the poster is actually trying to accomplish, we can't figure out how to best accomplish it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!