Global Directory
Global Directory
EXPLORE OUR SITES
London Stock Exchange Group
LSEG Data & Analytics
MyAccount
LSEG Perspectives
London Stock Exchange
FTSE Russell
LCH
Contact Us
Home
TR Internal
How can we have different web.xml for different environments?
Andrew Halford
In TFS for MAF we currently have one web.xml file and this is deployed locally and in Dev/QC/Client/Prod. But it includes items which are only required locally, notably BrandedStaticContentServlet.
This is a major issue as serving static content with BrandedStaticContentServlet can cause major performance issues for our customers (I suspect many brands may not be aware of this). By including it by default in web.xml, any paths to static content which point to the application server (i.e. start with /maf) are rarely picked up before going to Prod causing issues.
So does anyone know of a way to make web.xml environment specific, or should we comment out BrandedStaticContentServlet (and anything else we know of) and rely on developers uncommenting it for local use?
Find more posts tagged with
refinitiv-internal
Accepted answers
All comments
Martin Newstead
In Tomcat there is a 'global' web.xml in TOMCAT_HOME/conf that is processed before any applications' web.xml . Perhaps for a development environment the BrandedStaticContentServlet should be defined there. [EDIT: we'd probably need to deploy a jar that contains this servlet into a 'global' location in Tomcat such as TOMCAT_HOME/lib] This file must never be checked in/get's ignored by the builds for higher environments.
I'll try it out.
Martin Newstead
"and anything else we know of" such as ThemedStaticContentServlet
Ryan Morlok
Could you provide more information about how the static content is served up? In Cobalt we have as separate module that serves up static content that differentiates products based on request URL. That module is then run on a separate port from the core application when running locally, and on a different subdomain when deployed (e.g. i1.next.westlaw.com for images for next.westlaw.com).
Andrew Gerber
Are you using Spring or some other dependency injection framework? If so, you could inject a different class/implementation depending on the environment... that would be easier than having a special deploy or relying on developers to edit certain files locally.
Martin Newstead
The other web.xml, the 'global' on resides in the Servers/wluk-config so placing the servlet definitions in here, along with the required mappings will cause them to be not promoted to the QC/CLIENT/PROD environments. We'd need to be careful though. Removing the definitions from the maf web.xml will remove them for all brands so all the brands will need their Server web.xml updating with the definitions.
Martin Newstead
Wouldn't this simple move the problem to the beans.xml ? Wouldn't we still have to figure out how to use different versions of this file in the different environments ? Genuine questions Andrew, I don't know much about configuring Spring. I can't see how we'd trigger the injection of something different.
Martin Newstead
Perhaps another technique, instead of trying to prevent the deployment of the static content servlets, might be to modify the two servlets that are serving the static content so that if they are invoked in any mode that is not devMode then they should return no static content. We could make this happen only for those brands where this behaviour is needed (if not all).
Quick Links
All Forums
Recent Questions
Terms of use
Privacy & Cookie Statement
Cookies settings
Do not sell my info
Whistleblowing
UK Bribery Act
Modern Slavery Act