users@jersey.java.net

[Jersey] Grizzly Jersey REST and static HTML

From: kevinb <kbrisso_at_gmail.com>
Date: Fri, 9 Dec 2011 14:02:34 -0800 (PST)

Hi All-
I have this sample project running that uses Grizzly and Jersey. The project
works and serves up a REST request. I was wondering how I can also serve up
static HTML from this. I have done some searching on GOOGLE but have found
very little.

Here is a snippet of my code below

    public class App
    {
        /**
         * @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.mycompany.jerseyrestgrizzly");
       
            System.out.println("Starting grizzly...");
              
            
            return GrizzlyWebContainerFactory.create(BASE_URI, initParams);
              
        }
       
        public static void main(String[] args) throws IOException {
            HttpServer httpServer = startServer();
            System.out.println(String.format("Jersey app started with WADL
available at "
                    + "%sapplication.wadl\nTry out %shelloworld\nHit enter
to stop it...",
                    BASE_URI, BASE_URI));
            System.in.read();
            httpServer.stop();
        }
    }

Thanks
Kevin




--
View this message in context: http://jersey.576304.n2.nabble.com/Grizzly-Jersey-REST-and-static-HTML-tp7079979p7079979.html
Sent from the Jersey mailing list archive at Nabble.com.