How to change the servlet mapping in JoinFaces? - spring-boot

The default servlet mapping in JoinFaces seems to be *.jsf.
How may I change it to a different mapping? I could not find a setting in Spring Boots application config file.

Starting from JoinFaces 3.1.0, it is possible to configure servlet mapping. See details.

Related

How do I configure Undertow's MAX_PARAMETERS setting in Quarkus?

I would like to configure Undertow’s MAX_PARAMETERS value in an application that uses the Quarkus MyFaces extension for JSF.
I could not find any application.properties settings that would be forwarded to Undertow, nor does there appear to be any API to customize the UndertowOptionMap. Is there a way to do it?
As of Quarkus 1.13.0, this be done by setting the quarkus.servlet.max-parameters configuration value.

How to set threshold of SlowQueryReport interceptor of Tomcat in Spring Boot properties

We need to configure SlowQueryReport Tomcat interceptor in our Spring boot application, specifically threshold value in properties files. Couldn't find anything on the web. Any help?
We used the old syntax (see below, note the given threshold) in the configuration file and it worked:
spring.datasource:
tomcat.jdbc-interceptors: org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport(threshold=10);any.other.tomcat.Interceptor

Force Spring Boot to use servlet mapping in web.xml

I'm currently trying to shift my existing dynamic web project to Spring boot project and it uses web.xml for servlet mapping. I understand that spring would ignore the web.xml file, what should be the correct approach for spring to use the existing web.xml? And yes, I still need to stick to using web.xml for this project.
I'm kinda new to this, please guide me through! Thanks!
I suppose that you need to stick with a web.xml because your container uses an older version of Servlet than 3.0.
Spring Boot is built on Servlet 3.0. You have to update your main class to extend SpringBootServletInitializer and override configure method, which tells spring to use its Servlet 3.0 support. Embedded containers like Tomcat need Servlet 3.0, so if you want to start your project during the development process (including JUnit tests) in embedded containers, I think, from what I know, the only way is to rewrite your web.xml to Servlet 3.0 java config. But if you really want to deploy you app in an older container, you still can by using spring-boot-legacy module. It allows you to use web.xml for older containers; only thing you have to do is to add
org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener in your web.xml.
For more information about deploying war in an old container, take a look at Spring Boot's official documentation.
Spring Boot uses Servlet 3.0 APIs to initialize the ServletContext
(register Servlets etc.) so you can’t use the same application out of
the box in a Servlet 2.5 container. It is however possible to run a
Spring Boot application on an older container with some special tools.
If you include org.springframework.boot:spring-boot-legacy as a
dependency (maintained separately to the core of Spring Boot and
currently available at 1.0.2.RELEASE), all you should need to do is
create a web.xml and declare a context listener to create the
application context and your filters and servlets.
This is a very old question, but I'm currently on the same situation and I will share my experience.
I extended the SpringBootServletInitializer class to create my #SpringBootApplication, and it will INCLUDE your web.xml configuration by default. I'm still able to declare or edit existing servlet mapping, and it will be taken in account.

Equivalent of org.springframework.boot.context.embedded.FilterRegistrationBean for non-Boot Spring project?

I'm trying to implement external session handling in Spring, as per this tutorial. I'm having some trouble adding the right filter though. Spring Boot appears to have defined the proper bean/filter, but my project is not Spring Boot, so it cannot find the FilterRegistrationBean. Is there some sort of equivalent to this class in non-Boot versions of Spring? I also tried org.springframework.web.context.embedded.FilterRegistrationBean, but can't get it to import properly (it looks like this documentation refers to a SNAPSHOT version, so perhaps this package was never part of a proper release).
Depending on your container configuration, web.xml or ServletContainerInitializer, you can register a DelegatingFilterProxy filter and make it refer, by name, to a Filter bean you've declared in your ApplicationContext.

Access JVM options in Spring's Application Context xml

Is there any way to access any -D option value (JVM Option) in Spring's applicationContext.xml?
I am accessing Apache Camel Context through Spring's applicationContest.xml and separate out my routes or camelContexts based -Denv="preprod".
If you have a property-placeholder configured you can access the system properties using ${env}.
If you are using spring 3.0 or higher you can use the spring expression language support (Spel) - #{systemProperties.env}

Resources