Hi, of course, take a look at those various samples in the link I gave you. The helloworld-serlet3 has only been one, as example. You can do anything you like, though referencing OSGi services is a bit more trickier.
regards, Achim 2016-03-29 17:32 GMT+02:00 Alioune <baliou...@gmail.com>: > Hi all, > Thanks Achim for your links. > > I've successfully tested Servlet 3 annotation but I prefere using Servlet > by defining config in web.xml because I would like to use shiro filter for > my servlet and I should be more complicated without web.xml. > > Is there a solution to configure PAX or KARAFusing web.xml for servlets ? > Regards, > > > > On 23 March 2016 at 20:42, Achim Nierbeck <bcanh...@googlemail.com> wrote: > >> This completely depends on your use-case and what you are trying to >> achieve. >> If you just want to have a Servlet running, with Servlet 3 annotations. >> Follow the sample in [1]. >> Or take a look at the samples of the Apache Karaf Cookbook [2]. >> >> regards, Achim >> >> >> [1] - >> https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples/helloworld-servlet3 >> [2] - >> https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter4/chapter4-recipe9/chapter4-recipe9-annotated >> >> 2016-03-23 19:31 GMT+01:00 Alioune <baliou...@gmail.com>: >> >>> Thank you four your responses guys. >>> >>> @Achim: It seems that using PAX Web is the easiest way. >>> So I would like to add a servlet in an existing maven projet. >>> >>> How may I start the servlet at runtime of my bundle using PAX Web >>> (without the Activator ? >>> >>> Regards >>> >>> >>> On 23 March 2016 at 16:05, Jean-Baptiste Onofré <j...@nanthrax.net> wrote: >>> >>>> Good point and kudo to Achim. >>>> >>>> I'm humbly apologize to the Pax Web master ;) >>>> >>>> Regards >>>> JB >>>> >>>> On 03/23/2016 04:02 PM, Achim Nierbeck wrote: >>>> >>>>> Hi, >>>>> >>>>> The only real source for samples are the PAX Web samples ;-) >>>>> You'll find a bunch of samples and how the integration tests work at: >>>>> >>>>> https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples >>>>> >>>>> And >>>>> >>>>> >>>>> org.ops4j.pax.web/tree/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty >>>>> >>>>> Regards, Achim >>>>> >>>>> sent from mobile device >>>>> >>>>> Am 23.03.2016 3:56 nachm. schrieb "Jean-Baptiste Onofré" >>>>> <j...@nanthrax.net <mailto:j...@nanthrax.net>>: >>>>> >>>>> Hi, >>>>> >>>>> yes, you can take a look on: >>>>> >>>>> >>>>> https://github.com/jbonofre/karaf-boot/tree/master/karaf-boot-samples/karaf-boot-sample-servlet >>>>> >>>>> Basically, the easiest way is to use the @WebServlet annotation, >>>>> and >>>>> install the http-whiteboard feature. >>>>> >>>>> The http-whiteboard feature will "listen" for servlet and expose in >>>>> the Karaf WebContainer. >>>>> >>>>> Regards >>>>> JB >>>>> >>>>> On 03/23/2016 03:47 PM, Alioune wrote: >>>>> >>>>> Hi All, >>>>> >>>>> I am trying to run a servlet in karaf contaire, I have >>>>> successfully done >>>>> that using ServiceTracker. >>>>> Now I would like to set a filter for the servlet, but I have >>>>> no idea >>>>> about doing that with ServiceTracker. >>>>> I have a few questions : >>>>> 1: are there others ways than ServiceTracker to run servlet in >>>>> karaf ? >>>>> 2: How may I create a filter for servlet running in karaf ? >>>>> 3: Is there a mean to use the default web.xml ? >>>>> >>>>> Regards, >>>>> >>>>> >>>>> -- >>>>> Jean-Baptiste Onofré >>>>> jbono...@apache.org <mailto:jbono...@apache.org> >>>>> http://blog.nanthrax.net >>>>> Talend - http://www.talend.com >>>>> >>>>> >>>> -- >>>> Jean-Baptiste Onofré >>>> jbono...@apache.org >>>> http://blog.nanthrax.net >>>> Talend - http://www.talend.com >>>> >>> >>> >> >> >> -- >> >> Apache Member >> Apache Karaf <http://karaf.apache.org/> Committer & PMC >> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer >> & Project Lead >> blog <http://notizblog.nierbeck.de/> >> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS> >> >> Software Architect / Project Manager / Scrum Master >> >> > -- Apache Member Apache Karaf <http://karaf.apache.org/> Committer & PMC OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead blog <http://notizblog.nierbeck.de/> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS> Software Architect / Project Manager / Scrum Master