Announcement Announcement Module
Collapse
No announcement yet.
Http POST from Spring Integration to MVC controller? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


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

      Comment


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

        Comment

        Working...
        X