tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Modify JspServlet config in application web.xml?
Date Thu, 25 Jan 2018 05:25:09 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Richárd,

On 1/24/18 4:31 PM, Richárd Olivér Legéndi wrote:
> Yaaaay! I'm sending a tech mail to an open source community after
> years! You can't believe what a relief it is :-)

Welcome to the community!

> Anyway, I would like to ask your help about some config topic.
> 
> 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, because 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?

When Tomcat deploys your context ("webapp"), it merges the global
conf/web.xml and the application's WEB-INF/web.xml with the
application's configuration overriding anything in the global
configuration. Therefore, if you replace the "jsp" servlet
configuration in WEB-INF/web.xml, it will (a) work and (b) only affect
that single application.

> The docs <http://www2.hu-berlin.de/newlogic/docs/jasper-howto.html>
> 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*.

You can also use <init-param> in WEB-INF/web.xml for the JSP servlet.
You will probably have to copy those settings you want from the JSP
configuration in conf/web.xml because I don't think Tomcat will merge
init-param between the two files.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlppajUACgkQHPApP6U8
pFjeyw//Zg07qWt1IJV9i2UvEJqkd7fcWXo/1XMwIvJPKXSBYU6r4HzSw5o8O2WQ
SNDpFhGE08YLTVQ86h8rQk9CgT1xLbuFcJixuxC/CoLB4MfiECpVZJyDukilt9j6
JUgGOEAmxmqetkb9y/5dkUe34KxjNC1nTx3MQTSCw3vCk2W4JL8WT1w/XU1XOGtB
mgtZm8eu5WQU1baUkUN5du35TxnpXSJ51PnI9XWEhto3gZ0PvPNKSnqYK1OMJPn7
FBGDrTv050+OocIDC4TPyh+V0zt3f67zvyYk4SIwDXE++9dJ0UYtjnS2zzlerAug
F5PUhbWYBdMUivirGP8wZ3cfRGxzvXRnZA29+u6e57PaCTBeec2C/oc8pyuBSlkD
dQVgc9/MdrVm+I1ukfYwiuQwD7NEUNAPe83e/lQerpJQ5MwWlMtH9EI0Tdo1c6AC
JwYgDRICvDhdBhJS6JrbrsmAbT3TAgHxoCTduktFHKsqPj5Ujc+9+4C9sU9PB1Ch
3/CoXT1H0pEZkxeCOK6C+J7pIOvO5tPOmu1z9BpVc80q9YXkjrJCGLWAhj82iCrA
KoKHhPQpp4AoviUBO+Gi/cBh18OOLeyIb4UIza+lec64OERerIgHqZo7HX4Z/cT5
LbG1mquwAdpIzjIWCYvoTRgsepZCwu0WgV2xYcP6YvP4/6NJ+Dg=
=uEFM
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message