cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Austermann (JIRA)" <j...@apache.org>
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
                 URL: https://issues.apache.org/jira/browse/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:

{noformat}
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 
        engine.setConnector(connector);
        Provider provider = Provider.provider();
        EndpointImpl epi = (EndpointImpl) provider.createEndpoint(null, new FooImpl());
        epi.publish("http://0.0.0.0:12345/foo");		
    }
}
{noformat}

{noformat}
Exception in thread "main" java.lang.NullPointerException
	at org.eclipse.jetty.server.AbstractConnector.<init>(AbstractConnector.java:170)
	at org.eclipse.jetty.server.AbstractNetworkConnector.<init>(AbstractNetworkConnector.java:44)
	at org.eclipse.jetty.server.ServerConnector.<init>(ServerConnector.java:227)
	at org.eclipse.jetty.server.ServerConnector.<init>(ServerConnector.java:96)
	at Example.main(Example.java:14)
{noformat}
	
	
Class JettyHTTPServerEngine needs to be adapted to enable setting a custom jetty 9 connector.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message