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: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to