osgi - How do I deploy Apache Camel 4.x REST servlet on Karaf 4.4.7 - Stack Overflow

admin2025-04-16  2

I am trying to deploy an OSGi bundle that includes Camel 4.9 <rest> routes on to Apache Karaf 4.4.7. Part of the process includes registering the corresponding Camel CamelHttpTransportServlet with Karaf's OSGi HttpService. However, Camel's OsgiServletRegisterer no longer exists in Camel 4.x; therefore, this preclude me from registering CamelHttpTransportServlet.

This snippet of XML shows how the registration is done with Camel 3.x

<reference id="httpService" interface="org.osgi.service.http.HttpService" />
<bean class="org.apache.camelponent.servlet.osgi.OsgiServletRegisterer"
  init-method="register" destroy-method="unregister">
  <property name="alias" value="/avs" />
  <property name="httpService" ref="httpService" />
  <property name="servlet" ref="camelServlet" />
  <property name="servletName" value="camelServletAvsSvc" />
</bean>
<bean id="camelServlet" class="org.apache.camelponent.servlet.CamelHttpTransportServlet" />

But in Camel 4.x, the OsgiServletRegisterer is no longer present. So how can I register CamelHttpTransportServlet with the OSGi HttpService on Karaf 4.4.7?

转载请注明原文地址:http://www.anycun.com/QandA/1744761235a87242.html