aspose file tools*
The moose likes JSP and the fly likes About Headers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "About Headers" Watch "About Headers" New topic
Author

About Headers

Charmy Madhvani
Ranch Hand

Joined: Dec 26, 2007
Posts: 59
Hi
I am maintaining one of the application whose Home page(jsp) is actually getting the authentication info like username , userid from the Headers(request.getHeaders()). This home page is actually navigated from some other portal site which I am not allowed to access. So there is no way to know how that portal is setting the custom header info in the request which we are getting in our Home page. Does anybody has idea how can my system get the customized header info? Infact how can one setHeader in one page and getHeader in another?


SCJP 5.0<br />SCWCD 5.0
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

See:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletRequest.html#getHeader(java.lang.String)


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Charmy Madhvani
Ranch Hand

Joined: Dec 26, 2007
Posts: 59
I have seen that API.
Let me be more clear.

There is an application in a separate server(WSSO).It sets a header information called USERNAME. Its jsp has a link to my application(Tomcat4.1). When that link is clicked the request comes to my jsp. In my jsp I am getting a non null value from from request.getHeader("USERNAME").
My question in how did that jsp from another application able to setHeader in request? Can a specific server provides any API to do that. Because nothing like this can happen in JSP/Servlets API.

I hope I have made myself clear..
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
My question in how did that jsp from another application able to setHeader in request?


I dont think that is actually happening here. Headers can only be set by the application generating the request. If this was my problem I would "view source" on the page that links to your jsp to see what is actually generating the request.

Bill
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Because nothing like this can happen in JSP/Servlets API.


Not entirely true.
You could write a filter that sets this header.
[ January 16, 2008: Message edited by: Ben Souther ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Also, if you don't have it yet, you might want to install the LiveHttpHeaders or FireBug plugin for Firefox. Both of these tools will allow you to see the request and response headers for all web requests going to and from your browser.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About Headers