I want to create and deploy a web service to OSGi container. For example, publish the service to the address:
http://localhost:8080/testservice.
The service generate HTML response in a servlet.
I have searched a lot and got:
public class HelloWorldServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Hola</title>");
out.println("</head>");
out.println("<body bgcolor=\"white\">");
out.println("</body>");
out.println("</html>");
}
}
The tool I need to use:
maven to create the project
Fuse ESB karaf as OSGi container
The question is that I do not know how to use Maven to create and implement such web service, like:
how to specify
webapp/web.xml
how to specify
pom.xml
: dependencies, package type, pluginhow to register service: implement
BundlActivator
or configure Spring xml file
Can anyone help me with this? Is there a detailed tutorial for newbie?