Announcement Announcement Module
Collapse
No announcement yet.
Post To Another Website Using Spring MVC Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Post To Another Website Using Spring MVC

    How does one post to another website using Spring MVC (Spring 3.0.x)?
    Last edited by finneycanhelp; May 17th, 2011, 06:44 AM. Reason: added spring version number

  • #2
    Use RestTemplate (assuming the target website has a Rest service).

    Check the following guides:
    http://krams915.blogspot.com/2011/02...vider-and.html
    http://krams915.blogspot.com/2011/02...er-and_28.html

    Comment


    • #3
      Thanks for replying. They do not have a REST service.

      We're being asked to send form content from one of our pages to someone elses server. However, we're supposed to make all the fields required on the form. That leads us to two options. 1) Javascript 2) submit content to our server and if it checks out, then POST the content on to their server as if it came from the browser.

      Initially, I was concerned about how to take their server's response and feed that response from someone elses server to the browser that connected to our server. However, now that I think about it deeper.... I do not have to feed their server's exact response to the browser. I just need to tell the browser to go to the Thanks For Entering In The Information page or do something else if their server gives back an unhappy response.

      So, now the only mystery is the unhappy response part. URLConnection may hold the key to that. http://download.oracle.com/javase/1....onnection.html Thoughts?
      Last edited by finneycanhelp; May 26th, 2011, 07:21 AM.

      Comment


      • #4
        I had to do something similar and I used the commons HTTPClient library to make the request on behalf of the user and get the response back. I could then parse the response for confirmation or errors.

        Comment


        • #5
          Originally posted by MartyJones View Post
          I had to do something similar and I used the commons HTTPClient library to make the request on behalf of the user and get the response back. I could then parse the response for confirmation or errors.
          http://hc.apache.org/httpcomponents-client-ga/ ? What does ga mean? Is it latest stable?

          Comment


          • #6
            go for HttpClient 4.1. this is the recomended one on the apache site

            Comment

            Working...
            X