Quarkus + Undertow: Register a Servlet instance without the WebServlet annotation - servlets

I'm implementing a WebDAV servlet that I want to integrate in a Quarkus-based application, by using the quarkus-undertow extension.
I want to control the initialization of the startup, and injection with the CDI infrastructure in Quarkus would be nice. As I understand it, I can't use the #WebServlet annotation to bind the servlet to an URL mapping.
What is the proper way of initializing and adding custom servlets with quarkus-undertow?

Related

Spring MVC Template Location

Spring boot stores in template files in /src/main/resources
Where is this configured and how can I get Spring MVC to do this when not using Spring Boot?
In Spring Boot templating is usually configured via autoconfiguration, which takes information from application properties. For instance Thymeleaf template location can be configured like this:
spring.thymeleaf.prefix=classpath:/templates/ # Prefix that gets prepended to view names when building a URL.
See Spring Boot properties reference for more details.
Without using Spring Boot you can configure the same behavior by specifying custom ViewResolver bean and specifying prefix for templates. You can take a look at ThymeleafAutoConfiguration for inspiration.
Same principles apply to using other templating engines than Thymeleaf with Spring MVC.

servlet-listener and MIME type support for equinox

I have embedded equinox framework in tomcat 7.x using bridge.war and steps given at
http://www.eclipse.org/equinox/server/http_in_container.php
I have developed an osgi bundle which contains servlet registration code and as expected this servlet runs over the bridge.
My goal is to support servlet apis and web.xml functionality in this osgi bundle so that I can port an existing web application in osgi.
For now,I am using "org.eclipse.equinox.http.servlet.ExtendedHttpService" to register servlet filters and servlets.
However,ExtendedHttpService does not have a method to register a servlet-listener.
Can anyone suggest me how can I support/register servlet listeners and MIME types in an osgi bundle which contains my servlet registration code.

how jvm know the creation of servlet object

I have one webapplciation, i deployed it in server,server uses Jvm.
How jvm know the whether servelt object is created or not?
and one more thing In my web application having more than 5 servlet classes,then how jvm know which servlet instance created.
Servlets are declared in web.xml, when an application server which is in compliance with Servlet API start, it try to look for this file. In web.xml you have listed the servlet you want to load and the classes you should load in order to start servlets.
Servlets has their own lifecycle, if application server can not start a servlet, exception could be thrown then application server know that the servlet is no available.
Try to read more about servlets there many good tutorial over the net.

Spring handlerMapping vs struts ActionMapping

I come from a struts background and am trying to learn Spring MVC using my struts knowledge as a base. Here they explain handler mapping:
http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/portlet.html#portlet-handlermapping
Now in struts, we have an xml where we define action mappings which basically says which action url maps to which Controller. Is it fair to say that Handler Mapping in Spring is the same as the Action mapping in struts?
Hanler Mapping and ActionMapping take the same role in 2 MVC framworks. They navigate different URLs to the controller even the method. Just as an enthusiast of Spring MVC, it is more easier to use than Struts in your project. Spring fellow "convention over configuration" gives you a default Handler Mapping, so you don't need to specify it in the configuration, and it also provides #HandlerMapping and Handler Adapter to help you do the navigation.

Accessing other spring defined beans in the portlet spring application context (Spring Portlet MVC)

Context: Using maven 3,spring portlet mvc 3.1
Background:
I have built a portlet using spring portlet mvc 3.1.
This portlet uses the spring portlet mvc defined Dispatched and is defined accordingly in the -portlet.xml.
The dispatcher portlet is configured to pass requests to the myController (POJO with annotation of #Controller)
I also have a service project (jar) which defines a business service to be used by myController. This service has its own spring file and defines the bean 'myService'
I want to inject myService into myController using a predefined bean, so I have defined ContextLoaderListener in the web.xml of my portlet project
Problem:
I have tried both ways of trying to inject myService into myController i.e. using annotations and xml defined beans, but the portlet fails on deployment with an error that myService bean could not be found (or when using annotations no matching bean with class type found)
Note: I can see some logs on undeploy that the beans are available, but I think the issue is with PortletApplicationContext (as defined by -portlet.xml) is loading before the root Web ApplicationContext (as defined applicationContext through default usage in web.xml)
Note2: If I put the import for spring file defining 'myService' bean into the -portlet.xml, then it works.
Would appreciate any help in sorting this out.

Resources