1010import java .net .URL ;
1111import java .security .ProtectionDomain ;
1212
13+ import org .eclipse .jetty .http .HttpVersion ;
14+ import org .eclipse .jetty .server .HttpConfiguration ;
15+ import org .eclipse .jetty .server .HttpConnectionFactory ;
16+ import org .eclipse .jetty .server .SecureRequestCustomizer ;
1317import org .eclipse .jetty .server .Server ;
18+ import org .eclipse .jetty .server .ServerConnector ;
19+ import org .eclipse .jetty .server .SslConnectionFactory ;
1420import org .eclipse .jetty .server .handler .HandlerList ;
1521import org .eclipse .jetty .util .StringUtil ;
22+ import org .eclipse .jetty .util .ssl .SslContextFactory ;
1623import org .eclipse .jetty .webapp .WebAppContext ;
1724
1825public class Bootstrap {
@@ -50,6 +57,8 @@ public static void main(String[] args) throws Exception {
5057 putEnv (PREFIX + "maven" , dim [1 ]);
5158 } else if (dim [0 ].equals ("--upload" )) {
5259 putEnv (PREFIX + "upload" , dim [1 ]);
60+ } else if (dim [0 ].equals ("--ssl" )) {
61+ putEnv (PREFIX + "ssl" , dim [1 ]);
5362 }
5463 }
5564 } else if (!arg .startsWith ("-f" )) {
@@ -76,6 +85,39 @@ public static void main(String[] args) throws Exception {
7685
7786 WebAppContext context = new WebAppContext ();
7887
88+ // //server for ssl ,default not open
89+ // String sslport = getOrCreateEnv(PREFIX + "ssl", "433");
90+ // if (sslport != null) {
91+ // // HTTP Configuration
92+ // HttpConfiguration http_config = new HttpConfiguration();
93+ // http_config.setSecureScheme("https");
94+ // http_config.setSecurePort(Integer.parseInt(sslport));
95+ //
96+ // SslContextFactory contextFactory = new SslContextFactory();
97+ //// sslContextFactory.setKeyStorePath(jetty_home + "/../../../jetty-server/src/test/config/etc/keystore");
98+ //// sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
99+ //// sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
100+ //// sslContextFactory.setTrustStorePath(jetty_home + "/../../../jetty-server/src/test/config/etc/keystore");
101+ //// sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
102+ //// sslContextFactory.setExcludeCipherSuites("SSL_RSA_WITH_DES_CBC_SHA",
103+ //// "SSL_DHE_RSA_WITH_DES_CBC_SHA", "SSL_DHE_DSS_WITH_DES_CBC_SHA",
104+ //// "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
105+ //// "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
106+ //// "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
107+ //// "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA");
108+ //
109+ // // SSL HTTP Configuration
110+ // HttpConfiguration https_config = new HttpConfiguration(http_config);
111+ // https_config.addCustomizer(new SecureRequestCustomizer());
112+ //
113+ // // SSL Connector
114+ // ServerConnector sslConnector = new ServerConnector(server,
115+ // new SslConnectionFactory(contextFactory,HttpVersion.HTTP_1_1.asString()),
116+ // new HttpConnectionFactory(https_config));
117+ // sslConnector.setPort(8443);
118+ // server.addConnector(sslConnector);
119+ // }
120+
79121 File jcoderHome = new File (home );
80122
81123 makeFiles (jcoderHome , logPath );
@@ -137,35 +179,14 @@ private static void createLog4j2Config(File log4jFile, String logPath) throws Fi
137179 return ;
138180 }
139181
140- String logTemplate = "<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>\n " +
141- "<Configuration status=\" INFO\" >\n " +
142- " <properties>\n " +
143- " <property name=\" LOG_PATH\" >{{LOG_PATH}}</property>\n " +
144- " </properties>\n " +
145- " <Appenders>\n " +
146- " <Console name=\" Console\" target=\" SYSTEM_OUT\" >\n " +
147- " <PatternLayout pattern=\" %c-%-4r %-5p [%d{yyyy-MM-dd HH:mm:ss}] %m%n\" />\n " +
148- " </Console>\n " +
149- "\n " +
150- " <RollingRandomAccessFile name=\" File\" fileName=\" ${LOG_PATH}\" \n " +
151- " filePattern=\" ${LOG_PATH}-%d{yyyyMMdd}\" >\n " +
152- " <PatternLayout pattern=\" %m%n\" />\n " +
153- " <Policies>\n " +
154- " <TimeBasedTriggeringPolicy interval=\" 1\" \n " +
155- " modulate=\" true\" />\n " +
156- " </Policies>\n " +
157- " </RollingRandomAccessFile>\n " +
158- "\n " +
159- " </Appenders>\n " +
160- "\n " +
161- "\n " +
162- " <Loggers>\n " +
163- " <Root level=\" info\" >\n " +
164- " <AppenderRef ref=\" Console\" />\n " +
165- " <AppenderRef ref=\" File\" />\n " +
166- " </Root>\n " +
167- " </Loggers>\n " +
168- "</Configuration>" ;
182+ String logTemplate = "<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>\n " + "<Configuration status=\" INFO\" >\n " + " <properties>\n "
183+ + " <property name=\" LOG_PATH\" >{{LOG_PATH}}</property>\n " + " </properties>\n " + " <Appenders>\n "
184+ + " <Console name=\" Console\" target=\" SYSTEM_OUT\" >\n " + " <PatternLayout pattern=\" %c-%-4r %-5p [%d{yyyy-MM-dd HH:mm:ss}] %m%n\" />\n "
185+ + " </Console>\n " + "\n " + " <RollingRandomAccessFile name=\" File\" fileName=\" ${LOG_PATH}\" \n " + " filePattern=\" ${LOG_PATH}-%d{yyyyMMdd}\" >\n "
186+ + " <PatternLayout pattern=\" %m%n\" />\n " + " <Policies>\n " + " <TimeBasedTriggeringPolicy interval=\" 1\" \n "
187+ + " modulate=\" true\" />\n " + " </Policies>\n " + " </RollingRandomAccessFile>\n " + "\n " + " </Appenders>\n " + "\n " + "\n "
188+ + " <Loggers>\n " + " <Root level=\" info\" >\n " + " <AppenderRef ref=\" Console\" />\n " + " <AppenderRef ref=\" File\" />\n "
189+ + " </Root>\n " + " </Loggers>\n " + "</Configuration>" ;
169190
170191 wirteFile (log4jFile .getAbsolutePath (), "utf-8" , logTemplate .replace ("{{LOG_PATH}}" , logPath ));
171192
0 commit comments