Embedded Jetty and SSL.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Embedded Jetty and SSL.

I'm using embedded Jetty to deploy several war files and would like some advice on how to make it run under SSL. (I've bought a CERT from a CA and now need to figure out how to use it for the login and admin war files.

Here are may war files and how I would like to use them.

MainPage.war           accessed as:     http://mydomain.com/                 (port 80 not SSL)
Login.war                accessed as:     https://mydomain.com/login          (port 443 + SSL)
Admin.war              accessed as:      https://mydomain.com/admin        (port 443 + SSL)

Currently I do something like   (greatly simplified to make shorter here)

//--- Start Code ---//
Server = new Server(80);

List<Handler> hList = new ArrayList<Handler>();
hList.add( new WebAppContext("../webapps/MainPage.war","/") );
hList.add( new WebAppContext("../webapps/Login.war","/login") );
hList.add( new WebAppContext("../webapps/Admin.war","/admin") );

ContextHandlerCollection contexts = new ContextHandlerCollection();
contexts.setHandlers(handlerList.toArray(new Handler[handlerList.size()]));


//--- End Code ---//

My question is

#1) How do I change that to get SSL running on a different port?

#2) How do I specify the location of the .crt and .jks files with the CA SSL?

#3) Am I better off creating a different Jetty server just to run the SSL ports?

P.S. I'm running Jetty 8.x in case it makes any difference.

Thanks for any advice.