Package com.google.gerrit.server.query.change

Examples of com.google.gerrit.server.query.change.ListChanges


  }

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse res)
      throws IOException {
    ListChanges impl = factory.get();
    if (acceptsJson(req)) {
      impl.setFormat(OutputFormat.JSON_COMPACT);
    }
    if (paramParser.parse(impl, req, res)) {
      ByteArrayOutputStream buf = new ByteArrayOutputStream();
      if (impl.getFormat().isJson()) {
        buf.write(JSON_MAGIC);
      }

      Writer out = new BufferedWriter(new OutputStreamWriter(buf, "UTF-8"));
      try {
        impl.query(out);
      } catch (QueryParseException e) {
        res.setStatus(HttpServletResponse.SC_BAD_REQUEST);
        sendText(req, res, e.getMessage());
        return;
      } catch (OrmException e) {
        log.error("Error querying /changes/", e);
        res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        return;
      }
      out.flush();

      res.setContentType(impl.getFormat().isJson() ? JSON_TYPE : "text/plain");
      res.setCharacterEncoding("UTF-8");
      send(req, res, buf.toByteArray());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gerrit.server.query.change.ListChanges

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.