I have a code snippet which uses GrizzlyWebServer and it works fine on
1.9.52. But it failed on version 2.x. Actually I could not find this
class in version 2.x. Any hint?
BTW, here is the code: (I use Guice injection as well in the code)
public class JerseyTaxonomyServletAsyncTest {
@SuppressWarnings("serial")
public static class DummySevlet extends HttpServlet { }
// @Ignore
@Test
public void testWithGrizzly() throws IllegalArgumentException,
NullPointerException, IOException {
// sample code for grizzly setup:
//
http://code.google.com/p/jersey-guice-demo/source/browse/trunk/src/main
/java/demo/App.java
GrizzlyWebServer server = new GrizzlyWebServer(9998);
ServletAdapter adapter = new ServletAdapter(new DummySevlet());
adapter.addServletListener(GuiceServletConfig.class.getName());
adapter.addFilter(new GuiceFilter(), "GuiceFilter", null);
server.addGrizzlyAdapter(adapter, new String[]{ "/" });
server.start();
Client client = ClientFactory.newClient();
Response response =
client.target(UriBuilder.fromUri("
http://localhost:9998").path("/taxono
my").build())
.request(MediaType.APPLICATION_XML).get(Response.class);
int responseCode = response.getStatus();
TaxonomyResponse taxonomyResponse =
response.readEntity(TaxonomyResponse.class);
//String responseMsg =
webResource.path("getAttributes").get(String.class);
// assertEquals("Hello World", responseMsg);
assertEquals(responseCode, 200);
server.stop();
}
}