out.close();
out = null;
} else if (tx != null) {
tx.getOutputStream().flush();
tx.getOutputStream().close();
CachedOutputStream cacheOs = tx.getOutputStream();
OutputStream clientOs = super.getOutputStream();
ByteArrayInputStream cacheIs = new ByteArrayInputStream(cacheOs.getContent());
IOUtils.copy(cacheIs, clientOs);
clientOs.flush();
clientOs.close();
} else {
super.getOutputStream().flush();