Posts

Showing posts from November, 2013

How to make servlet using OSGi

hello everyone..
Here I'll tell you how to make  Servlet  using Osgi framework.
Steps:-
1. Make new plug-ins project give the name as SimpleServlet.
 Make sure to select Equinox as the target OSGI framework on the first page of the wizard. Also make sure you’ve got an activator (that option is on by default).
 In menifest Eddition -> Dependencies.
import these packages.

* javax.servlet


* javax.servlet.http


* org.osgi.framework


* org.osgi.service.http


* org.osgi.util.tracker

2.make a new class (SimpleServlet)


package simpleservlet;
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class SimpleServlet  extends HttpServlet{
    private static final long serialVersionUID = 1L;

      protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
        resp.setContentTy…