Can we dispatch a request in Spring Web? - spring

I'm referring to this question.
It's about OncePerRequestFilter. The answer says it's used when
the request could be dispatched to a different (or the same) servlet using the request dispatcher.
But as far as I know there's only one servlet in Spring Web which is the DispatcherServlet. What am I missing here?

We can define multiple servlets in one spring web application.
DispatcherServlet is the default servlet of spring implements.
Here is a example. https://www.baeldung.com/spring-web-contexts#parent-context

Related

Dose Web Application Context and Servlet Application Context is same thing?

Dose Web Application Context and Servlet Application Context is same thing?
I think these are same but different name.
Am I right?
If you speak about Servlet Context and not spring-servlet:
They are different things.
Every Java web applications that use Servlet technology will have a servlet context, doesn't related to Spring.
Servlet-context started when a Servlet application is deployed. Servlet Context holds all the configurations.
On the other hand, ApplicationContext is a Spring tech; i.e., it's a container to hold Spring beans.
So, for your questions, those are different.
BTW, spring-servlet it's a single front servlet handles all the HTTP requests of a particular web application. This front servlet has all the controls over incoming requests.

spring boot with rest endpoints but also JSF

I am having trouble as I have a sample app working with spring-boot and primefaces but can't manage to build a rest endpoint. I know there must be a configuration thing to be done between DispatcherServlet and FacesServlet but I still can't discover it. Can someone provide an example ?. I understand I could set each servlet to start working on a different path but its like being a turkish in the fog...

tomcat webserver/servlet container/dispatcher servlet interaction in springboot

what is the flow diagram of interactions between tomcat web server/servlet container and dispatcher servlet . tomcat servlet container is separate from spring IOC container or applicationcontext ?
Tomcat is a web server. It "knows" how to deal with web applications according to the web applications specification.
This specification defines means of servlets declaration, their order, etc. It also defines additional notions like filters, listeners, etc. This specification has nothing to do with spring. Basically, you can use tomcat to host the application with servlets, filters, listeners without spring dependencies, so you won't even have an application context.
With this in mind, Spring MVC (to which the Dispatcher Servlet actually belongs) is just a third-party among many others from the Tomcat standpoint.
DispatcherServlet is an ordinary servlet that the spring team has developed. It is an entry point to all spring infrastructure in web applications managed by a web server, it's a "glue" that acts as a "driver" - it loads the application context (all the beans), handles all the requests coming to the controllers, etc.

Spring boot, is it safe to use Spring MVC and Jersey together

Is it safe, or even possible, to use Jersey and Spring MVC together via Spring boot starters? I realize Jersey registers it's own servlet (mapped to /* with default configuration) to handle requests, where as Spring MVC registers it's dispatcher servlet (mapped to / with default configuration).
Is it possible and safe to configure Jersey servlet to handle request under the /api path, where as Spring MVC would still handle all other requests, or would this lead to conflicts/instability, or considered as a bad design solution?

Accessing Tomcat context parameter in Camel REST dsl

I am currently working on a set of REST resources that are deployed in a Tomcat servlet container. I have been using the Camel REST dsl (kickstarted by Spring) and it works very well. Now, I would like to get access to some parameters specified in the container's context.xml but havn't been able to figure out how to do that as I do not have access to the Servlet context in my route builder. Any suggestions?
Even though you are hosting your Spring-app on Tomcat, Camel is using a separate, internally loaded web server implementation for it's REST endpoints, e.g. Restlet or Spark-rest (for more infos check here). For that reason your Camel route is ignorant and entirely disconnected to your Tomcat let alone its Servlets contexts.

Resources