/*
  * @see org.eclipse.jetty.server.server.HttpParser.EventHandler#content(int, org.eclipse.io.Buffer)
  */
 @Override
 public void content(Buffer ref) throws IOException {
   if (_endp instanceof AsyncEndPoint) ((AsyncEndPoint) _endp).scheduleIdle();
   if (_delayedHandling) {
     _delayedHandling = false;
     handleRequest();
   }
 }
    /*
     * @see org.eclipse.jetty.server.server.HttpParser.EventHandler#headerComplete()
     */
    @Override
    public void headerComplete() throws IOException {
      if (_endp instanceof AsyncEndPoint) ((AsyncEndPoint) _endp).scheduleIdle();
      _requests++;
      _generator.setVersion(_version);
      switch (_version) {
        case HttpVersions.HTTP_0_9_ORDINAL:
          break;
        case HttpVersions.HTTP_1_0_ORDINAL:
          _generator.setHead(_head);

          if (_server.getSendDateHeader()) _generator.setDate(_request.getTimeStampBuffer());

          break;
        case HttpVersions.HTTP_1_1_ORDINAL:
          _generator.setHead(_head);

          if (_server.getSendDateHeader()) _generator.setDate(_request.getTimeStampBuffer());

          if (!_host) {
            _generator.setResponse(HttpStatus.BAD_REQUEST_400, null);
            _responseFields.put(HttpHeaders.CONNECTION_BUFFER, HttpHeaderValues.CLOSE_BUFFER);
            _generator.completeHeader(_responseFields, true);
            _generator.complete();
            return;
          }

          if (_expect) {
            _generator.setResponse(HttpStatus.EXPECTATION_FAILED_417, null);
            _responseFields.put(HttpHeaders.CONNECTION_BUFFER, HttpHeaderValues.CLOSE_BUFFER);
            _generator.completeHeader(_responseFields, true);
            _generator.complete();
            return;
          }

          break;
        default:
      }

      if (_charset != null) _request.setCharacterEncodingUnchecked(_charset);

      // Either handle now or wait for first content
      if ((((HttpParser) _parser).getContentLength() <= 0 && !((HttpParser) _parser).isChunking())
          || _expect100Continue) handleRequest();
      else _delayedHandling = true;
    }