if ((entity != null) && !getMethod().equals(Method.HEAD.getName())) {
if ((entity != null) && !response.getRequest().getMethod().equals(Method.HEAD) && !response.getStatus().equals(Status.SUCCESS_NO_CONTENT) && !response.getStatus().equals( Status.SUCCESS_RESET_CONTENT)) {
    public void sendResponse(Response response) throws IOException {        if (response != null) {            Representation entity = response.getEntity();            if ((entity != null) && !getMethod().equals(Method.HEAD.getName())) {                // Get the connector service to callback                ConnectorService connectorService = getConnectorService(response                        .getRequest());                if (connectorService != null)                    connectorService.beforeSend(entity);                // Send the entity to the client                if (getResponseChannel() != null) {                    entity.write(getResponseChannel());                } else if (getResponseStream() != null) {                    entity.write(getResponseStream());                }                if (connectorService != null)                    connectorService.afterSend(entity);            }            if (getResponseStream() != null) {                getResponseStream().flush();            }        }    }