Date: 2004-05-09T07:02:56
Editor: 131.191.40.91 <>
Wiki: Apache Struts Wiki
Page: StrutsCatalogEschewUrlForProtocol
URL: http://wiki.apache.org/struts/StrutsCatalogEschewUrlForProtocol
no comment
Change Log:
------------------------------------------------------------------------------
@@ -80,6 +80,41 @@
}
}}}
+Here is the response writer:
+
+{{{
+public class WriteResponse {
+
+ public WriteResponse() {
+ }
+
+ public static void write(String fileName,HttpServletResponse response) {
+ // Necessary to avoid problems with Internet Explorer
+ response.setHeader("Cache-Control", "");
+ response.setHeader("Pragma", "");
+ response.setHeader("Expires", "");
+ response.addHeader("Content-Disposition","filename=" + fileName);
+
+ try {
+ long getIS = new java.util.Date().getTime();
+ FileInputStream fis = new FileInputStream(fileName);
+ BufferedInputStream bis = new BufferedInputStream(fis);
+ byte[] bytes = new byte[bis.available()];
+ long getOS = new java.util.Date().getTime();
+ OutputStream os = response.getOutputStream();
+ long readIS = new java.util.Date().getTime();
+ bis.read(bytes);
+ long writeOS = new java.util.Date().getTime();
+ os.write(bytes);
+ long done = new java.util.Date().getTime(); os.flush();
+ os.close();
+ } catch (IOException ioe) {
+ StdOut.redirect("log.error","WriteResponse: problem file is: " + fileName +
"\n" + StackTrace.trace(ioe));
+ }
+ }
+}
+}}}
+
Here are the image constants:
{{{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]