Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

redirect outsieda web application

 
piotr jest
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have problem with redirecting user to webpage that is outsied of my application and on another server. I need to add httpHeader and send it via post to that webpage. When i try to snedRedirect method it move user to correct side but it send get after post and all header information gone.
Is there any way to solve this problem ?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really.
A redirect does nothing more than send a response code and location header to the browser, suggesting that it make a new request too the other URL.

Some other thoughts are to..
  • Build a form on a webpage with the other URL as its action and use Javascript to submit it.
  • Make the request from the server and stream the results to the browser


  • Without knowing more about your issue it would be hard to say which (if either) of these approaches would be best for you.
     
    Evelin Priyadarsini
    Greenhorn
    Posts: 5
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi,
    When we use sendRedirect() method, it is a new request from the client so the data might be lost. But i am not sure about your scenario where you are talking about httpheaders.
     
    piotr jest
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    task is very simple i have to calculate some variables after that use response.addHeader metods add some headers and send user with that headers to another webpage that is on another server.

    about redirect:
    yes i read a lot about this problem and sendRedirect wont help me :/ i tried to use forword but there is problem with application context...
    i tried to submit a form and pass it with post after submit. But i read that js can't modify http headers :/ and there should not be any pages between forward action and destination page...
    I had no ide how complicated that task can be. Or maby imposible to do?
     
    Deepak Bala
    Bartender
    Posts: 6663
    5
    Firefox Browser Linux MyEclipse IDE
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by piotr jest:
    task is very simple i have to calculate some variables after that use response.addHeader metods add some headers and send user with that headers to another webpage that is on another server.

    about redirect:
    yes i read a lot about this problem and sendRedirect wont help me :/ i tried to use forword but there is problem with application context...
    i tried to submit a form and pass it with post after submit. But i read that js can't modify http headers :/ and there should not be any pages between forward action and destination page...
    I had no ide how complicated that task can be. Or maby imposible to do?


    Both the suggestions made by Ben will work out pretty well. Why dont you given them a shot ?
     
    piotr jest
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    because of the safety of information... client realy wont to send thoes information that way :/
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic