I wanted to create a servlet in liferay that is listening to a URL such as
http://localhost:8080/my-servlet
I tried to add it to a portlet but the I have the URL
http://localhost:8080/my-portlet/my-servlet
I tried to add my servlet description to the web.xml of ext-web, but no luck. Is there any way to add such a servlet ?
If you want to access Liferay service API, you may consider using PortalDelegateServlet : adding the following to your web.xml:
will make your servelt accessible through
http://example.org/delegate/myservlet
in your servlet class, you then do things like extract the logged-in user and check permissions:
Follow this sample to learn how to create a servlet path in a liferay plugin:
https://github.com/liferay/liferay-plugins/tree/master/hooks/sample-servlet-filter-hook
Liferay is also "Servlet"-Application - but a very-very big one. And Liferay need some servlet container like tomcat, jetty, jboss etc.
However, you can simple create servlet project and deploy it direct to servlet container where liferay is running.
edit: and put to web.xml by servlet-mapping a direct access like "/*".