• Post Reply Bookmark Topic Watch Topic
  • New Topic

modify http request header

 
Waldle Cai
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm trying to integrate two web apps A and B. what I need to do is put a servlet between them and the servlet needs to modify http request headers(other info intact) coming from app A and forwards it to app B. But I can't find any Java Sevlet API that allows me to modify the http request header. Can any expert out there give me some idea? thanks a lot.
Regards
Waldle
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it is possible to add request headers to an existing request. You would have to create a new HttpURLConnection to App B and set the headers for it.
Bill
 
Waldle Cai
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi William,
Just want to confirm the following steps are correct:
1. grab the http headers from app A and modify them.
2. make a http connection to app B.
3. grab the response headers and content body from app B and put them to the response, which will be sent back to app A.
Is there anything else(apart from headers and body) that I miss out? thanks a lot.
Regards
Waldle
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds reasonable to me, let us know what happens.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!