David Fry wrote:
Thanks for the great work on servicemix.
Thanks!
It looks like the codebase for the http package is getting refactored to
support inonly binding. Is there anyway within the current release to
use the HttpConnector class in an InOnly mode?
BTW the exception your getting below is fixed in CVS HEAD - the Servlet
now handles getting no response back from the binding.
I've also just refactored the HttpConnector / HttpInOutBinding so that
you can explicitly configure it to be in either InOnly or InOut mode -
and even derive from it to overload how to decide when to be in either
mode - which should make it easier to use in async / InOnly use cases.
e.g. you can just specify a new property
<component id="httpReceiver" service="my:httpBinding"
endpoint="httpReceiver"
class="org.servicemix.components.http.HttpConnector"
destinationService="my:fileSender">
<property name="defaultInOut" value="false"/>
...
I hope this helps?
James
I would prefer to use
the spring xml configuration to wire my components as follows:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:my="http://servicemix.org/demo/">
<!-- the JBI container -->
<container id="jbi">
<property name="useMBeanServer" value="true"/>
<property name="createMBeanServer" value="true"/>
<property name="dumpStats" value="true"/>
<property name="statsInterval" value="10"/>
<components>
<component id="httpReceiver" service="my:httpBinding"
endpoint="httpReceiver"
class="org.servicemix.components.http.HttpConnector"
destinationService="my:fileSender">
<property name="host" value="localhost"/>
<property name="port" value="8912"/>
</component>
<!-- Write files to the outbox directory -->
<component id="fileSender" service="my:fileSender"
class="org.servicemix.components.file.FileWriter">
<property name="directory" value="outbox"/>
<property name="marshaler">
<bean
class="org.servicemix.components.util.DefaultFileMarshaler">
<property name="fileName">
<bean
class="org.servicemix.expression.ConstantExpression">
<constructor-arg value="output.xml"/>
</bean>
</property>
</bean>
</property>
</component>
</components>
</container>
</beans>
and i get the following execption:
java.lang.NullPointerException
at
org.servicemix.components.http.HttpMarshaler.addHttpHeaders(HttpMarshaler.java:63)
at
org.servicemix.components.http.HttpMarshaler.toResponse(HttpMarshaler.java:47)
at
org.servicemix.components.http.HttpBinding.process(HttpBinding.java:74)
at
org.servicemix.components.http.BindingServlet.doPost(BindingServlet.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:354)
at
org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:657)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
at
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:961)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:197)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:276)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:511)
--
James
-------
http://radio.weblogs.com/0112098/