Skip to content

Instantly share code, notes, and snippets.

@harbulot
Created April 30, 2010 14:34
Show Gist options
  • Save harbulot/385281 to your computer and use it in GitHub Desktop.
Save harbulot/385281 to your computer and use it in GitHub Desktop.
<!-- Add these to your POM file if you're using Maven 2 -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>7.0.1.v20091125</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
<version>7.0.1.v20091125</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>example-jetty-embedded</artifactId>
<version>7.0.1.v20091125</version>
</dependency>
import javax.net.ssl.SSLContext;
import org.eclipse.jetty.embedded.HelloHandler;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ssl.SslSocketConnector;
public class TestJettyServer {
public static void main(String[] args) throws Exception {
Server server = new Server();
SslSocketConnector sslSocketConnector = new SslSocketConnector();
sslSocketConnector.setPort(8443);
sslSocketConnector.setSslContext(SSLContext.getDefault());
sslSocketConnector.setWantClientAuth(true);
server.addConnector(sslSocketConnector);
Handler handler = new HelloHandler();
server.setHandler(handler);
server.start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment