You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by Charles Moulliard <cm...@gmail.com> on 2010/12/20 14:42:57 UTC

Jetty + security + camel servlet

Hi,

I would like to start a discussion around the following point as it does 
not seem obvious to find an answer. To authenticate a HTTP user with 
camel on Karaf we can use the component camel-jetty and camel-servlet. 
Jetty + JAAS + camel can be easily configured using Spring beans + 
securityHandler with camel but this does not seem the case with 
camel-servlet.

The component camel-servlet does not accept as parameter a handler(s) 
for Jetty. This is normal as camel can be deployed in different 
Application Servers which are not build with Jetty. So what 
alternative(s) exist to configure camel-servlet with Jetty + JAAS on 
Karaf ? Using jetty.xml (in etc folder) but how to link camel servlet 
with jetty security handler ?

Regards,

Charles

Re: Jetty + security + camel servlet

Posted by Charles Moulliard <cm...@gmail.com>.
Will have a look on that tomorrow.

On 20/12/10 15:15, Guillaume Nodet wrote:
> I'd use JAAS as there's no need to tie to jetty in that case.
> You can find an implementation of HttpContext in the webconsole:
>    http://svn.apache.org/repos/asf/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManagerHttpContext.java
>    http://svn.apache.org/repos/asf/karaf/trunk/webconsole/branding/src/main/java/org/apache/karaf/webconsole/JaasSecurityProvider.java
>
> On Mon, Dec 20, 2010 at 15:08, Charles Moulliard<cm...@gmail.com>  wrote:
>> As I configure the camelServlet using a Servlet Activator, I will follow the
>> way of OSGI and
>>
>> org.osgi.service.http.HttpContext
>>
>>
>> Do you suggest to call JAAS or to register the handlers required by Jetty in
>> the osgi servlet?
>>
>> On 20/12/10 14:59, Guillaume Nodet wrote:
>>> On Mon, Dec 20, 2010 at 14:42, Charles Moulliard<cm...@gmail.com>
>>>   wrote:
>>>> Hi,
>>>>
>>>> I would like to start a discussion around the following point as it does
>>>> not
>>>> seem obvious to find an answer. To authenticate a HTTP user with camel on
>>>> Karaf we can use the component camel-jetty and camel-servlet. Jetty +
>>>> JAAS +
>>>> camel can be easily configured using Spring beans + securityHandler with
>>>> camel but this does not seem the case with camel-servlet.
>>>>
>>>> The component camel-servlet does not accept as parameter a handler(s) for
>>>> Jetty. This is normal as camel can be deployed in different Application
>>>> Servers which are not build with Jetty. So what alternative(s) exist to
>>>> configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml (in
>>>> etc
>>>> folder) but how to link camel servlet with jetty security handler ?
>>>>
>>> Unless I'm wrong, when you use camel-servlet, you're responsible for
>>> setting up the CamelHttpTransportServlet servlet.
>>> In OSGi, it could be done either using a standard web application
>>> (deployed using the war support), or directly using the OSGi HTTP
>>> service.  In the former case, you'd have to configure the web.xml for
>>> security.  In the latter case, you need to use the OSGi HTTP service
>>> api to properly configure the security bits (by implementing
>>> org.osgi.service.http.HttpContext interface).
>>>
>>> I agree we could have an example of showing the last way in camel .
>>> Configuring the war for security isn't specific to OSGi or Camel fwiw.
>>>
>>>> Regards,
>>>>
>>>> Charles
>>>>
>>>
>
>

Re: Jetty + security + camel servlet

Posted by Guillaume Nodet <gn...@gmail.com>.
I'd use JAAS as there's no need to tie to jetty in that case.
You can find an implementation of HttpContext in the webconsole:
  http://svn.apache.org/repos/asf/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManagerHttpContext.java
  http://svn.apache.org/repos/asf/karaf/trunk/webconsole/branding/src/main/java/org/apache/karaf/webconsole/JaasSecurityProvider.java

On Mon, Dec 20, 2010 at 15:08, Charles Moulliard <cm...@gmail.com> wrote:
> As I configure the camelServlet using a Servlet Activator, I will follow the
> way of OSGI and
>
> org.osgi.service.http.HttpContext
>
>
> Do you suggest to call JAAS or to register the handlers required by Jetty in
> the osgi servlet?
>
> On 20/12/10 14:59, Guillaume Nodet wrote:
>>
>> On Mon, Dec 20, 2010 at 14:42, Charles Moulliard<cm...@gmail.com>
>>  wrote:
>>>
>>> Hi,
>>>
>>> I would like to start a discussion around the following point as it does
>>> not
>>> seem obvious to find an answer. To authenticate a HTTP user with camel on
>>> Karaf we can use the component camel-jetty and camel-servlet. Jetty +
>>> JAAS +
>>> camel can be easily configured using Spring beans + securityHandler with
>>> camel but this does not seem the case with camel-servlet.
>>>
>>> The component camel-servlet does not accept as parameter a handler(s) for
>>> Jetty. This is normal as camel can be deployed in different Application
>>> Servers which are not build with Jetty. So what alternative(s) exist to
>>> configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml (in
>>> etc
>>> folder) but how to link camel servlet with jetty security handler ?
>>>
>> Unless I'm wrong, when you use camel-servlet, you're responsible for
>> setting up the CamelHttpTransportServlet servlet.
>> In OSGi, it could be done either using a standard web application
>> (deployed using the war support), or directly using the OSGi HTTP
>> service.  In the former case, you'd have to configure the web.xml for
>> security.  In the latter case, you need to use the OSGi HTTP service
>> api to properly configure the security bits (by implementing
>> org.osgi.service.http.HttpContext interface).
>>
>> I agree we could have an example of showing the last way in camel .
>> Configuring the war for security isn't specific to OSGi or Camel fwiw.
>>
>>> Regards,
>>>
>>> Charles
>>>
>>
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Jetty + security + camel servlet

Posted by Charles Moulliard <cm...@gmail.com>.
As I configure the camelServlet using a Servlet Activator, I will follow 
the way of OSGI and

org.osgi.service.http.HttpContext


Do you suggest to call JAAS or to register the handlers required by 
Jetty in the osgi servlet?

On 20/12/10 14:59, Guillaume Nodet wrote:
> On Mon, Dec 20, 2010 at 14:42, Charles Moulliard<cm...@gmail.com>  wrote:
>> Hi,
>>
>> I would like to start a discussion around the following point as it does not
>> seem obvious to find an answer. To authenticate a HTTP user with camel on
>> Karaf we can use the component camel-jetty and camel-servlet. Jetty + JAAS +
>> camel can be easily configured using Spring beans + securityHandler with
>> camel but this does not seem the case with camel-servlet.
>>
>> The component camel-servlet does not accept as parameter a handler(s) for
>> Jetty. This is normal as camel can be deployed in different Application
>> Servers which are not build with Jetty. So what alternative(s) exist to
>> configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml (in etc
>> folder) but how to link camel servlet with jetty security handler ?
>>
> Unless I'm wrong, when you use camel-servlet, you're responsible for
> setting up the CamelHttpTransportServlet servlet.
> In OSGi, it could be done either using a standard web application
> (deployed using the war support), or directly using the OSGi HTTP
> service.  In the former case, you'd have to configure the web.xml for
> security.  In the latter case, you need to use the OSGi HTTP service
> api to properly configure the security bits (by implementing
> org.osgi.service.http.HttpContext interface).
>
> I agree we could have an example of showing the last way in camel .
> Configuring the war for security isn't specific to OSGi or Camel fwiw.
>
>> Regards,
>>
>> Charles
>>
>
>

Re: Jetty + security + camel servlet

Posted by Guillaume Nodet <gn...@gmail.com>.
Just raised https://issues.apache.org/jira/browse/CAMEL-3490 for that

On Mon, Jan 3, 2011 at 18:22, Guillaume Nodet <gn...@gmail.com> wrote:
> On Mon, Jan 3, 2011 at 17:55, Charles Moulliard <cm...@gmail.com> wrote:
>> What you suggest (component=servlet) is by example what has been done in
>> this project of camel --> org.apache.camel.component.paxlogging ?
>
> Yes, the same way as for paxlogging camel component.
>
>> Question:  Is there a way to check that pax-web has well registered the
>> servlet defined in the web.xml file and deployed as a jar in hot deploy
>> directory ?
>
> If we were to rely on the osgi http service instead of pax-web, it
> would be a bit more portable.
> Just adding an osgi activator to camel-servlet would work fine for
> that imho, as the activator could register both the servlet in the
> osgi http service and the component resolver.
>
> Btw, this discussion is much more related to camel than karaf ;-)
>
>> On 03/01/11 17:33, Guillaume Nodet wrote:
>>>
>>> I think it should work, it may be a class loader issue.
>>> I think you have two solutions overall:
>>>   * either you create you own jetty server using camel-jetty and you
>>> set up the jetty server yourself
>>>   * you can use a wab packaging
>>>   * or you want to reuse the osgi http service and you need to set up
>>> a servlet and configure the security on the servlet
>>> For the later, the packaging does not have to be a war, but if you
>>> don't use a war, you'll have to write the code that will do the
>>> security and will register the servlet in the osgi http service.
>>> I think the easiest is using a wab, you just need to make sure you
>>> don't include the camel-servlet component or any camel jar into the
>>> war.
>>> Actually, if should start with an exploded war and a simple web.xml to
>>> make sure you don't include any code in the war itself.  I guess the
>>> trick is to expose the component so that other camel will find it.  It
>>> can be done by registering a ComponentResolver with a property
>>> (component=servlet) that would always register the same servlet
>>> component instance.
>>>
>>> On Mon, Jan 3, 2011 at 17:01, Charles Moulliard<cm...@gmail.com>
>>>  wrote:
>>>>
>>>> I don't think that packaging camel-servlet in a war will work. Even if
>>>> we create a jar (=WAB, WAB) containing a web.xml with description of
>>>> servlet
>>>>
>>>>    <servlet>
>>>>        <servlet-name>CamelServlet</servlet-name>
>>>>        <display-name>Camel Http Transport Servlet</display-name>
>>>>        <servlet-class>
>>>>            org.apache.camel.component.servlet.CamelHttpTransportServlet
>>>>        </servlet-class>
>>>>        <init-param>
>>>>          <param-name>matchOnUriPrefix</param-name>
>>>>          <param-value>true</param-value>
>>>>        </init-param>
>>>>        <load-on-startup>1</load-on-startup>
>>>>
>>>>    </servlet>
>>>>
>>>> Caused by: java.lang.IllegalArgumentException: Cannot find the
>>>> deployed servlet, please configure the ServletComponent or configure a
>>>> org.apache.camel.component.servlet.CamelHttpTransportServlet servlet
>>>> in web.xml
>>>>        at
>>>> org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
>>>>        at
>>>> org.apache.camel.component.servlet.ServletComponent.connect(ServletComponent.java:109)
>>>>        at
>>>> org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:148)
>>>>        at
>>>> org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:52)
>>>>        at
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>>>>        at
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>>>>        at
>>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1484)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1750)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1703)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1629)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1419)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1314)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1213)
>>>>        at
>>>> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)
>>>>        at
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>>>>        at
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1191)
>>>>        at
>>>> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)
>>>>        at
>>>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
>>>>
>>>>
>>>> it will not be possible for camel to find the CamelHttpServlet
>>>>
>>>> Regards,
>>>>
>>>> Charles Moulliard
>>>>
>>>> Sr. Principal Solution Architect - FuseSource
>>>> Apache Committer
>>>>
>>>> Blog : http://cmoulliard.blogspot.com
>>>> Twitter : http://twitter.com/cmoulliard
>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>> Skype: cmoulliard
>>>>
>>>>
>>>>
>>>> On Mon, Dec 20, 2010 at 3:06 PM, Achim Nierbeck<bc...@googlemail.com>
>>>>  wrote:
>>>>>
>>>>> Just one more comment from me, a OSGi-War (aka wab) can also be used :)
>>>>> Totally forgot to mention that when Charles asked me directly, and I
>>>>> didn't
>>>>> have a real good answer ;)
>>>>>
>>>>> 2010/12/20 Guillaume Nodet<gn...@gmail.com>
>>>>>
>>>>>> On Mon, Dec 20, 2010 at 14:42, Charles Moulliard<cm...@gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I would like to start a discussion around the following point as it
>>>>>>> does
>>>>>>
>>>>>> not
>>>>>>>
>>>>>>> seem obvious to find an answer. To authenticate a HTTP user with camel
>>>>>>> on
>>>>>>> Karaf we can use the component camel-jetty and camel-servlet. Jetty +
>>>>>>
>>>>>> JAAS +
>>>>>>>
>>>>>>> camel can be easily configured using Spring beans + securityHandler
>>>>>>> with
>>>>>>> camel but this does not seem the case with camel-servlet.
>>>>>>>
>>>>>>> The component camel-servlet does not accept as parameter a handler(s)
>>>>>>> for
>>>>>>> Jetty. This is normal as camel can be deployed in different
>>>>>>> Application
>>>>>>> Servers which are not build with Jetty. So what alternative(s) exist
>>>>>>> to
>>>>>>> configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml
>>>>>>> (in
>>>>>>
>>>>>> etc
>>>>>>>
>>>>>>> folder) but how to link camel servlet with jetty security handler ?
>>>>>>>
>>>>>> Unless I'm wrong, when you use camel-servlet, you're responsible for
>>>>>> setting up the CamelHttpTransportServlet servlet.
>>>>>> In OSGi, it could be done either using a standard web application
>>>>>> (deployed using the war support), or directly using the OSGi HTTP
>>>>>> service.  In the former case, you'd have to configure the web.xml for
>>>>>> security.  In the latter case, you need to use the OSGi HTTP service
>>>>>> api to properly configure the security bits (by implementing
>>>>>> org.osgi.service.http.HttpContext interface).
>>>>>>
>>>>>> I agree we could have an example of showing the last way in camel .
>>>>>> Configuring the war for security isn't specific to OSGi or Camel fwiw.
>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Charles
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Cheers,
>>>>>> Guillaume Nodet
>>>>>> ------------------------
>>>>>> Blog: http://gnodet.blogspot.com/
>>>>>> ------------------------
>>>>>> Open Source SOA
>>>>>> http://fusesource.com
>>>>>>
>>>
>>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Jetty + security + camel servlet

Posted by Guillaume Nodet <gn...@gmail.com>.
Just raised https://issues.apache.org/jira/browse/CAMEL-3490 for that

On Mon, Jan 3, 2011 at 18:22, Guillaume Nodet <gn...@gmail.com> wrote:
> On Mon, Jan 3, 2011 at 17:55, Charles Moulliard <cm...@gmail.com> wrote:
>> What you suggest (component=servlet) is by example what has been done in
>> this project of camel --> org.apache.camel.component.paxlogging ?
>
> Yes, the same way as for paxlogging camel component.
>
>> Question:  Is there a way to check that pax-web has well registered the
>> servlet defined in the web.xml file and deployed as a jar in hot deploy
>> directory ?
>
> If we were to rely on the osgi http service instead of pax-web, it
> would be a bit more portable.
> Just adding an osgi activator to camel-servlet would work fine for
> that imho, as the activator could register both the servlet in the
> osgi http service and the component resolver.
>
> Btw, this discussion is much more related to camel than karaf ;-)
>
>> On 03/01/11 17:33, Guillaume Nodet wrote:
>>>
>>> I think it should work, it may be a class loader issue.
>>> I think you have two solutions overall:
>>>   * either you create you own jetty server using camel-jetty and you
>>> set up the jetty server yourself
>>>   * you can use a wab packaging
>>>   * or you want to reuse the osgi http service and you need to set up
>>> a servlet and configure the security on the servlet
>>> For the later, the packaging does not have to be a war, but if you
>>> don't use a war, you'll have to write the code that will do the
>>> security and will register the servlet in the osgi http service.
>>> I think the easiest is using a wab, you just need to make sure you
>>> don't include the camel-servlet component or any camel jar into the
>>> war.
>>> Actually, if should start with an exploded war and a simple web.xml to
>>> make sure you don't include any code in the war itself.  I guess the
>>> trick is to expose the component so that other camel will find it.  It
>>> can be done by registering a ComponentResolver with a property
>>> (component=servlet) that would always register the same servlet
>>> component instance.
>>>
>>> On Mon, Jan 3, 2011 at 17:01, Charles Moulliard<cm...@gmail.com>
>>>  wrote:
>>>>
>>>> I don't think that packaging camel-servlet in a war will work. Even if
>>>> we create a jar (=WAB, WAB) containing a web.xml with description of
>>>> servlet
>>>>
>>>>    <servlet>
>>>>        <servlet-name>CamelServlet</servlet-name>
>>>>        <display-name>Camel Http Transport Servlet</display-name>
>>>>        <servlet-class>
>>>>            org.apache.camel.component.servlet.CamelHttpTransportServlet
>>>>        </servlet-class>
>>>>        <init-param>
>>>>          <param-name>matchOnUriPrefix</param-name>
>>>>          <param-value>true</param-value>
>>>>        </init-param>
>>>>        <load-on-startup>1</load-on-startup>
>>>>
>>>>    </servlet>
>>>>
>>>> Caused by: java.lang.IllegalArgumentException: Cannot find the
>>>> deployed servlet, please configure the ServletComponent or configure a
>>>> org.apache.camel.component.servlet.CamelHttpTransportServlet servlet
>>>> in web.xml
>>>>        at
>>>> org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
>>>>        at
>>>> org.apache.camel.component.servlet.ServletComponent.connect(ServletComponent.java:109)
>>>>        at
>>>> org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:148)
>>>>        at
>>>> org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:52)
>>>>        at
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>>>>        at
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>>>>        at
>>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1484)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1750)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1703)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1629)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1419)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1314)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1213)
>>>>        at
>>>> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)
>>>>        at
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>>>>        at
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1191)
>>>>        at
>>>> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)
>>>>        at
>>>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
>>>>
>>>>
>>>> it will not be possible for camel to find the CamelHttpServlet
>>>>
>>>> Regards,
>>>>
>>>> Charles Moulliard
>>>>
>>>> Sr. Principal Solution Architect - FuseSource
>>>> Apache Committer
>>>>
>>>> Blog : http://cmoulliard.blogspot.com
>>>> Twitter : http://twitter.com/cmoulliard
>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>>> Skype: cmoulliard
>>>>
>>>>
>>>>
>>>> On Mon, Dec 20, 2010 at 3:06 PM, Achim Nierbeck<bc...@googlemail.com>
>>>>  wrote:
>>>>>
>>>>> Just one more comment from me, a OSGi-War (aka wab) can also be used :)
>>>>> Totally forgot to mention that when Charles asked me directly, and I
>>>>> didn't
>>>>> have a real good answer ;)
>>>>>
>>>>> 2010/12/20 Guillaume Nodet<gn...@gmail.com>
>>>>>
>>>>>> On Mon, Dec 20, 2010 at 14:42, Charles Moulliard<cm...@gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I would like to start a discussion around the following point as it
>>>>>>> does
>>>>>>
>>>>>> not
>>>>>>>
>>>>>>> seem obvious to find an answer. To authenticate a HTTP user with camel
>>>>>>> on
>>>>>>> Karaf we can use the component camel-jetty and camel-servlet. Jetty +
>>>>>>
>>>>>> JAAS +
>>>>>>>
>>>>>>> camel can be easily configured using Spring beans + securityHandler
>>>>>>> with
>>>>>>> camel but this does not seem the case with camel-servlet.
>>>>>>>
>>>>>>> The component camel-servlet does not accept as parameter a handler(s)
>>>>>>> for
>>>>>>> Jetty. This is normal as camel can be deployed in different
>>>>>>> Application
>>>>>>> Servers which are not build with Jetty. So what alternative(s) exist
>>>>>>> to
>>>>>>> configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml
>>>>>>> (in
>>>>>>
>>>>>> etc
>>>>>>>
>>>>>>> folder) but how to link camel servlet with jetty security handler ?
>>>>>>>
>>>>>> Unless I'm wrong, when you use camel-servlet, you're responsible for
>>>>>> setting up the CamelHttpTransportServlet servlet.
>>>>>> In OSGi, it could be done either using a standard web application
>>>>>> (deployed using the war support), or directly using the OSGi HTTP
>>>>>> service.  In the former case, you'd have to configure the web.xml for
>>>>>> security.  In the latter case, you need to use the OSGi HTTP service
>>>>>> api to properly configure the security bits (by implementing
>>>>>> org.osgi.service.http.HttpContext interface).
>>>>>>
>>>>>> I agree we could have an example of showing the last way in camel .
>>>>>> Configuring the war for security isn't specific to OSGi or Camel fwiw.
>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Charles
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Cheers,
>>>>>> Guillaume Nodet
>>>>>> ------------------------
>>>>>> Blog: http://gnodet.blogspot.com/
>>>>>> ------------------------
>>>>>> Open Source SOA
>>>>>> http://fusesource.com
>>>>>>
>>>
>>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Jetty + security + camel servlet

Posted by Guillaume Nodet <gn...@gmail.com>.
On Mon, Jan 3, 2011 at 17:55, Charles Moulliard <cm...@gmail.com> wrote:
> What you suggest (component=servlet) is by example what has been done in
> this project of camel --> org.apache.camel.component.paxlogging ?

Yes, the same way as for paxlogging camel component.

> Question:  Is there a way to check that pax-web has well registered the
> servlet defined in the web.xml file and deployed as a jar in hot deploy
> directory ?

If we were to rely on the osgi http service instead of pax-web, it
would be a bit more portable.
Just adding an osgi activator to camel-servlet would work fine for
that imho, as the activator could register both the servlet in the
osgi http service and the component resolver.

Btw, this discussion is much more related to camel than karaf ;-)

> On 03/01/11 17:33, Guillaume Nodet wrote:
>>
>> I think it should work, it may be a class loader issue.
>> I think you have two solutions overall:
>>   * either you create you own jetty server using camel-jetty and you
>> set up the jetty server yourself
>>   * you can use a wab packaging
>>   * or you want to reuse the osgi http service and you need to set up
>> a servlet and configure the security on the servlet
>> For the later, the packaging does not have to be a war, but if you
>> don't use a war, you'll have to write the code that will do the
>> security and will register the servlet in the osgi http service.
>> I think the easiest is using a wab, you just need to make sure you
>> don't include the camel-servlet component or any camel jar into the
>> war.
>> Actually, if should start with an exploded war and a simple web.xml to
>> make sure you don't include any code in the war itself.  I guess the
>> trick is to expose the component so that other camel will find it.  It
>> can be done by registering a ComponentResolver with a property
>> (component=servlet) that would always register the same servlet
>> component instance.
>>
>> On Mon, Jan 3, 2011 at 17:01, Charles Moulliard<cm...@gmail.com>
>>  wrote:
>>>
>>> I don't think that packaging camel-servlet in a war will work. Even if
>>> we create a jar (=WAB, WAB) containing a web.xml with description of
>>> servlet
>>>
>>>    <servlet>
>>>        <servlet-name>CamelServlet</servlet-name>
>>>        <display-name>Camel Http Transport Servlet</display-name>
>>>        <servlet-class>
>>>            org.apache.camel.component.servlet.CamelHttpTransportServlet
>>>        </servlet-class>
>>>        <init-param>
>>>          <param-name>matchOnUriPrefix</param-name>
>>>          <param-value>true</param-value>
>>>        </init-param>
>>>        <load-on-startup>1</load-on-startup>
>>>
>>>    </servlet>
>>>
>>> Caused by: java.lang.IllegalArgumentException: Cannot find the
>>> deployed servlet, please configure the ServletComponent or configure a
>>> org.apache.camel.component.servlet.CamelHttpTransportServlet servlet
>>> in web.xml
>>>        at
>>> org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
>>>        at
>>> org.apache.camel.component.servlet.ServletComponent.connect(ServletComponent.java:109)
>>>        at
>>> org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:148)
>>>        at
>>> org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:52)
>>>        at
>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>>>        at
>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>>>        at
>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
>>>        at
>>> org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1484)
>>>        at
>>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1750)
>>>        at
>>> org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1703)
>>>        at
>>> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1629)
>>>        at
>>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1419)
>>>        at
>>> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1314)
>>>        at
>>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1213)
>>>        at
>>> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)
>>>        at
>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>>>        at
>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>>>        at
>>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1191)
>>>        at
>>> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)
>>>        at
>>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
>>>
>>>
>>> it will not be possible for camel to find the CamelHttpServlet
>>>
>>> Regards,
>>>
>>> Charles Moulliard
>>>
>>> Sr. Principal Solution Architect - FuseSource
>>> Apache Committer
>>>
>>> Blog : http://cmoulliard.blogspot.com
>>> Twitter : http://twitter.com/cmoulliard
>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>> Skype: cmoulliard
>>>
>>>
>>>
>>> On Mon, Dec 20, 2010 at 3:06 PM, Achim Nierbeck<bc...@googlemail.com>
>>>  wrote:
>>>>
>>>> Just one more comment from me, a OSGi-War (aka wab) can also be used :)
>>>> Totally forgot to mention that when Charles asked me directly, and I
>>>> didn't
>>>> have a real good answer ;)
>>>>
>>>> 2010/12/20 Guillaume Nodet<gn...@gmail.com>
>>>>
>>>>> On Mon, Dec 20, 2010 at 14:42, Charles Moulliard<cm...@gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I would like to start a discussion around the following point as it
>>>>>> does
>>>>>
>>>>> not
>>>>>>
>>>>>> seem obvious to find an answer. To authenticate a HTTP user with camel
>>>>>> on
>>>>>> Karaf we can use the component camel-jetty and camel-servlet. Jetty +
>>>>>
>>>>> JAAS +
>>>>>>
>>>>>> camel can be easily configured using Spring beans + securityHandler
>>>>>> with
>>>>>> camel but this does not seem the case with camel-servlet.
>>>>>>
>>>>>> The component camel-servlet does not accept as parameter a handler(s)
>>>>>> for
>>>>>> Jetty. This is normal as camel can be deployed in different
>>>>>> Application
>>>>>> Servers which are not build with Jetty. So what alternative(s) exist
>>>>>> to
>>>>>> configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml
>>>>>> (in
>>>>>
>>>>> etc
>>>>>>
>>>>>> folder) but how to link camel servlet with jetty security handler ?
>>>>>>
>>>>> Unless I'm wrong, when you use camel-servlet, you're responsible for
>>>>> setting up the CamelHttpTransportServlet servlet.
>>>>> In OSGi, it could be done either using a standard web application
>>>>> (deployed using the war support), or directly using the OSGi HTTP
>>>>> service.  In the former case, you'd have to configure the web.xml for
>>>>> security.  In the latter case, you need to use the OSGi HTTP service
>>>>> api to properly configure the security bits (by implementing
>>>>> org.osgi.service.http.HttpContext interface).
>>>>>
>>>>> I agree we could have an example of showing the last way in camel .
>>>>> Configuring the war for security isn't specific to OSGi or Camel fwiw.
>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Charles
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Cheers,
>>>>> Guillaume Nodet
>>>>> ------------------------
>>>>> Blog: http://gnodet.blogspot.com/
>>>>> ------------------------
>>>>> Open Source SOA
>>>>> http://fusesource.com
>>>>>
>>
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Jetty + security + camel servlet

Posted by Achim Nierbeck <bc...@googlemail.com>.
In the curent trunk version of Karaf you need to install the eventadmin
feature and the webconsole feature.
After that you can see which Servlets under which webapp context have
been registered.
Oh by the way I forgot you don't really need the eventadmin you can
already see the servlets registered in the services section
of the webconsole.

Cheers, Achim

btw. happy new year to all of you :)

Am 03.01.2011 17:55, schrieb Charles Moulliard:
> What you suggest (component=servlet) is by example what has been done
> in this project of camel --> org.apache.camel.component.paxlogging ?
>
> Question:  Is there a way to check that pax-web has well registered
> the servlet defined in the web.xml file and deployed as a jar in hot
> deploy directory ?
>
> On 03/01/11 17:33, Guillaume Nodet wrote:
>> I think it should work, it may be a class loader issue.
>> I think you have two solutions overall:
>>    * either you create you own jetty server using camel-jetty and you
>> set up the jetty server yourself
>>    * you can use a wab packaging
>>    * or you want to reuse the osgi http service and you need to set up
>> a servlet and configure the security on the servlet
>> For the later, the packaging does not have to be a war, but if you
>> don't use a war, you'll have to write the code that will do the
>> security and will register the servlet in the osgi http service.
>> I think the easiest is using a wab, you just need to make sure you
>> don't include the camel-servlet component or any camel jar into the
>> war.
>> Actually, if should start with an exploded war and a simple web.xml to
>> make sure you don't include any code in the war itself.  I guess the
>> trick is to expose the component so that other camel will find it.  It
>> can be done by registering a ComponentResolver with a property
>> (component=servlet) that would always register the same servlet
>> component instance.
>>
>> On Mon, Jan 3, 2011 at 17:01, Charles
>> Moulliard<cm...@gmail.com>  wrote:
>>> I don't think that packaging camel-servlet in a war will work. Even if
>>> we create a jar (=WAB, WAB) containing a web.xml with description of
>>> servlet
>>>
>>>     <servlet>
>>>         <servlet-name>CamelServlet</servlet-name>
>>>         <display-name>Camel Http Transport Servlet</display-name>
>>>         <servlet-class>
>>>            
>>> org.apache.camel.component.servlet.CamelHttpTransportServlet
>>>         </servlet-class>
>>>         <init-param>
>>>           <param-name>matchOnUriPrefix</param-name>
>>>           <param-value>true</param-value>
>>>         </init-param>
>>>         <load-on-startup>1</load-on-startup>
>>>
>>>     </servlet>
>>>
>>> Caused by: java.lang.IllegalArgumentException: Cannot find the
>>> deployed servlet, please configure the ServletComponent or configure a
>>> org.apache.camel.component.servlet.CamelHttpTransportServlet servlet
>>> in web.xml
>>>         at
>>> org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
>>>         at
>>> org.apache.camel.component.servlet.ServletComponent.connect(ServletComponent.java:109)
>>>         at
>>> org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:148)
>>>         at
>>> org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:52)
>>>         at
>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>>>         at
>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>>>         at
>>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
>>>         at
>>> org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1484)
>>>         at
>>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1750)
>>>         at
>>> org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1703)
>>>         at
>>> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1629)
>>>         at
>>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1419)
>>>         at
>>> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1314)
>>>         at
>>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1213)
>>>         at
>>> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)
>>>         at
>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>>>         at
>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>>>         at
>>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1191)
>>>         at
>>> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)
>>>         at
>>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
>>>
>>>
>>> it will not be possible for camel to find the CamelHttpServlet
>>>
>>> Regards,
>>>
>>> Charles Moulliard
>>>
>>> Sr. Principal Solution Architect - FuseSource
>>> Apache Committer
>>>
>>> Blog : http://cmoulliard.blogspot.com
>>> Twitter : http://twitter.com/cmoulliard
>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>> Skype: cmoulliard
>>>
>>>
>>>
>>> On Mon, Dec 20, 2010 at 3:06 PM, Achim
>>> Nierbeck<bc...@googlemail.com>  wrote:
>>>> Just one more comment from me, a OSGi-War (aka wab) can also be
>>>> used :)
>>>> Totally forgot to mention that when Charles asked me directly, and
>>>> I didn't
>>>> have a real good answer ;)
>>>>
>>>> 2010/12/20 Guillaume Nodet<gn...@gmail.com>
>>>>
>>>>> On Mon, Dec 20, 2010 at 14:42, Charles
>>>>> Moulliard<cm...@gmail.com>
>>>>> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I would like to start a discussion around the following point as
>>>>>> it does
>>>>> not
>>>>>> seem obvious to find an answer. To authenticate a HTTP user with
>>>>>> camel on
>>>>>> Karaf we can use the component camel-jetty and camel-servlet.
>>>>>> Jetty +
>>>>> JAAS +
>>>>>> camel can be easily configured using Spring beans +
>>>>>> securityHandler with
>>>>>> camel but this does not seem the case with camel-servlet.
>>>>>>
>>>>>> The component camel-servlet does not accept as parameter a
>>>>>> handler(s) for
>>>>>> Jetty. This is normal as camel can be deployed in different
>>>>>> Application
>>>>>> Servers which are not build with Jetty. So what alternative(s)
>>>>>> exist to
>>>>>> configure camel-servlet with Jetty + JAAS on Karaf ? Using
>>>>>> jetty.xml (in
>>>>> etc
>>>>>> folder) but how to link camel servlet with jetty security handler ?
>>>>>>
>>>>> Unless I'm wrong, when you use camel-servlet, you're responsible for
>>>>> setting up the CamelHttpTransportServlet servlet.
>>>>> In OSGi, it could be done either using a standard web application
>>>>> (deployed using the war support), or directly using the OSGi HTTP
>>>>> service.  In the former case, you'd have to configure the web.xml for
>>>>> security.  In the latter case, you need to use the OSGi HTTP service
>>>>> api to properly configure the security bits (by implementing
>>>>> org.osgi.service.http.HttpContext interface).
>>>>>
>>>>> I agree we could have an example of showing the last way in camel .
>>>>> Configuring the war for security isn't specific to OSGi or Camel
>>>>> fwiw.
>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Charles
>>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Cheers,
>>>>> Guillaume Nodet
>>>>> ------------------------
>>>>> Blog: http://gnodet.blogspot.com/
>>>>> ------------------------
>>>>> Open Source SOA
>>>>> http://fusesource.com
>>>>>
>>
>>


Re: Jetty + security + camel servlet

Posted by Charles Moulliard <cm...@gmail.com>.
What you suggest (component=servlet) is by example what has been done in 
this project of camel --> org.apache.camel.component.paxlogging ?

Question:  Is there a way to check that pax-web has well registered the 
servlet defined in the web.xml file and deployed as a jar in hot deploy 
directory ?

On 03/01/11 17:33, Guillaume Nodet wrote:
> I think it should work, it may be a class loader issue.
> I think you have two solutions overall:
>    * either you create you own jetty server using camel-jetty and you
> set up the jetty server yourself
>    * you can use a wab packaging
>    * or you want to reuse the osgi http service and you need to set up
> a servlet and configure the security on the servlet
> For the later, the packaging does not have to be a war, but if you
> don't use a war, you'll have to write the code that will do the
> security and will register the servlet in the osgi http service.
> I think the easiest is using a wab, you just need to make sure you
> don't include the camel-servlet component or any camel jar into the
> war.
> Actually, if should start with an exploded war and a simple web.xml to
> make sure you don't include any code in the war itself.  I guess the
> trick is to expose the component so that other camel will find it.  It
> can be done by registering a ComponentResolver with a property
> (component=servlet) that would always register the same servlet
> component instance.
>
> On Mon, Jan 3, 2011 at 17:01, Charles Moulliard<cm...@gmail.com>  wrote:
>> I don't think that packaging camel-servlet in a war will work. Even if
>> we create a jar (=WAB, WAB) containing a web.xml with description of
>> servlet
>>
>>     <servlet>
>>         <servlet-name>CamelServlet</servlet-name>
>>         <display-name>Camel Http Transport Servlet</display-name>
>>         <servlet-class>
>>             org.apache.camel.component.servlet.CamelHttpTransportServlet
>>         </servlet-class>
>>         <init-param>
>>           <param-name>matchOnUriPrefix</param-name>
>>           <param-value>true</param-value>
>>         </init-param>
>>         <load-on-startup>1</load-on-startup>
>>
>>     </servlet>
>>
>> Caused by: java.lang.IllegalArgumentException: Cannot find the
>> deployed servlet, please configure the ServletComponent or configure a
>> org.apache.camel.component.servlet.CamelHttpTransportServlet servlet
>> in web.xml
>>         at org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
>>         at org.apache.camel.component.servlet.ServletComponent.connect(ServletComponent.java:109)
>>         at org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:148)
>>         at org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:52)
>>         at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>>         at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>>         at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
>>         at org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1484)
>>         at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1750)
>>         at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1703)
>>         at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1629)
>>         at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1419)
>>         at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1314)
>>         at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1213)
>>         at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)
>>         at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>>         at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>>         at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1191)
>>         at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)
>>         at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
>>
>>
>> it will not be possible for camel to find the CamelHttpServlet
>>
>> Regards,
>>
>> Charles Moulliard
>>
>> Sr. Principal Solution Architect - FuseSource
>> Apache Committer
>>
>> Blog : http://cmoulliard.blogspot.com
>> Twitter : http://twitter.com/cmoulliard
>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>> Skype: cmoulliard
>>
>>
>>
>> On Mon, Dec 20, 2010 at 3:06 PM, Achim Nierbeck<bc...@googlemail.com>  wrote:
>>> Just one more comment from me, a OSGi-War (aka wab) can also be used :)
>>> Totally forgot to mention that when Charles asked me directly, and I didn't
>>> have a real good answer ;)
>>>
>>> 2010/12/20 Guillaume Nodet<gn...@gmail.com>
>>>
>>>> On Mon, Dec 20, 2010 at 14:42, Charles Moulliard<cm...@gmail.com>
>>>> wrote:
>>>>> Hi,
>>>>>
>>>>> I would like to start a discussion around the following point as it does
>>>> not
>>>>> seem obvious to find an answer. To authenticate a HTTP user with camel on
>>>>> Karaf we can use the component camel-jetty and camel-servlet. Jetty +
>>>> JAAS +
>>>>> camel can be easily configured using Spring beans + securityHandler with
>>>>> camel but this does not seem the case with camel-servlet.
>>>>>
>>>>> The component camel-servlet does not accept as parameter a handler(s) for
>>>>> Jetty. This is normal as camel can be deployed in different Application
>>>>> Servers which are not build with Jetty. So what alternative(s) exist to
>>>>> configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml (in
>>>> etc
>>>>> folder) but how to link camel servlet with jetty security handler ?
>>>>>
>>>> Unless I'm wrong, when you use camel-servlet, you're responsible for
>>>> setting up the CamelHttpTransportServlet servlet.
>>>> In OSGi, it could be done either using a standard web application
>>>> (deployed using the war support), or directly using the OSGi HTTP
>>>> service.  In the former case, you'd have to configure the web.xml for
>>>> security.  In the latter case, you need to use the OSGi HTTP service
>>>> api to properly configure the security bits (by implementing
>>>> org.osgi.service.http.HttpContext interface).
>>>>
>>>> I agree we could have an example of showing the last way in camel .
>>>> Configuring the war for security isn't specific to OSGi or Camel fwiw.
>>>>
>>>>> Regards,
>>>>>
>>>>> Charles
>>>>>
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>> Guillaume Nodet
>>>> ------------------------
>>>> Blog: http://gnodet.blogspot.com/
>>>> ------------------------
>>>> Open Source SOA
>>>> http://fusesource.com
>>>>
>
>

Re: Jetty + security + camel servlet

Posted by Guillaume Nodet <gn...@gmail.com>.
I think it should work, it may be a class loader issue.
I think you have two solutions overall:
  * either you create you own jetty server using camel-jetty and you
set up the jetty server yourself
  * you can use a wab packaging
  * or you want to reuse the osgi http service and you need to set up
a servlet and configure the security on the servlet
For the later, the packaging does not have to be a war, but if you
don't use a war, you'll have to write the code that will do the
security and will register the servlet in the osgi http service.
I think the easiest is using a wab, you just need to make sure you
don't include the camel-servlet component or any camel jar into the
war.
Actually, if should start with an exploded war and a simple web.xml to
make sure you don't include any code in the war itself.  I guess the
trick is to expose the component so that other camel will find it.  It
can be done by registering a ComponentResolver with a property
(component=servlet) that would always register the same servlet
component instance.

On Mon, Jan 3, 2011 at 17:01, Charles Moulliard <cm...@gmail.com> wrote:
> I don't think that packaging camel-servlet in a war will work. Even if
> we create a jar (=WAB, WAB) containing a web.xml with description of
> servlet
>
>    <servlet>
>        <servlet-name>CamelServlet</servlet-name>
>        <display-name>Camel Http Transport Servlet</display-name>
>        <servlet-class>
>            org.apache.camel.component.servlet.CamelHttpTransportServlet
>        </servlet-class>
>        <init-param>
>          <param-name>matchOnUriPrefix</param-name>
>          <param-value>true</param-value>
>        </init-param>
>        <load-on-startup>1</load-on-startup>
>
>    </servlet>
>
> Caused by: java.lang.IllegalArgumentException: Cannot find the
> deployed servlet, please configure the ServletComponent or configure a
> org.apache.camel.component.servlet.CamelHttpTransportServlet servlet
> in web.xml
>        at org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
>        at org.apache.camel.component.servlet.ServletComponent.connect(ServletComponent.java:109)
>        at org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:148)
>        at org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:52)
>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>        at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
>        at org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1484)
>        at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1750)
>        at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1703)
>        at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1629)
>        at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1419)
>        at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1314)
>        at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1213)
>        at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)
>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
>        at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1191)
>        at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)
>        at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
>
>
> it will not be possible for camel to find the CamelHttpServlet
>
> Regards,
>
> Charles Moulliard
>
> Sr. Principal Solution Architect - FuseSource
> Apache Committer
>
> Blog : http://cmoulliard.blogspot.com
> Twitter : http://twitter.com/cmoulliard
> Linkedin : http://www.linkedin.com/in/charlesmoulliard
> Skype: cmoulliard
>
>
>
> On Mon, Dec 20, 2010 at 3:06 PM, Achim Nierbeck <bc...@googlemail.com> wrote:
>> Just one more comment from me, a OSGi-War (aka wab) can also be used :)
>> Totally forgot to mention that when Charles asked me directly, and I didn't
>> have a real good answer ;)
>>
>> 2010/12/20 Guillaume Nodet <gn...@gmail.com>
>>
>>> On Mon, Dec 20, 2010 at 14:42, Charles Moulliard <cm...@gmail.com>
>>> wrote:
>>> > Hi,
>>> >
>>> > I would like to start a discussion around the following point as it does
>>> not
>>> > seem obvious to find an answer. To authenticate a HTTP user with camel on
>>> > Karaf we can use the component camel-jetty and camel-servlet. Jetty +
>>> JAAS +
>>> > camel can be easily configured using Spring beans + securityHandler with
>>> > camel but this does not seem the case with camel-servlet.
>>> >
>>> > The component camel-servlet does not accept as parameter a handler(s) for
>>> > Jetty. This is normal as camel can be deployed in different Application
>>> > Servers which are not build with Jetty. So what alternative(s) exist to
>>> > configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml (in
>>> etc
>>> > folder) but how to link camel servlet with jetty security handler ?
>>> >
>>>
>>> Unless I'm wrong, when you use camel-servlet, you're responsible for
>>> setting up the CamelHttpTransportServlet servlet.
>>> In OSGi, it could be done either using a standard web application
>>> (deployed using the war support), or directly using the OSGi HTTP
>>> service.  In the former case, you'd have to configure the web.xml for
>>> security.  In the latter case, you need to use the OSGi HTTP service
>>> api to properly configure the security bits (by implementing
>>> org.osgi.service.http.HttpContext interface).
>>>
>>> I agree we could have an example of showing the last way in camel .
>>> Configuring the war for security isn't specific to OSGi or Camel fwiw.
>>>
>>> > Regards,
>>> >
>>> > Charles
>>> >
>>>
>>>
>>>
>>> --
>>> Cheers,
>>> Guillaume Nodet
>>> ------------------------
>>> Blog: http://gnodet.blogspot.com/
>>> ------------------------
>>> Open Source SOA
>>> http://fusesource.com
>>>
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Jetty + security + camel servlet

Posted by Charles Moulliard <cm...@gmail.com>.
I don't think that packaging camel-servlet in a war will work. Even if
we create a jar (=WAB, WAB) containing a web.xml with description of
servlet

    <servlet>
        <servlet-name>CamelServlet</servlet-name>
        <display-name>Camel Http Transport Servlet</display-name>
        <servlet-class>
            org.apache.camel.component.servlet.CamelHttpTransportServlet
        </servlet-class>
        <init-param>
          <param-name>matchOnUriPrefix</param-name>
          <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>

    </servlet>

Caused by: java.lang.IllegalArgumentException: Cannot find the
deployed servlet, please configure the ServletComponent or configure a
org.apache.camel.component.servlet.CamelHttpTransportServlet servlet
in web.xml
	at org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
	at org.apache.camel.component.servlet.ServletComponent.connect(ServletComponent.java:109)
	at org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:148)
	at org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:52)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
	at org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1484)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1750)
	at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1703)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1629)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1419)
	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1314)
	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1213)
	at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1191)
	at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)
	at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)


it will not be possible for camel to find the CamelHttpServlet

Regards,

Charles Moulliard

Sr. Principal Solution Architect - FuseSource
Apache Committer

Blog : http://cmoulliard.blogspot.com
Twitter : http://twitter.com/cmoulliard
Linkedin : http://www.linkedin.com/in/charlesmoulliard
Skype: cmoulliard



On Mon, Dec 20, 2010 at 3:06 PM, Achim Nierbeck <bc...@googlemail.com> wrote:
> Just one more comment from me, a OSGi-War (aka wab) can also be used :)
> Totally forgot to mention that when Charles asked me directly, and I didn't
> have a real good answer ;)
>
> 2010/12/20 Guillaume Nodet <gn...@gmail.com>
>
>> On Mon, Dec 20, 2010 at 14:42, Charles Moulliard <cm...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > I would like to start a discussion around the following point as it does
>> not
>> > seem obvious to find an answer. To authenticate a HTTP user with camel on
>> > Karaf we can use the component camel-jetty and camel-servlet. Jetty +
>> JAAS +
>> > camel can be easily configured using Spring beans + securityHandler with
>> > camel but this does not seem the case with camel-servlet.
>> >
>> > The component camel-servlet does not accept as parameter a handler(s) for
>> > Jetty. This is normal as camel can be deployed in different Application
>> > Servers which are not build with Jetty. So what alternative(s) exist to
>> > configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml (in
>> etc
>> > folder) but how to link camel servlet with jetty security handler ?
>> >
>>
>> Unless I'm wrong, when you use camel-servlet, you're responsible for
>> setting up the CamelHttpTransportServlet servlet.
>> In OSGi, it could be done either using a standard web application
>> (deployed using the war support), or directly using the OSGi HTTP
>> service.  In the former case, you'd have to configure the web.xml for
>> security.  In the latter case, you need to use the OSGi HTTP service
>> api to properly configure the security bits (by implementing
>> org.osgi.service.http.HttpContext interface).
>>
>> I agree we could have an example of showing the last way in camel .
>> Configuring the war for security isn't specific to OSGi or Camel fwiw.
>>
>> > Regards,
>> >
>> > Charles
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://fusesource.com
>>
>

Re: Jetty + security + camel servlet

Posted by Guillaume Nodet <gn...@gmail.com>.
Yes, but I was including that in the war option, as both would use the
exact same configuration (the only difference is the availability of
the osgi metadata or not).

On Mon, Dec 20, 2010 at 15:06, Achim Nierbeck <bc...@googlemail.com> wrote:
> Just one more comment from me, a OSGi-War (aka wab) can also be used :)
> Totally forgot to mention that when Charles asked me directly, and I didn't
> have a real good answer ;)
>
> 2010/12/20 Guillaume Nodet <gn...@gmail.com>
>
>> On Mon, Dec 20, 2010 at 14:42, Charles Moulliard <cm...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > I would like to start a discussion around the following point as it does
>> not
>> > seem obvious to find an answer. To authenticate a HTTP user with camel on
>> > Karaf we can use the component camel-jetty and camel-servlet. Jetty +
>> JAAS +
>> > camel can be easily configured using Spring beans + securityHandler with
>> > camel but this does not seem the case with camel-servlet.
>> >
>> > The component camel-servlet does not accept as parameter a handler(s) for
>> > Jetty. This is normal as camel can be deployed in different Application
>> > Servers which are not build with Jetty. So what alternative(s) exist to
>> > configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml (in
>> etc
>> > folder) but how to link camel servlet with jetty security handler ?
>> >
>>
>> Unless I'm wrong, when you use camel-servlet, you're responsible for
>> setting up the CamelHttpTransportServlet servlet.
>> In OSGi, it could be done either using a standard web application
>> (deployed using the war support), or directly using the OSGi HTTP
>> service.  In the former case, you'd have to configure the web.xml for
>> security.  In the latter case, you need to use the OSGi HTTP service
>> api to properly configure the security bits (by implementing
>> org.osgi.service.http.HttpContext interface).
>>
>> I agree we could have an example of showing the last way in camel .
>> Configuring the war for security isn't specific to OSGi or Camel fwiw.
>>
>> > Regards,
>> >
>> > Charles
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://fusesource.com
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Jetty + security + camel servlet

Posted by Achim Nierbeck <bc...@googlemail.com>.
Just one more comment from me, a OSGi-War (aka wab) can also be used :)
Totally forgot to mention that when Charles asked me directly, and I didn't
have a real good answer ;)

2010/12/20 Guillaume Nodet <gn...@gmail.com>

> On Mon, Dec 20, 2010 at 14:42, Charles Moulliard <cm...@gmail.com>
> wrote:
> > Hi,
> >
> > I would like to start a discussion around the following point as it does
> not
> > seem obvious to find an answer. To authenticate a HTTP user with camel on
> > Karaf we can use the component camel-jetty and camel-servlet. Jetty +
> JAAS +
> > camel can be easily configured using Spring beans + securityHandler with
> > camel but this does not seem the case with camel-servlet.
> >
> > The component camel-servlet does not accept as parameter a handler(s) for
> > Jetty. This is normal as camel can be deployed in different Application
> > Servers which are not build with Jetty. So what alternative(s) exist to
> > configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml (in
> etc
> > folder) but how to link camel servlet with jetty security handler ?
> >
>
> Unless I'm wrong, when you use camel-servlet, you're responsible for
> setting up the CamelHttpTransportServlet servlet.
> In OSGi, it could be done either using a standard web application
> (deployed using the war support), or directly using the OSGi HTTP
> service.  In the former case, you'd have to configure the web.xml for
> security.  In the latter case, you need to use the OSGi HTTP service
> api to properly configure the security bits (by implementing
> org.osgi.service.http.HttpContext interface).
>
> I agree we could have an example of showing the last way in camel .
> Configuring the war for security isn't specific to OSGi or Camel fwiw.
>
> > Regards,
> >
> > Charles
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://fusesource.com
>

Re: Jetty + security + camel servlet

Posted by Guillaume Nodet <gn...@gmail.com>.
On Mon, Dec 20, 2010 at 14:42, Charles Moulliard <cm...@gmail.com> wrote:
> Hi,
>
> I would like to start a discussion around the following point as it does not
> seem obvious to find an answer. To authenticate a HTTP user with camel on
> Karaf we can use the component camel-jetty and camel-servlet. Jetty + JAAS +
> camel can be easily configured using Spring beans + securityHandler with
> camel but this does not seem the case with camel-servlet.
>
> The component camel-servlet does not accept as parameter a handler(s) for
> Jetty. This is normal as camel can be deployed in different Application
> Servers which are not build with Jetty. So what alternative(s) exist to
> configure camel-servlet with Jetty + JAAS on Karaf ? Using jetty.xml (in etc
> folder) but how to link camel servlet with jetty security handler ?
>

Unless I'm wrong, when you use camel-servlet, you're responsible for
setting up the CamelHttpTransportServlet servlet.
In OSGi, it could be done either using a standard web application
(deployed using the war support), or directly using the OSGi HTTP
service.  In the former case, you'd have to configure the web.xml for
security.  In the latter case, you need to use the OSGi HTTP service
api to properly configure the security bits (by implementing
org.osgi.service.http.HttpContext interface).

I agree we could have an example of showing the last way in camel .
Configuring the war for security isn't specific to OSGi or Camel fwiw.

> Regards,
>
> Charles
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com