I wanted to register servlets with WSO2 Greg(Governance Registry), but couldn’t do it with normal way. That is, registering the servlets in web.xml. In wso2 based products we can write our own OSGi bundles where for each feature we have to write a Front End(FE) and a Back End(BE) bundle. Basically the FE bundle will be for the user interface and the BE bundle will serve the requests from FE.
We can register our servlets via the FE bundle. In FE bundle you have to create a file “components.xml” under META-INF directory. In this file you can register you servlets as described below,
<component xmlns="http://products.wso2.org/carbon"> <servlets> <servlet id="HelloWorld"> <servlet-name>helloworldservlet</servlet-name> <url-pattern>/foo/helloWorld</url-pattern> <display-name>Hello World</display-name> <servlet-class>"your servlet class"</servlet-class> </servlet> </servlets> </component>