cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Austermann (JIRA)" <>
Subject [jira] [Created] (CXF-7179) Unable to set ServerConnector in JettyHTTPServerEngine using jetty 9
Date Wed, 14 Dec 2016 09:25:59 GMT
Michael Austermann created CXF-7179:

             Summary: Unable to set ServerConnector in JettyHTTPServerEngine using jetty 9
                 Key: CXF-7179
             Project: CXF
          Issue Type: Bug
          Components: Transports
    Affects Versions: 3.1.9
            Reporter: Michael Austermann

With Jetty 9 a reference to the jetty server is needed to create a ServerConnector (jetty's
default connector).
See org.eclipse.jetty.server.ServerConnector.ServerConnector(Server)

Using the CXF JettyHTTPServerEngineFactory and JettyHTTPServerEngine to create a jetty server,
it is impossible to override the Connector.
The method org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.setConnector(Connector)
is useless, because it is immpossible to create a ServerConnector without a Jetty Server and
JettyHTTPServerEngine.getServer() returns null during configuration phase of the JettyHTTPServerEngine.
The example below leads to a NullPointerException:

public class Example {
    public static void main(String[] args) throws Exception {
        JettyHTTPServerEngineFactory factory = new JettyHTTPServerEngineFactory();
        JettyHTTPServerEngine engine = factory.createJettyHTTPServerEngine(12345, "http");
        ServerConnector connector = new ServerConnector(null); // engine.getServer() is also
NULL at this time 
        Provider provider = Provider.provider();
        EndpointImpl epi = (EndpointImpl) provider.createEndpoint(null, new FooImpl());

Exception in thread "main" java.lang.NullPointerException
	at org.eclipse.jetty.server.AbstractConnector.<init>(
	at org.eclipse.jetty.server.AbstractNetworkConnector.<init>(
	at org.eclipse.jetty.server.ServerConnector.<init>(
	at org.eclipse.jetty.server.ServerConnector.<init>(
	at Example.main(
Class JettyHTTPServerEngine needs to be adapted to enable setting a custom jetty 9 connector.

This message was sent by Atlassian JIRA

View raw message