Hi On Tue, Aug 4, 2009 at 7:52 AM, jjb<jj_burf...@yahoo.com> wrote: > > I have a hierarchy of objects which looks like this: > > public BaseClass implements javax.jms.MessageListener > { > public void onMessage(javax.jms.Message message) > { > // do something > } > } > > public DerivedClass extends BaseClass > { > public void process(String body) > { > // do something > } > } > > I then have the following XML in my camel-context.xml: > > <bean id="processor" class="DerivedClass"/> > > <route> > <from uri="activemq:request.queue"/> > <to uri="bean:processor?method=process"/> > </route> > > When I run this code, all messages from request.queue always go to > BaseClass.onMessage, even though I explicitly want them to go to > DerivedClass.process. Have I done something wrong or is this a bug (I read > through the bean binding and it said it would first use methods that were > explicitly specified in the bean's method parameter)? >
We have fixed a bug in this relation in 2.0.x (cant remember the version, might be the 2.0m3). In older versions you can work around this by adding an @Body annotation to your base class public void process(@Body String body) And Camel should prefer to use this method. > I also notice that the new 2.0-M3 version of camel-http no longer contains > the class org.apache.camel.component.http.HttpExchange. Therefore, this > code no longer compiles: > > public void process(Exchange exchange) > { > try > { > HttpServletResponse response = > ((HttpExchange)exchange).getResponse(); > HttpServletRequest request = > ((HttpExchange)exchange).getRequest(); > HttpSession session = null; > if (request != null) > session = request.getSession(true); > } > catch (Exception e) > { e.printStackTrace(); } > } > > Is there a new way to get the HttpServletResponse and such from the Exchange > parameter? Its on the HttpMessage instead. HttpMessage in = (HttpMessag) exchange.getIn(); HttpServletRequest = in.getRequest(); > > Regards > -- > View this message in context: > http://www.nabble.com/bean-binding-with-inheritance---2.0-M3-camel-http-tp24802648p24802648.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus