tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Re: How to Disable JSP in Embedded Tomcat
Date Fri, 21 Sep 2018 07:54:17 GMT
On 21/09/18 05:57, Igal Sapir wrote:
> I want to embed Tomcat in a simple application that does not use JSP, and
> that sets the default servlet's listings initParam to true.
> When I use the StandardContext, Tomcat.initWebappDefaults() [1] is called
> and adds the default servlet and the JSP servlet.  I would like to prevent
> that, but hopefully without having to rewrite the whole Tomcat class nor to
> subclass it.
> Further, when I try to override a setting in WEB-INF/web.xml, e.g. to
> specify init-param of "listings" with value "true" for the servlet
> "default", I get an error that "default" is not unique, but in a regular
> Tomcat deployment that works just fine.
> Is there an easy way to override Tomcat.initWebappDefaults() or to prevent
> it from being called?

There are a couple few options.

Sub-classing looks to be the simplest.

You can use addContext() rather than addWebapp() but then you become
responsible for all of the configuration. If the app is simple, this
shouldn't be too much effort.


> Thanks,
> Igal
> [1]

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message