Announcement Announcement Module
Collapse
No announcement yet.
http outbound channel adapter does not follow redirect Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • http outbound channel adapter does not follow redirect

    Hi,

    in the case I'm trying to address, I receive a call from a third party system that I handle using Spring Integration 2.2.0. After processing the message I have to call back the third party making a rest call to delete or update an entry. The third party server responds with a 302 and a Location header but the http outbound gateway or the channel adapters don't follow the redirect.

    <int:chain input-channel="out2" output-channel="nullChannel">
    <int:service-activator expression="aCorrectExpressionWasHere"/>
    <int-http:outbound-gateway
    url-expression ="headers.alertUrl"
    http-method="PUT" reply-channel="nullChannel"
    expected-response-type="java.lang.String" />
    </int:chain>

    any idea what I might be doing wrong?

    Best regards,

  • #2
    Hello!

    So, do you mean that your 'headers.alertUrl' is an URL where you have to send your PUT request?
    What problem are getting?
    Have you debuged it?
    Do you have some Exception?

    Sorry, now it isn't clear what's going on.

    By design everything looks good.

    Take care,
    Artem

    Comment


    • #3
      Originally posted by Cleric View Post
      Hello!

      So, do you mean that your 'headers.alertUrl' is an URL where you have to send your PUT request?
      What problem are getting?
      Have you debuged it?
      Do you have some Exception?

      Take care,
      Artem
      Hi Artem,

      Thanks for your reply.

      For the first question, you are right. The URL is Ok and the rest template properly sends the request to the destination and gets an answer. The reply from the server is a 302 (the object at the rest URL has been properly found) and a Location header with the same exact URL I passed the first time. The third party server expects me to recall the URL to confirm update. This should work fine and it does work fine with curl-like clients. However the gateway doesn't finish it's job by sending the new request has it should in reply to the 302 redirect.

      I did a temporary workaround for this by setting a channel after the first request and emitting myself a new request. But it should work without this :S

      Regards,
      Fabrice

      Comment


      • #4
        OK, I'll take a look and let you know

        Comment


        • #5
          Originally posted by Cleric View Post
          OK, I'll take a look and let you know
          Great thanks !

          Comment


          • #6
            Take a look here, please: http://forum.springsource.org/showth...n-resttemplate
            and here: https://jira.springsource.org/browse/SPR-5653
            So, the main solution: don't use follow redirects at all.
            But it is up to you: by default RestTemplate allows FollowRedirects only for GET.
            Nevertheless you can implement your own one.
            And this task is out of scope of Spring Integration...

            Cheers!

            Comment


            • #7
              Originally posted by Cleric View Post
              Take a look here, please: http://forum.springsource.org/showth...n-resttemplate
              and here: https://jira.springsource.org/browse/SPR-5653
              So, the main solution: don't use follow redirects at all.
              But it is up to you: by default RestTemplate allows FollowRedirects only for GET.
              Nevertheless you can implement your own one.
              And this task is out of scope of Spring Integration...

              Cheers!
              Yes I saw this page. But as Arjen said it was fixed I thought that it followed redirects for any method. I was hoping not to have to write a single line of code.

              I'll do what you suggest, thanks !

              Comment


              • #8
                No, Arjen said a bit different: just re-read https://jira.springsource.org/browse/SPR-5653.

                Comment

                Working...
                X