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

  • http:inbound-channel-adapter view problem

    Hi

    I'm setting up an “http:inbound-channel-adapter” where I need to format validation messages to be sent back to the client and I'm having problems defining the view-name attribute.

    I have:

    <http:inbound-channel-adapter id="httpInboundAdapter"
    channel="requestChannel"
    supported-methods="POST"
    message-converters="stringMessageConverter"
    request-payload-type="java.lang.String"
    view-name="myView"
    />

    On the web.xml I have

    <servlet>
    <servlet-name>httpInboundAdapter</servlet-name>
    <servlet-class>org.springframework.web.context.support.Http RequestHandlerServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ordersInboundAdapter</servlet-name>
    <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>

    when I don't define the view-name, it works but on a validation error, it just sends back to the client the stack trace. When I add the view name, then it stops working and send the following error:

    org.springframework.beans.factory.BeanNotOfRequire dTypeException: Bean named 'httpInboundAdapter' must be of type [org.springframework.web.HttpRequestHandler], but was actually of type [org.springframework.integration.http.inbound.HttpR equestHandlingController]
    org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:349 )
    org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:194)
    org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:1079)
    org.springframework.web.context.support.HttpReques tHandlerServlet.init(HttpRequestHandlerServlet.jav a:57)
    javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
    org.apache.catalina.valves.RewriteJvmRouteValve.in voke(RewriteJvmRouteValve.java:49)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:286)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:845)
    org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:583)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:447)
    java.lang.Thread.run(Thread.java:662)

    Does anybody know why? Is there any example of how to set up a “http:inbound-channel-adapter”.. maybe its the way I have set it up on the wed.xml file...

    Any pointer will be much appreciated.

    Thanks

    Roberto

  • #2
    The basic idea is that the 'view-name' support builds upon Spring MVC functionality. So, you would setup a Spring MVC DispatcherServlet (and potentially an explicitly configured ViewResolver). When not using a view, the MVC base is not required, and that is why the simple delegating Servlet option works in that case.

    Does that help?
    -Mark

    Comment


    • #3
      Thanks Mark for you answer, it makes perfect sense.

      Cheers

      Roberto

      Comment

      Working...
      X