users@grizzly.java.net

SSL how to?

From: kevinb <kbrisso_at_gmail.com>
Date: Fri, 6 Jan 2012 15:32:53 -0800 (PST)

Hello-

I am working on a POC and the question has come up can GRIZZLY/Jersey use
SSL? I have searched but not found any examples on how to do this. Here is
my code below can some one give me some direction? Yes I will post back the
working code as always! Thanks!

Kevin


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.frk.mw.trillium;

import com.frk.mw.trillium.factory.*;

import com.sun.jersey.api.container.grizzly2.GrizzlyWebContainerFactory;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.glassfish.grizzly.http.server.HttpServer;

import javax.ws.rs.core.UriBuilder;
import java.io.IOException;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import org.glassfish.grizzly.http.server.StaticHttpHandler;
import pkgs.natives.TrilTGenClient;

/**
 *
 * @author kbrisso
 */
public class TrilliumServer {

    /**
     * @param args the command line arguments
     */
    private static URI getBaseURI() {
        return UriBuilder.fromUri("http://localhost/").port(8080).build();
    }
    public static final URI BASE_URI = getBaseURI();

    protected static HttpServer startServer() throws IOException {
        final Map<String, String> initParams = new HashMap<String,
String>();

        initParams.put("com.sun.jersey.config.property.packages",
                "com.frk.mw.trillium");

        System.out.println("Starting grizzly...");

        return GrizzlyWebContainerFactory.create(BASE_URI, initParams);
    }

    public static void main(String[] args) throws IOException {

        TrilTGenClient TrilTGenClient =
TrilClientCacheFactory.getCacheInstance();

        HttpServer httpServer = startServer();

        httpServer.getServerConfiguration().addHttpHandler(new
StaticHttpHandler("C:\\Projects\\MWTrilliumPOC\\www\\"), "/main");
        httpServer.getServerConfiguration().addHttpHandler(new
StaticHttpHandler("C:\\Projects\\MWTrilliumPOC\\www\\js\\"), "/main");

        System.out.println(String.format("Jersey app started with WADL
available at "
                + "%sapplication.wadl\nHit enter to stop it...",
                BASE_URI, BASE_URI));
        System.in.read();

        httpServer.stop();
    }
}


--
View this message in context: http://grizzly.1045725.n5.nabble.com/SSL-how-to-tp5126906p5126906.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.