writeTileResponse(conv, writeExpiration, null, null);
}
protected static void writeTileResponse(ConveyorTile conv, boolean writeExpiration, RuntimeStats stats, String mimeTypeOverride) {
HttpServletResponse response = conv.servletResp;
Resource data = conv.getBlob();
String mimeStr;
if(mimeTypeOverride == null){
mimeStr = conv.getMimeType().getMimeType();
}else{
mimeStr = mimeTypeOverride;
}
response.setCharacterEncoding("utf-8");
response.setStatus((int) conv.getStatus());
TileLayer layer = conv.getLayer();
if (layer != null) {
layer.setExpirationHeader(conv.servletResp, (int) conv.getTileIndex()[2]);
}
if (writeExpiration) {
conv.getLayer().setExpirationHeader(response, (int) conv.getTileIndex()[2]);
}
response.setContentType(mimeStr);
int size = (int)data.getSize();
response.setContentLength(size);
try {
OutputStream os = response.getOutputStream();
WritableByteChannel channel = Channels.newChannel(os);
data.transferTo(channel);
if(stats != null) {
stats.log(size, conv.getCacheResult());
}
} catch (IOException ioe) {