Announcement Announcement Module
Collapse
No announcement yet.
HTTP 404 Error with Inbound Query Params Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTTP 404 Error with Inbound Query Params

    I am using Spring Integration as an intermediary between a REST client and an existing REST service, and the target URL has a path parameter and a query parameter. I have modeled my inbound configuration similarly:

    Code:
    <http:inbound-gateway id="documentsByTextAndCategoryInboundGateway"
                              request-channel="documentsByTextAndCategoryRequestChannel"
                              reply-channel="documentsByTextAndCategoryReplyChannel"
                              name="/documents/text/{text}?category={category}"
                              supported-methods="GET"/>
    However, when I try to access SI via HTTP, I get a 404. If I simply remove the query parameter like this:

    http://localhost:8080/myapp/documents/text/{text}

    Then I am able to connect to SI.

    I know that I could simply rewrite the inbound URL to not have any query parameters, but is there another way? Or am I simply doing something wrong?

    Any insight is appreciated.

    Thanks.

  • #2
    A careful reading of the SI debug logs and some trial and error revealed that the inbound gateway URL needs to have no query parameters. Meanwhile, the way you grab the category query parameter for use in the outbound call in my case is as follows:

    Code:
    <int-http:uri-variable name="category" expression="payload['category'][0]"/>
    Hope that helps someone.

    Thanks.

    Comment


    • #3
      Sorry for not replying sooner, but I'm glad to see that you discovered what to change. The way that 'name' works is just like the use of a bean name for a Spring MVC Controller. In other words, it's providing the URL-mapping (and does not expect 'variables' or query Strings in that path). Also, as I think you discovered, a GET request will produce a Map-typed payload, so your query parameters are available there. Do you also need access to something from the URI "path", or was that just a unknown part of the URI that you were mapping?

      Comment


      • #4
        I should clarify: the GET request payload type is a *MultiValueMap* instance. Obviously, your SpEL expression above reflects that.

        Comment


        • #5
          No problem on the delay, Mark. You got plenty to do.

          As for your question, I do indeed need access to something from the URI "path." I mentioned that in a previous thread and worked around it by using a spEL expression with some string manipulation.

          On your suggestion, I created a feature request to be able to access those path parameters via an API call rather than verbose, error-prone string stuff.

          But we're good on query parameters.

          Thanks.

          Comment


          • #6
            Okay... now I'm putting it all together. So, we'll be looking forward to your feedback as we develop the URI-path mapping functionality. It sounds like you are all set with the interim solution.

            Thanks for the update.
            -Mark

            Comment

            Working...
            X