O'Reilly logo

OSGi and Apache Felix 3.0 by Walid Joseph Gédéon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - implementing the operations

We won't go through the whole servlet implementation code. For that, I suggest you download the accompanying code for this chapter.

The servlet will provide HTTP GET operations by overriding doGet():

protected void doGet(
HttpServletRequest req, HttpServletResponse resp)
throws ServletException, java.io.IOException {

Retrieve the operation parameter and prepare the response content type:

String op = req.getParameter(PARAM_OP);
resp.setContentType("text/html");
this.logger.debug(
"op = " + op + ", session = " + this.sessionId);

Then check authentication-related operations. If the operation is a login request, then it is executed:

if (OP_LOGIN.equals(op)) { String user = req.getParameter(PARAM_USER); String ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required