This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts2 : modify response header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 : modify response header " Watch "Struts2 : modify response header " New topic
Author

Struts2 : modify response header

Sam Rakshit
Greenhorn

Joined: Jun 22, 2010
Posts: 8
How can I modify an already set response header?

This is required for an application which behaves like this -

Client C talks to server A in a different syntax and server A sends the request to server S ( struts2 server) . Now after a successful login, i am using a actionRedirect to take the user to the Home page whose URL is like this : http:/mywebserver.com/secure/home . So, struts2 sets the Location header to this URL. But, server A expects us to write the URL in the form >> Location: widget:secure/home or Location: http://mobileapp.com/secure/home

So, I want to edit the header by replacing the mywebserver.com with mobilesite.com and keep the rest of the value intact.

How can I do that in struts? what sort of interceptor I must use? Or is it possible at all?
M Turner
Greenhorn

Joined: Dec 16, 2009
Posts: 25
I don't know if this will work for you, but here's an example from one blogger on how to modify the response object by using a custom interceptor:

http://omkarp.blogspot.com/search/label/Struts%202

Good Luck
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts2 : modify response header
 
Similar Threads
Struts2 with RAD7
migration to Struts2
Download pdf file in struts2
Struts2
Struts2/JQuery