Created
April 30, 2010 14:34
-
-
Save harbulot/385281 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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