Skip to content
New issue

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

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

Already on GitHub? # to your account

Allow for customization of the Jetty WebAppContext #660

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

nscuro
Copy link
Collaborator

@nscuro nscuro commented Sep 9, 2024

Standalone Jetty installations provide a means to configure the context via XML files: https://jetty.org/docs/jetty/12/operations-guide/xml/index.html

The mechanism doesn't work for embedded use - XML files need to be discovered and loaded explicitly. For our purposes, applications can place a jetty-context.xml file in their WEB-INF directory in order for Alpine to discover them.

Since Alpine applications do not directly depend on alpine-executable-war, and thus do usually not have access to Jetty classes, the Jetty-native XML configuration was preferred over programmatic customization.

Example jetty-context.xml that disabled classpath scanning:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://jetty.org/configure_10_0.dtd">
<Configure class="org.eclipse.jetty.ee10.webapp.WebAppContext">
    <Call name="setAttribute">
        <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
        <Arg>^$</Arg>
    </Call>
    <Call name="setAttribute">
        <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
        <Arg>^$</Arg>
    </Call>
</Configure>

Standalone Jetty installations provide a means to configure the context via XML files: https://jetty.org/docs/jetty/12/operations-guide/xml/index.html

The mechanism doesn't work for embedded use - XML files need to be discovered and loaded explicitly. For our purposes, applications can place a jetty-context.xml file in their WEB-INF directory in order for Alpine to discover them.

Since Alpine applications do not directly depend on alpine-executable-war, and thus do usually not have access to Jetty classes, the Jetty-native XML configuration was preferred over programmatic customization.

Signed-off-by: nscuro <nscuro@protonmail.com>
@nscuro nscuro merged commit 245165a into stevespringett:master Sep 9, 2024
2 checks passed
@nscuro nscuro deleted the jetty-customization branch September 9, 2024 15:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant