if (c.getContentType() != null && !_responseFields.containsKey(HttpHeaders.CONTENT_TYPE_BUFFER)) _responseFields.add(HttpHeaders.CONTENT_TYPE_BUFFER, c.getContentType()); if (c.getContentLength() > 0) _responseFields.addLongField(HttpHeaders.CONTENT_LENGTH_BUFFER, c.getContentLength()); if (c.getLastModified() != null) _responseFields.add(HttpHeaders.LAST_MODIFIED_BUFFER, c.getLastModified());
if (c.getContentType() != null && !_responseFields.containsKey(HttpHeaders.CONTENT_TYPE_BUFFER)) _responseFields.add(HttpHeaders.CONTENT_TYPE_BUFFER, c.getContentType()); if (c.getContentLength() > 0) _responseFields.putLongField(HttpHeaders.CONTENT_LENGTH_BUFFER, c.getContentLength()); Buffer lm = c.getLastModified(); if (lm != null) _responseFields.put(HttpHeaders.LAST_MODIFIED_BUFFER, lm);
        public void sendContent(Object content) throws IOException        {            if (_closed)                throw new IOException("Closed");                        if (_generator.getContentWritten() > 0) throw new IllegalStateException("!empty");            if (content instanceof HttpContent)            {                HttpContent c = (HttpContent) content;                if (c.getContentType() != null && !_responseFields.containsKey(HttpHeaders.CONTENT_TYPE_BUFFER)) _responseFields.add(HttpHeaders.CONTENT_TYPE_BUFFER, c.getContentType());                if (c.getContentLength() > 0) _responseFields.addLongField(HttpHeaders.CONTENT_LENGTH_BUFFER, c.getContentLength());                if (c.getLastModified() != null) _responseFields.add(HttpHeaders.LAST_MODIFIED_BUFFER, c.getLastModified());                                content = c.getBuffer();                if (content==null)                    content=c.getInputStream();            }                        if (content instanceof Buffer)            {                _generator.addContent((Buffer) content, HttpGenerator.LAST);                commitResponse(HttpGenerator.LAST);            }            else if (content instanceof InputStream)            {                InputStream in = (InputStream)content;                                int max = _generator.prepareUncheckedAddContent();                Buffer buffer = _generator.getUncheckedBuffer();                                int len=buffer.readFrom(in,max);                                while (len>=0)                {                    _generator.completeUncheckedAddContent();                    _out.flush();                                        max = _generator.prepareUncheckedAddContent();                    buffer = _generator.getUncheckedBuffer();                    len=buffer.readFrom(in,max);                }                _generator.completeUncheckedAddContent();                _out.flush();                    }            else                throw new IllegalArgumentException("unknown content type?");        }     