Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programmatically set jetty-web.xml #5290

Closed
sbordet opened this issue Sep 17, 2020 · 5 comments
Closed

Programmatically set jetty-web.xml #5290

sbordet opened this issue Sep 17, 2020 · 5 comments
Labels
Stale For auto-closed stale issues and pull requests
Milestone

Comments

@sbordet
Copy link
Contributor

sbordet commented Sep 17, 2020

Jetty version
10.0.x

Description
Would be good if there is a possibility to programmatically set a Jetty context XML file that is run after the processing of web.xml.
The use case would be for the deployer of a web application to be able to add or override init-params that depend on the deployment (e.g. the host, the timezone, the geographical location, the language, etc.).

Currently this mechanism exists, but it's hardcoded to look for the WEB-INF/jetty-web.xml file in the *.war.

The idea would be to introduce ContextHandler.setPostProcessXML(Resource r), with the semantic that is the resource is present, it is processed as last step in the web application configuration.

@sbordet sbordet added this to the 10.0.x milestone Sep 17, 2020
@joakime
Copy link
Contributor

joakime commented Sep 17, 2020

The DeploymentManager has a context attributes configuration that will apply the context attributes for all deployed apps.

@joakime
Copy link
Contributor

joakime commented Sep 17, 2020

(e.g. the host, the timezone, the geographical location, the language, etc.)

Those would also be great subjects for server level JNDI configuration that the webapp just uses.

@janbartel
Copy link
Contributor

@sbordet if it's just some params, then they can use an override-web.xml file to set <context-param>s for them. You use WebAppContext.setOverrideDescriptor(String) or WebAppContext.setOverrideDescriptors(List<String>) to give the location of the override-web.xml file, which is normally external to the war.

@github-actions
Copy link

This issue has been automatically marked as stale because it has been a
full year without activity. It will be closed if no further activity occurs.
Thank you for your contributions.

@github-actions github-actions bot added the Stale For auto-closed stale issues and pull requests label Dec 25, 2021
@github-actions
Copy link

This issue has been closed due to it having no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale For auto-closed stale issues and pull requests
Projects
None yet
Development

No branches or pull requests

3 participants