Results 1 to 6 of 6

Thread: HTTP 404 Error with Inbound Query Params

  1. #1
    Join Date
    Aug 2007
    Posts
    138

    Default 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. #2
    Join Date
    Aug 2007
    Posts
    138

    Default

    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.

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

    Default

    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?

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

    Default

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

  5. #5
    Join Date
    Aug 2007
    Posts
    138

    Default

    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.

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

    Default

    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

Posting Permissions

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