Send just the status code without a body, used for 204 or 304 @param status The response code to reply with
(final HttpResponseStatus status)
| 403 | * @param status The response code to reply with |
| 404 | */ |
| 405 | public void sendStatusOnly(final HttpResponseStatus status) { |
| 406 | if (!chan.isConnected()) { |
| 407 | if(stats != null) { |
| 408 | stats.markSendFailed(); |
| 409 | } |
| 410 | done(); |
| 411 | return; |
| 412 | } |
| 413 | |
| 414 | response.setStatus(status); |
| 415 | final boolean keepalive = HttpHeaders.isKeepAlive(request); |
| 416 | if (keepalive) { |
| 417 | HttpHeaders.setContentLength(response, 0); |
| 418 | } |
| 419 | final ChannelFuture future = chan.write(response); |
| 420 | if (stats != null) { |
| 421 | future.addListener(new SendSuccess()); |
| 422 | } |
| 423 | if (!keepalive) { |
| 424 | future.addListener(ChannelFutureListener.CLOSE); |
| 425 | } |
| 426 | done(); |
| 427 | } |
| 428 | |
| 429 | /** |
| 430 | * Sends an HTTP reply to the client. |
no test coverage detected