I am creating RESTful web services using Jersey and an embedded Grizzly web server.
I see that there are two ways to create an embedded Grizzly web server. Can anyone tell me the difference between the two?
public static void main(String[] args) throws IOException, ConfigurationException, DBException, DaxException {
GrizzlyWebServer gws = new GrizzlyWebServer(8085, "/var/www");
ServletAdapter jerseyAdapter = new ServletAdapter();
jerseyAdapter.addInitParameter(
PackagesResourceConfig.PROPERTY_PACKAGES,"com.merchant.services");
jerseyAdapter.setServletInstance(new ServletContainer());
gws.addGrizzlyAdapter(jerseyAdapter, new String[]{"/"});
// let Grizzly run
gws.start();
}
And second way is:
ResourceConfig rc = new PackagesResourceConfig("com.merchant.services");
HttpServer httpServer = GrizzlyServerFactory.createHttpServer(BASE_URI, rc);
httpServer.start();
With the first way its easy to configure the web server.