Difference between servletcontainer.init(webconfig) vs servletcontainer.init() vs servletcontainer.init(filterconfig)

24 views Asked by At

Want to know the Difference between servletcontainer.init(webconfig) vs servletcontainer.init() vs servletcontainer.init(filterconfig) in prespective of pax web whiteboard in karaf OSGI

pls someone explain this.

2

There are 2 answers

0
Constantine Ch On

You can find more info and the way to configure the web container in the Apache Karaf Container 4.x - Documentation and also see this example: Apache Karaf Servlet examples

0
Grzegorz Grzybek On

servletcontainer may mean anything in your question.

Servlet API specification defines these init() methods:

  • javax.servlet.Servlet#init(javax.servlet.ServletConfig config)
  • javax.servlet.GenericServlet#init() (no arguments)
  • javax.servlet.Filter#init(javax.servlet.FilterConfig config)

So you should look for explanation directly in Servlet specification. (Mind that I link to javax version of the specification. Currently the specification moved to Jakarta Servlet).

Pax Web is an implementation of web-related specifications from OSGi CMPN R8 and the above methods are simply handled according to both Servlet API and OSGi CMPN (in that order).