@Test public void testDoGet() throws Exception { servlet.init(null); request.setUri("/myapp", null); testResponse("Search topic not provided"); request.setUri("/myapp", "/crap"); testResponse("Topic not configured"); testResponse("crap"); request.setUri("/myapp", "/Environment/one/too/too/many"); testResponse("Search key in request uri not configured"); testResponse("many"); request.setUri("/myapp", "/Environment/one/two/three"); testResponse("\"records\":[]}"); request.setUri("/myapp", "/Environment"); testResponse("one row for each external sequence generator"); request.setUri("/myapp", "/Environment/PUBLIC/INFORMATION_SCHEMA/ADMINISTRABLE_ROLE_AUTHORIZATIONS"); testResponse("ADMINISTRABLE_ROLE_AUTHORIZATIONS"); }
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SearchRequest searchRequest = null; SearchResult searchResult = null; response.setContentType("text/json"); try{ searchRequest=new SearchRequestFactory().deriveSearchRequest(request); searchResult = new Moneta().find(searchRequest); ServletUtils.writeResult(searchResult, response.getOutputStream()); } catch (Exception e) { response.setStatus(500); ServletUtils.writeError(500, e, response.getOutputStream()); } IOUtils.closeQuietly(response.getOutputStream()); }
MonetaServlet extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SearchRequest searchRequest = null; SearchResult searchResult = null; response.setContentType("text/json"); try{ searchRequest=new SearchRequestFactory().deriveSearchRequest(request); searchResult = new Moneta().find(searchRequest); ServletUtils.writeResult(searchResult, response.getOutputStream()); } catch (Exception e) { response.setStatus(500); ServletUtils.writeError(500, e, response.getOutputStream()); } IOUtils.closeQuietly(response.getOutputStream()); } }
MonetaServlet extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SearchRequest searchRequest = null; SearchResult searchResult = null; response.setContentType("text/json"); try{ searchRequest=new SearchRequestFactory().deriveSearchRequest(request); searchResult = new Moneta().find(searchRequest); ServletUtils.writeResult(searchResult, response.getOutputStream()); } catch (Exception e) { response.setStatus(500); ServletUtils.writeError(500, e, response.getOutputStream()); } IOUtils.closeQuietly(response.getOutputStream()); }  }
MonetaServlet extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SearchRequest searchRequest = null; SearchResult searchResult = null; response.setContentType("text/json"); try{ searchRequest=new SearchRequestFactory().deriveSearchRequest(request); searchResult = new Moneta().find(searchRequest); ServletUtils.writeResult(searchResult, response.getOutputStream()); } catch (Exception e) { response.setStatus(500); ServletUtils.writeError(500, e, response.getOutputStream()); } IOUtils.closeQuietly(response.getOutputStream()); }  @Override void doGet(HttpServletRequest request, HttpServletResponse response); @Override void init(ServletConfig config); }
MonetaServlet extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SearchRequest searchRequest = null; SearchResult searchResult = null; response.setContentType("text/json"); try{ searchRequest=new SearchRequestFactory().deriveSearchRequest(request); searchResult = new Moneta().find(searchRequest); ServletUtils.writeResult(searchResult, response.getOutputStream()); } catch (Exception e) { response.setStatus(500); ServletUtils.writeError(500, e, response.getOutputStream()); } IOUtils.closeQuietly(response.getOutputStream()); }  @Override void doGet(HttpServletRequest request, HttpServletResponse response); @Override void init(ServletConfig config); static final String CONFIG_IGNORED_CONTEXT_PATH_NODES; }