httpUri is a path parameter, this means it should go as parameter in the URI
- to:
uri: https://{{customhttpUri}}
Il giorno gio 1 mag 2025 alle ore 14:27 Rohan Emmanuel <
[email protected]> ha scritto:
> i had created this kamelet to forward the HTTP request received via servlet
> component to an external service using HTTP component.
> the contextPath , customhttpUri and a few other properties like HTTP
> methods are configurable as properties on the kamelet.
>
> adding snippet of the custom kamelet for your reference:
>
> template:
> route:
> from:
> uri: servlet
> parameters:
> contextPath: "{{contextPath}}"
> httpMethodRestrict: "{{?httpMethodRestrict}}"
> matchOnUriPrefix: true
>
> steps:
> - choice:
> id: choice-2ed3
>
> when:
> - id: when-6d64
> expression:
> simple:
> id: simple-4h57
> expression: ${exchangeProperty.Protocol} ==
> 'HTTP'
> steps:
> - removeHeader:
> name: CamelHttpUri
> - setHeader:
> name: CamelHttpMethod
> constant: '{{?customhttpMethod}}'
> - to:
> uri: https
> parameters:
> httpUri: "{{?customhttpUri}}"
> bridgeEndpoint: true
> throwExceptionOnFailure: false
>
> - to: kamelet:sink
>
> On Thu, May 1, 2025 at 5:43 PM Andrea Cosentino <[email protected]> wrote:
>
> > Can you show the kamelet code?
> >
> > Il gio 1 mag 2025, 14:10 Rohan Emmanuel <[email protected]> ha
> > scritto:
> >
> > > this is a custom kamelet which i had created.
> > >
> > > On Thu, May 1, 2025 at 4:09 PM Andrea Cosentino <[email protected]>
> > wrote:
> > >
> > > > Is this a custom kamelet or one from the catalog?
> > > >
> > > > Il giorno gio 1 mag 2025 alle ore 07:07 Rohan Emmanuel <
> > > > [email protected]> ha scritto:
> > > >
> > > > > hi,
> > > > > if i add null check on kamelet property like below in my custom
> > > kamelet,
> > > > > the HTTP url constructed gets corrupted.
> > > > > - to:
> > > > > uri: https
> > > > > parameters:
> > > > > httpUri: "{{?customhttpUri}}"
> > > > > bridgeEndpoint: true
> > > > > throwExceptionOnFailure: false
> > > > >
> > > > > refer the attached log below, I observe that the URL constructed
> > would
> > > > > become
> > > > >
> > > > >
> > > >
> > >
> >
> http://127.0.0.1:1111/&bridgeEndpoint=true&throwExceptionOnFailure=false/foo/bar
> > > > > Expectation was that the URL would be
> http://127.0.0.1:1111/foo/bar:
> > > > >
> > > > > if I remove the optional placeholder "?" in front of the optional
> > > > property
> > > > > customhttpUri and use {{customhttpUri}}, I see the expected
> results.
> > > > >
> > > > > org.apache.camel.processor.SendProcessor;>>>>
> > > > >
> > > >
> > >
> >
> https://127.0.0.1:1111/&bridgeEndpoint=true&throwExceptionOnFailure=false
> > > > > Exchange[4F9AEEBED33A422-0000000000000000
> > > > > <
> > > >
> > >
> >
> https://127.0.0.1:1111/&bridgeEndpoint=true&throwExceptionOnFailure=falseExchange%5B4F9AEEBED33A422-0000000000000000
> > > > >
> > > > > ]
> > > > > org.apache.camel.component.http.HttpProducer;Using URL:
> > > > >
> > > > >
> > > >
> > >
> >
> http://127.0.0.1:1111/&bridgeEndpoint=true&throwExceptionOnFailure=false/foo/bar
> > > > > with method: POST
> > > > > /&bridgeEndpoint=true&throwExceptionOnFailure=false/foo/bar
> > > > > org.apache.camel.component.http.HttpProducer;Executing http POST
> > > method:
> > > > >
> > > > >
> > > >
> > >
> >
> http://127.0.0.1:1111/&bridgeEndpoint=true&throwExceptionOnFailure=false/foo/bar
> > > > >
> > > > > --
> > > > > Regards,
> > > > > Rohan Emmanuel
> > > > >
> > > >
> > >
> > >
> > > --
> > > Regards,
> > > Rohan Emmanuel
> > >
> >
>
>
> --
> Regards,
> Rohan Emmanuel
>