summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorning.zhang2012-03-27 05:04:12 (EDT)
committer dgao2012-03-27 05:04:12 (EDT)
commit8cf53167b609d8101a3a4a84aaf0a69bb6c11939 (patch)
tree674634dfc00fb425ec1500f8d9b2c1effd0287f8
parent1d6f97c0ee3677c0b7f16b1d7cbde0277a841e85 (diff)
downloadorg.eclipse.birt-8cf53167b609d8101a3a4a84aaf0a69bb6c11939.zip
org.eclipse.birt-8cf53167b609d8101a3a4a84aaf0a69bb6c11939.tar.gz
org.eclipse.birt-8cf53167b609d8101a3a4a84aaf0a69bb6c11939.tar.bz2
Set contentType of the response to "image/svg+xml" if it is an svg file.
-rw-r--r--viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/service/actionhandler/AbstractRenderImageActionHandler.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/service/actionhandler/AbstractRenderImageActionHandler.java b/viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/service/actionhandler/AbstractRenderImageActionHandler.java
index 49fc649..9ee2e56 100644
--- a/viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/service/actionhandler/AbstractRenderImageActionHandler.java
+++ b/viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/service/actionhandler/AbstractRenderImageActionHandler.java
@@ -12,6 +12,8 @@
package org.eclipse.birt.report.service.actionhandler;
import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.eclipse.birt.report.context.IContext;
import org.eclipse.birt.report.service.api.InputOptions;
@@ -32,15 +34,18 @@ abstract public class AbstractRenderImageActionHandler
public void __execute( ) throws Exception
{
- context.getResponse( ).setContentType( "image" ); //$NON-NLS-1$
- String imageId = context.getRequest( ).getParameter(
- ParameterAccessor.PARAM_IMAGEID );
- ServletOutputStream out;
+ HttpServletRequest request = context.getRequest( );
+ HttpServletResponse response = context.getResponse();
+
String docName = null;// TODO: Do we need document name?
+ String imageId = request.getParameter( ParameterAccessor.PARAM_IMAGEID );
+
+ response.setContentType( imageId.endsWith(".svg") ? "image/svg+xml" : "image" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ServletOutputStream out = response.getOutputStream( );
InputOptions options = new InputOptions( );
- options.setOption( InputOptions.OPT_REQUEST, context.getRequest( ) );
- out = context.getResponse( ).getOutputStream( );
+ options.setOption( InputOptions.OPT_REQUEST, request );
+
getReportService( ).getImage( docName, imageId, out, options );
}
}