Announcement Announcement Module
Collapse
No announcement yet.
http:inbound-channel-adapter pathVariables BeanNameUrlHandlerMapping problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • http:inbound-channel-adapter pathVariables BeanNameUrlHandlerMapping problem

    Hello!
    I'm trying to fetch variables from an incoming HTTP GET request path without success.
    How is the correct way to do this? Thanks!

    Code:
    <spring.integration.version>2.2.3.RELEASE</spring.integration.version>
    Code:
    <int-http:inbound-channel-adapter channel="fromHttp" name="/bean/{myName}/{myAge}" supported-methods="GET, POST" payload-expression="#pathVariables.myName - #pathVariables.myAge" />
    Code:
    DEBUG BeanNameUrlHandlerMapping - Matching patterns for request [/bean/a/2] are [/bean/{myName}/{myAge}]
    DEBUG BeanNameUrlHandlerMapping - URI Template variables for request [/bean/a/2] are {myName=a, myAge=2}
    Code:
    DEBUG DispatcherServlet - Could not complete request
    org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 15): Field or property 'myName' cannot be found on null

  • #2
    Hi!

    SpelEvaluationException: EL1007Epos 15): Field or property 'myName' cannot be found on null
    To get a good result you have to use 'path' attribute and UriPathHandlerMapping instead of BeanNameUrlHandlerMapping:http://static.springsource.org/sprin...http-namespace
    The 'pathVariables' will are extracted in the HttpRequestHandlingEndpointSupport only if 'path' property provided.

    Take care,
    Artem

    Comment


    • #3
      That's it. It worked!
      But I had to let the two properties on the bean: 'name' for the DispatcherServlet resolution and 'path' for the pathVariables extraction. Is there a more elegant way to configure this?

      Code:
      	<int-http:inbound-channel-adapter channel="fromHttp" name="/bean/{name}/{age}" path="/bean/{name}/{age}" supported-methods="GET">
      		<int-http:header name="name" expression="#pathVariables.name" />
      		<int-http:header name="age" expression="#pathVariables.age" />
      	</int-http:inbound-channel-adapter>

      Comment

      Working...
      X