Finally I did get this running based on the Camel examples.

Configuration XML ..

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>

        <reference id="httpService" 
interface="org.osgi.service.http.HttpService"/>

        <bean id="camelHttpTransportServlet" 
class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>

        <bean id="servlet" 
class="org.apache.camel.component.servlet.osgi.OsgiServletRegisterer"
        init-method="register"
        destroy-method="unregister">
                <property name="alias" value="/api"/>
                <property name="httpService" ref="httpService"/>
                <property name="servlet" ref="camelHttpTransportServlet"/>
        </bean>

</blueprint>

.. and REST API ..

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>

        <camelContext id="isp.routes.RST" 
xmlns="http://camel.apache.org/schema/blueprint"; streamCache="true">

                <restConfiguration component="servlet" bindingMode="json" 
contextPath="/api" port="443">
                        <dataFormatProperty key="prettyPrint" value="true"/>
                </restConfiguration>

                <rest path="/say">
                        <get uri="/hello" consumes="application/json" 
id="isp.routes.RST001">
                                <to uri="direct:hello"/>
                        </get>
                        <get uri="/bye" consumes="application/json" 
id="isp.routes.RST002">
                                <to uri="direct:bye"/>
                        </get>
                </rest>

                <route id="isp.routes.RST003">
                        <from uri="direct:hello"/>
                        <setHeader name="Content-Type">
                                <constant>application/json</constant>
                        </setHeader>
                        <transform>
                                <constant>{"text": "Hello World"}</constant>
                        </transform>
                </route>

                <route id="isp.routes.RST004">
                        <from uri="direct:bye"/>
                        <setHeader name="Content-Type">
                                <constant>application/json</constant>
                        </setHeader>
                        <transform>
                                <constant>{"text": "Bye World"}</constant>
                        </transform>
                </route>

        </camelContext>

</blueprint>

Best
- Gerald

> Gerald Kallas <catsh...@mailbox.org> hat am 3. Februar 2020 17:15 geschrieben:
> 
>  
...
> Jean-Baptiste Onofré <j...@nanthrax.net> hat am 3. Februar 2020 14:09 
> geschrieben:
> 
>  
> Oh, sorry, the example was in spring, not blueprint.
> 
> Let me check in the component how to inject the configuration.
> 
> Regards
> JB
> 
...

Reply via email to