Hello.

It seems a bit more complex than my 10 lines route, but I'm going to test it...

Thanks a lot.


Le jeu. 19 janv. 2023 à 17:09, Daniel Langevin
<daniel.lange...@shq.gouv.qc.ca> a écrit :
>
> Hi,
>
> Here the way i used  Karaf listener port 8181 in my deployment, may be it can 
> help you with jetty.  !!!
>
>
> == SAMPLE blueprint deployment ==
>
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint
>     xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>     xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";
>     xmlns:camel="http://camel.apache.org/schema/blueprint";
>     xmlns:osgi="http://www.springframework.org/schema/osgi";
>
>     xsi:schemaLocation="
>        http://www.osgi.org/xmlns/blueprint/v1.0.0 
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>        http://camel.apache.org/schema/blueprint  
> http://camel.apache.org/schema/blueprint/camel-blueprint-3.14.3.xsd
>        http://www.springframework.org/schema/osgi 
> http://www.springframework.org/schema/osgi/spring-osgi.xsd";>
>
> <!-- dependances -->
>   <manifest>
>   Bundle-Name    = bdl.routes_TTT
>   Bundle-Vendor  = SHQ
>   Require-Bundle = bdl.routes_XYZ
>   </manifest>
>
> <bean id="TTTCamelServlet" 
> class="org.apache.camel.component.servlet.CamelHttpTransportServlet" />
>     <service ref="TTTCamelServlet">
>         <interfaces>
>             <value>javax.servlet.Servlet</value>
>             <value>org.apache.camel.http.common.CamelServlet</value>
>         </interfaces>
>         <service-properties>
>             <entry key="alias" value="/rest/TTT" />
>             <entry key="matchOnUriPrefix" value="true" />
>             <entry key="servlet-name" value="TTTCamelServlet" />
>         </service-properties>
>     </service>
>
> <camelContext id="Contexte-SHQ-TTT" 
> xmlns="http://camel.apache.org/schema/blueprint"; trace="false" >
>
> <restConfiguration bindingMode="auto" component="servlet"
>                    contextPath="/rest/TTT"
>                    host="{{smx.hostname}}"
>                    useXForwardHeaders="true"
>                    apiContextPath="/api-doc" apiContextListing="false" 
> apiContextRouteId="rte.TTT.docum"
>                    enableCORS="true">
>   <endpointProperty key="servletName" value="TTTCamelServlet" />
>   <dataFormatProperty key="prettyPrint" value="true"/>
>   <dataFormatProperty key="PropertyAccessor.FIELD"  value="Visibility.ANY"/>
>   <dataFormatProperty key="FAIL_ON_EMPTY_BEANS"  value="false"/>
>   <dataFormatProperty key="mustBeJAXBElement" value="false"/>
>   <apiProperty key="base.path" value="rest/TTT" />
>   <apiProperty key="api.description" value="{{SMIX.ENV}} - DOCUMENTATION DES 
> SERVICES DE TYPE REST"/>
>   <apiProperty key="api.title" value="Système TTT" />
>   <apiProperty key="api.version" value="{{SYS.VER}}"/>
>   <apiProperty key="api.contact.name" value="{{api.contact.name}}"/>
>   <apiProperty key="api.contact.email" value="{{api.contact.email}}"/>
>   <apiProperty key="api.termsOfService" value="{{api.termsOfService}}"/>
> </restConfiguration>
>
> <rest path="/echo" consumes="text/html" produces="application/json">
>  <description>Echo rest service</description>
>  <get uri="ping">
>     <description>Test de connectivite </description>
>     <route id="rte.TTT.rest.echo">
>         <log message="${header.CamelHttpPath}"/>
>         <setHeader name="zzcodeRetour"><constant>200</constant></setHeader>
>         <setHeader name="zzmsgRetour"><constant>succes</constant></setHeader>
>         <setHeader name="zzmsgCourt"><simple>PONG</simple></setHeader>
>         <setHeader name="zzmsgLong"><simple>{{SMIX.ENV}}/TTT/echo  
> PONG</simple></setHeader>
>         <setHeader name="zzdata"><constant>null</constant></setHeader>
>         <to uri="direct:jsonReponse" /> <!-- va formatter la reponse JSON -->
>         <removeHeaders pattern="*" />  <!-- exclut certaines entete mal géré 
> par SYS.UTL_HTTP de Oracle -->
>         <setHeader 
> name="Exchange.CONTENT_TYPE"><constant>application/json</constant></setHeader>
>     </route>
>  </get>
> </rest>
>
> <route id="rte.TTT.JsonReponse">
>  <description>TTT Formatage de la Reponse JSON de l'ESB</description>
>      <from uri="direct:jsonReponse" />
>      <setBody>
>         
> <simple>{"env":"{{env}}","api":"TTT","version":"{{SYS.VER}}","codeRetour":"${header.zzcodeRetour}","msgRetour":"${header.zzmsgRetour}","msgCourt":"${header.zzmsgCourt}","msgLong":"${header.zzmsgLong}","data"
>  : ${header.zzdata} }</simple>
>      </setBody>
>      <log message="Formatte la reponse"/>
> </route>
>
> </camelContext>
>
>
>
> Daniel Langevin
>
> Société d’habitation du Québec
> Édifice Marie-Guyart
> 1054, rue Louis-Alexandre-Taschereau
> Aile Jacques-Parizeau, 1er étage
> Québec (Québec) G1R 5E7
>
>
>
> -----Message d'origine-----
> De : Ephemeris Lappis <ephemeris.lap...@gmail.com>
> Envoyé : 19 janvier 2023 09:52
> À : users@camel.apache.org
> Objet : Camel : camel-jetty on Karaf
>
> Hello.
>
> Is there any way to configure jetty endpoints in routes to listen on the same 
> port that Karaf console uses ?
>
> If I don't set any port, it listens on the default 80.
> If I manually set it with the Karaf port (8181), an error logically says that 
> the address is already in use.
>
> Perhaps some other component lets me bind applications URL to the same HTTP 
> server without creating a new listener...
>
> This could help us to limit port mappings for our Camel applications running 
> in containers.
>
> Thanks for your help.
>
> Regards.

Reply via email to