codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Netty with REST DSL...


I've been looking at some of the documentation and samples with Netty. I'm
especially interested in the fact that the Netty server can be set up in a
bundle and exported as a service and then used in other bundles. In the past
I've used CXF and CXFRS for web services but I'm interested in the
possibility of using Netty as an OSGi service and then hooking into it using
the Camel REST DSL when bundles are installed or uninstalled.

 

However, the examples I've seen of the REST DSL with Netty are configuring
it directly. So the question is, can a #registryReference be used to
configure the REST DSL to use a configuration that is in the registry?

 

So, for example, a bundle starts and gets the reference to the netty
configured component.

 


<!-- reference the shared http server -->

	

<reference id="sharedNettyHttpServer"
interface="org.apache.camel.component.netty.http.NettySharedHttpServer"/>

 

 

@Override

public void configure() throws Exception {

//      WOULD THIS BE THE CORRECT WAY TO HOOK THAT CONFIGURATION IN?

 
restConfiguration().component("netty4-http").endpointProperty("nettySharedHt
tpServer","#sharedNettyHttpServer").bindingMode(RestBindingMode.json);

     rest("/user")

         .get("/{id}").produces("application/json").to("direct:getUser")

 
.post().consumes("application/json").type(User.class).to("direct:createUser"
)

         .delete("/{id}").to("direct:deleteUser");

 

 

http://camel.apache.org/netty-http-server-example.html

https://github.com/apache/camel/tree/master/examples/camel-example-netty-htt
p