On 03.04.2009, at 04:17, Alin Dreghiciu wrote:

I can't help you to much as I'm not aware of iPOJO, but if those
servlets gets registered as services then you may also need to install
Pax Web Extender Whiteboard that will take any servlet registered as a
service and register it with Pax Web (or other http service).


Right. With "regular" HTTP service, you don't have to register the HTTPServlet service but, just depend on the HTTPService and call registerServlet. With pax:web, you just publish the servlet service, and pax:extender will manage the servlet. You have an example of iPOJO and pax:web available on http://code.google.com/p/modulefusion/wiki/iPOJOExampleApplications .

Regards,

Clement







Here is the link for it: http://wiki.ops4j.org/x/LAJN

On Fri, Apr 3, 2009 at 3:49 AM, Steve Lindsay
<[email protected]> wrote:
Hi,

Can anyone provide pointers on registering servlets in an iPOJO application?

I have used servlets with vanilla OSGi before, using the
registerServlet method of org.osgi.service.http.HttpService, however
I'm struggling to see how I can achieve the same thing using iPOJO
(without getting the bundle context and doing it manually, which is
what I'm trying to avoid by using iPOJO in the first place).

I found an example on the modulefusion (which incorporates iPOJO) wiki
(http://code.google.com/p/modulefusion/wiki/iPOJOExampleApplications)
that suggests the following:

@Component
@Provides
public class HelloWorldServlet extends HttpServlet {

   @ServiceProperty
   private String alias; // In the instance configuration
       protected void doGet(HttpServletRequest req,
HttpServletResponse resp) throws ServletException,
                       IOException {
               ServletOutputStream out = resp.getOutputStream();
               out.println("Hello World!");
               out.close();
       }

}

Should I expect this to work with a normal install of iPOJO on felix?

If it should work, what else do I need to do to get the servlet registered?

(I've tried the example above and can't get it to work, the bundle
starts but it doesn't register with the servlet container. I have Pax
Web running, and other servlets I've written that I manually register
via registerServlet are working. It's the link between the iPOJO
component and the registration with the servlet container I don't
understand. I'm sure it's something simple that I'm missing).

If this won't work, what strategies are people using to register
servlets in an iPOJO based applications?

Rgds....Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





--
Alin Dreghiciu
http://www.ops4j.org - New Energy for OSS Communities - Open
Participation Software.
http://www.qi4j.org - New Energy for Java - Domain Driven Development.
Looking for a job.
Sent from Cluj-Napoca, CJ, Romania

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to