Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modify JspServlet config in application web.xml?

I would need the following configuration only for my webapp:

<servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
        <param-name>mappedfile</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>trimSpaces</param-name>
        <param-value>true</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
</servlet>

So far I thought this is a setting which is global for Tomcat (i.e., it can only be configured in Tomcat's web.xml). This is something I am not allowed to do, beceause the Tomcat has other apps too.

I have made some experiments and for me it seems when I run the app locally on my developer machine these settings take place even when it is only in the web.xml of my own application.

Could someone enlighten me what is the exact mechanism here?

The official docs also say "The servlet which implements Jasper is configured using init parameters in your global $CATALINA_BASE/conf/web.xml" so I'm confused if this is an expected behaviour, only a "developer setting" or it could work in a more restrictive production environment too. What I can think of is that the servlet generator has different contexts for all the applications, and if there is no specific setting then it inherits the one defined in the global web.xml.

Any links / pointers / suggestions would be more than welcome!

like image 295
rlegendi Avatar asked Aug 23 '26 22:08

rlegendi


1 Answers

I've contacted the tomcat-users mailing list, Christopher Schultz provided a positive answer.

See the details here: http://mail-archives.apache.org/mod_mbox/tomcat-users/201801.mbox/%[email protected]%3E

like image 106
rlegendi Avatar answered Aug 25 '26 11:08

rlegendi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!