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

org.eclipse.jetty.maven.ServerSupport.configureHandlers(Server, List<ContextHandler>, RequestLog) removes handlers #12279

Closed
vitalus opened this issue Sep 16, 2024 · 0 comments · Fixed by #12282
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@vitalus
Copy link

vitalus commented Sep 16, 2024

Jetty version(s)
Jetty 12.0.13

Description
If jetty-eeXX-maven-plugin loads Jetty XMLs like jetty-cross-origin.xml where a org.eclipse.jetty.server.handler.CrossOriginHandler handler is created and added to Server object, then later an underlying method removes this handler..

    public static void configureHandlers(Server server, List<ContextHandler> contextHandlers, RequestLog requestLog) throws Exception 
    {
        if (server == null)
            throw new IllegalArgumentException("Server is null");

        if (requestLog != null)
            server.setRequestLog(requestLog);

        if (server.getDefaultHandler() == null)
            server.setDefaultHandler(new DefaultHandler());

        ContextHandlerCollection contexts = findContextHandlerCollection(server);
        if (contexts == null)
        {
            contexts = new ContextHandlerCollection();
            server.setHandler(contexts);
        } 
        
        if (contextHandlers != null)
        {   
            for (ContextHandler context:contextHandlers)
            {
                contexts.addHandler(context);
            }
        }
    }

Problem is in line with:

server.setHandler(contexts);

It should be probably addHandler(contexts) type of logic..

@vitalus vitalus added the Bug For general bugs on Jetty side label Sep 16, 2024
@janbartel janbartel self-assigned this Sep 16, 2024
janbartel added a commit that referenced this issue Sep 18, 2024
* Issue #12279 ensure handlers added correctly for maven plugin
@github-project-automation github-project-automation bot moved this to ✅ Done in Jetty 12.0.14 Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
No open projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants