@Override protected void writeResponse(final SearchResult result, final HttpServletResponse response) throws IOException { response.setContentType("application/json"); final JsonWriter writer = new JsonWriter(new BufferedWriter(new OutputStreamWriter(response.getOutputStream()))); writer.write(result); } }
@Override protected void writeResponse(final SearchResult result, final HttpServletResponse response) throws IOException { response.setContentType("application/json"); final JsonWriter writer = new JsonWriter(new BufferedWriter(new OutputStreamWriter(response.getOutputStream()))); writer.write(result); } }
@Override protected void writeResponse(final SearchResult result, final HttpServletResponse response) throws IOException { response.setContentType("application/json"); final JsonWriter writer = new JsonWriter(new BufferedWriter(new OutputStreamWriter(response.getOutputStream()))); writer.write(result); } }
@Override protected void writeResponse(final SearchResult result, final HttpServletResponse response) throws IOException { response.setContentType("application/json"); final JsonWriter writer = new JsonWriter(new BufferedWriter(new OutputStreamWriter(response.getOutputStream()))); writer.write(result); } }
@Override protected void writeResponse(final SearchResult result, final HttpServletResponse response) throws IOException { response.setContentType("application/json"); final JsonWriter writer = new JsonWriter(new BufferedWriter(new OutputStreamWriter(response.getOutputStream()))); writer.write(result); } }
/** * @param result to convert to json. * @param json to expect from the writer. * * @throws Exception On test failure. */ @Test(groups = {"jsontest"}, dataProvider = "search-data") public void writer(final SearchResult result, final String json) throws Exception { final StringWriter writer = new StringWriter(); (new JsonWriter(writer)).write(result); AssertJUnit.assertEquals(json, writer.toString()); }