मैं जेटी संस्करण 9.0.0.एम 4 का उपयोग कर रहा हूं और एसएसएल कनेक्शन स्वीकार करने के लिए इसे कॉन्फ़िगर करने की कोशिश कर रहा हूं। इन निर्देशों का पालन करते हुए: http://www.eclipse.org/jetty/documentation/current/configuring-connectors.htmlजेटी 9 के लिए प्रोग्रामेटिक रूप से एसएसएल कॉन्फ़िगर करें
मैंने कुछ काम करने में कामयाब रहा है। हालांकि, मैंने जो कोड लिखा है वह बदसूरत और अनावश्यक रूप से जटिल लगता है। कोई विचार यह ठीक से कैसे करें?
final Server server = new Server(Config.Server.PORT);
SslContextFactory contextFactory = new SslContextFactory();
contextFactory.setKeyStorePath(Config.Location.KEYSTORE_LOCATION);
contextFactory.setKeyStorePassword("******");
SslConnectionFactory sslConnectionFactory = new SslConnectionFactory(contextFactory, org.eclipse.jetty.http.HttpVersion.HTTP_1_1.toString());
HttpConfiguration config = new HttpConfiguration();
config.setSecureScheme("https");
config.setSecurePort(Config.Server.SSL_PORT);
config.setOutputBufferSize(32786);
config.setRequestHeaderSize(8192);
config.setResponseHeaderSize(8192);
HttpConfiguration sslConfiguration = new HttpConfiguration(config);
sslConfiguration.addCustomizer(new SecureRequestCustomizer());
HttpConnectionFactory httpConnectionFactory = new HttpConnectionFactory(sslConfiguration);
ServerConnector connector = new ServerConnector(server, sslConnectionFactory, httpConnectionFactory);
connector.setPort(Config.Server.SSL_PORT);
server.addConnector(connector);
server.start();
server.join();
इस प्रश्न पर अच्छा काम –