diff options
author | wbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-10-15 10:17:23 +0000 |
---|---|---|
committer | wbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-10-15 10:17:23 +0000 |
commit | 32876f1d7e402fbf8ce8b0b113f214a6e8ac8d48 (patch) | |
tree | 7acf1e12c89769d047199a6c68926cf647817de9 /BKUOnline | |
parent | 11411c3d236e10b237ec1c7a1904e64dc2508551 (diff) | |
download | mocca-32876f1d7e402fbf8ce8b0b113f214a6e8ac8d48.tar.gz mocca-32876f1d7e402fbf8ce8b0b113f214a6e8ac8d48.tar.bz2 mocca-32876f1d7e402fbf8ce8b0b113f214a6e8ac8d48.zip |
added content-disposition header workaround for msie
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@116 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUOnline')
-rw-r--r-- | BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java index 40a66de0..c9af43d0 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java @@ -5,15 +5,11 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.List;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -21,15 +17,11 @@ import org.apache.commons.logging.LogFactory; import at.gv.egiz.bku.binding.BindingProcessor;
import at.gv.egiz.bku.binding.Id;
import at.gv.egiz.bku.binding.IdFactory;
-import at.gv.egiz.bku.online.applet.BKUApplet;
import at.gv.egiz.bku.slexceptions.SLRuntimeException;
import at.gv.egiz.bku.utils.StreamUtil;
import at.gv.egiz.stal.HashDataInput;
import at.gv.egiz.stal.STAL;
-import at.gv.egiz.stal.service.STALService;
import at.gv.egiz.stal.service.impl.STALRequestBroker;
-import at.gv.egiz.stal.service.impl.STALRequestBrokerImpl;
-import at.gv.egiz.stal.service.impl.STALServiceImpl;
public class HashDataInputServlet extends SpringBKUServlet {
@@ -52,6 +44,12 @@ public class HashDataInputServlet extends SpringBKUServlet { }
}
+ private static boolean isMSIE(HttpServletRequest req) {
+ String useragent = req.getHeader("User-Agent");
+ String user = useragent.toLowerCase();
+ return (user.indexOf("msie") != -1);
+ }
+
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
@@ -78,7 +76,7 @@ public class HashDataInputServlet extends SpringBKUServlet { }
if ((param == null) && (hdi.size() == 1)) {
param = hdi.get(0).getReferenceId();
- log.debug("Request parameter not set, setting to: "+param);
+ log.debug("Request parameter not set, setting to: " + param);
}
for (HashDataInput hd : hdi) {
if (hd.getReferenceId().equals(param)) {
@@ -89,10 +87,16 @@ public class HashDataInputServlet extends SpringBKUServlet { charSet = "UTF-8";
}
resp.setCharacterEncoding(charSet);
+ if (isMSIE(req)) {
+ String fileExt = hd.getMimeType().equalsIgnoreCase("text/plain") ? ".txt"
+ : ".xhtml";
+ resp.addHeader("content-disposition", "attachment; filename=" + param
+ + fileExt);
+ }
Reader r = new InputStreamReader(hd.getHashDataInput(), charSet);
Writer w = new OutputStreamWriter(resp.getOutputStream(), charSet);
StreamUtil.copyStream(r, w);
- w.close();
+ w.flush();
return;
}
|