I’m trying to create jsp page which will create a svg graphic file. Based on various examples of jsp pages and svgs i come with this:
<?xml version="1.0" encoding="UTF-8"?>
<%@ page language="java" contentType="image/svg+xml; charset=UTF-8;" pageEncoding="UTF-8"%>
<%
response.addHeader(
"Content-Disposition","attachment; filename=blob3" );
%>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="140" width="140" viewBox="0 0 14 14">
<circle cx="7" cy="7" r="6" fill="blue" />
</svg>
but it is not working. it allows me to download blob3.svg file, but it is empty file.
Can anyone could give me hint, what i’m doing wrong?
I think your Content-Disposition cause the download.
Here is a complete example that is working for many years for me :