Analisando uma tela que tenho em meu sistema com geoprocessamento, as imagens geradas pela ferramenta estão vindo com o cabeçalho text/html, quando deveria ser image/png.
public Download map(String x, String y)
throws IOException {
File file = new File(SystemUtils.getJavaIoTmpDir(), "simplemap-" + x+ y+ ".png");
if (!file.exists()) {
file = gisService.fetchMapFromCoords(x, y);
}
return new FileDownload(file, "image/png", file.getName());
}
Nesse caso eu estou indicando qual o content-type, porém fazendo um debug não ví em momento algum o vraptor chamar um setContentType. O atributo doDownload no meu caso está false, sendo assim ele imprime o inline normalmente. Somente o content-type que não está sendo alterado.
void writeDetails(HttpServletResponse response) {
if (contentType != null) {
String header = String.format("%s; filename=%s", doDownload ? "attachment" : "inline", fileName);
response.setHeader("Content-disposition", header);
}
if (size > 0) {
response.setHeader("Content-Length", Long.toString(size));
}
}
