public void handle() throws IOException {
    // System.err.println("GrizzlyEndPoint.handle "+this);

    try {
      // System.err.println("handle  "+this);
      _connection.handle();
    } finally {
      // System.err.println("handled "+this);
      Continuation continuation = _connection.getRequest().getContinuation();
      if (continuation != null && continuation.isPending()) {
        // We have a continuation
        // TODO something!
      } else {
        // something else... normally re-enable this connection is the selectset with the latest
        // interested ops
      }
    }
  }
  @Override
  public void handle(
      String target, HttpServletRequest request, HttpServletResponse response, int dispatch)
      throws IOException, ServletException {
    Request base_request =
        (request instanceof Request)
            ? (Request) request
            : HttpConnection.getCurrentConnection().getRequest();

    if (target.startsWith("/admx/add")) {
      final String db = request.getParameter("db");
      final String cred = request.getParameter("cred");
      bootstrapper.createVirtualServer(db, cred);
      sendOk(base_request, response);
    } else if (target.startsWith("/admx/remove")) {
      final String db = request.getParameter("db");
      bootstrapper.removeVirtualServer(db);
      sendOk(base_request, response);
    }
  }
Exemplo n.º 3
0
  public void handle(
      String target, HttpServletRequest request, HttpServletResponse response, int dispatch)
      throws IOException, ServletException {

    // String requestContent = Util.readToString(request.getInputStream());
    // System.out.println("request content: " + requestContent);

    OutputStream out = response.getOutputStream();
    ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer();
    writer.write("hello world");
    writer.flush();
    response.setContentLength(writer.size());
    writer.writeTo(out);
    out.flush();

    Request base_request =
        (request instanceof Request)
            ? (Request) request
            : HttpConnection.getCurrentConnection().getRequest();
    base_request.setHandled(true);
  }
 public boolean isComplete() {
   return _connection.getGenerator().isComplete();
 }
 public boolean keepAlive() {
   return _connection.getGenerator().isPersistent();
 }
 public void recycle() {
   _connection.destroy();
 }