I am building RESTful web services using Jersey and the Grizzly Embedded Web Server.
I see that there are two ways to create a Grizzly embedded web server. Can someone 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[]{"/"});
gws.start();
}
And the second way:
ResourceConfig rc = new PackagesResourceConfig("com.merchant.services");
HttpServer httpServer = GrizzlyServerFactory.createHttpServer(BASE_URI, rc);
httpServer.start();
The first time itβs easy to set up a web server
source
share