Results 1 to 4 of 4

Thread: Http POST from Spring Integration to MVC controller?

  1. #1
    Join Date
    Jul 2008
    Location
    Maasmechelen (Belgium)
    Posts
    157

    Red face Http POST from Spring Integration to MVC controller?

    Hi all,

    I'm having trouble figuring out how spring integration can communicate with a Spring MVC controller.

    The basic "http" example just posts a "Hello" String to a server:
    PHP Code:
        <int:gateway id="requestGateway" 
                     
    service-interface="org.springframework.integration.samples.http.RequestGateway"
                     
    default-request-channel="requestChannel"/>
        
        <
    int:channel id="requestChannel"/>

        <
    int-http:outbound-gateway request-channel="requestChannel" 
                                   
    url="http://localhost:8080/http/receiveGateway"
                                   
    http-method="POST"
                                   
    expected-response-type="java.lang.String"/> 
    But how would a controller be able to catch this String? In html form posts there is an id (variable name) associated with the variable content, but not in this case.

    Thanks a lot in advance!!

    Jochen

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    If you want to provide what is essentially "form data" to the HTTP server, then try passing a payload of type Map or MultiValueMap. Also you should set the content-type header (e.g. using the constant: MediaType.APPLICATION_FORM_URLENCODED).

    Hope that helps.
    -Mark

  3. #3
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    We actually have an example that demonstrates what Mark had described
    http://git.springsource.org/spring-i...multipart-http

  4. #4
    Join Date
    Jul 2008
    Location
    Maasmechelen (Belgium)
    Posts
    157

    Default

    Thanks a lot!
    Got my controller picking up the requests smoothly now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •