1

Usually we can redirect to another page using ForwardResolution(path) in stripes, but I want to redirect to another site. So when I am using ForwardResolution it will be interpreted as

http://localhost:8080/MySiteName/<Address of the other site>

I have read this link, but how to add parameters to the address ? I want to submit variables in POST method to that site. Is it possible using an action bean in Stripes ?

Community
  • 1
  • 1
kaushik
  • 2,308
  • 6
  • 35
  • 50

2 Answers2

5

Actually, you can't use a ForwardResolution to go to another site. A Forward is an internal concept within the Servlet container. What you can do is a RedirectResolution, and you can use that to send a normal GET query to another site, including query parameters.

http://example.com/action?search=thing

But, that will be a GET, not a POST.

Redirect works because it sends the URL to the browser, and the browser then resubmits it to the destination site.

The only way to send a POST is to send a populated HTML form to the browser, with the action parameter pointing to the new site and method="POST", and then use a little bit of Javascript to automatically submit the form once the page is loaded. For a small form filled with hidden fields, this is quite fast, most users won't even see it happen, but it does require javascript to be enabled in their browser.

Will Hartung
  • 115,893
  • 19
  • 128
  • 203
1

The technologies are different, but the answer to this previous question has a good description of the overall HTTP exchange. One of the strategies mentioned in that answer is for your action to do the post to the third-party site behind the scenes and then redirect to the appropriate location. This could be done via HttpClient or HttpURLConnection instead of the .NET HttpWebRequest.

Community
  • 1
  • 1
Rob Tanzola
  • 1,785
  • 14
  • 11