Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
- AbstractResource subclass gets ClientAbortException

- AbstractResource subclass gets ClientAbortException

2007-11-01       - By JakeC

 Back
While writing to the output stream, I get the following stacktrace:
11:03:00,031 INFO  [Util] 0: Writing 16,384 bytes of 57,567 to buffer
 | 11:41:42,202 INFO  [Util] 0: Writing 16,384 bytes of 57,567 to buffer
 | 11:41:42,202 INFO  [Util] 0: Writing 16,384 bytes of 57,567 to buffer
 | 11:41:42,202 INFO  [Util] 0: Writing 16,384 bytes of 57,567 to buffer
 | 11:41:42,202 ERROR [Util] Error serving file: <path to file>
 | ClientAbortException:  java.net.SocketException: Connection reset by peer:
socket write error
 |         at org.apache.catalina.connector.OutputBuffer.realWriteBytes
(OutputBuffer.java:366)
 |         at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java
:433)
 |         at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:348)
 |         at org.apache.catalina.connector.OutputBuffer.writeBytes
(OutputBuffer.java:392)
 |         at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer
.java:381)
 |         at org.apache.catalina.connector.CoyoteOutputStream.write
(CoyoteOutputStream.java:88)
 |         at com.mycompany.myproject.Util.download(Util.java:93)

My code that does the writing is here:
  public static void download(HttpServletResponse response, File file, String
downloadName)
 |       throws IOException {
 |     FileInputStream fis = null;
 |     OutputStream os = null;
 |     if(file != null && file.exists()) {
 |       try {
 |         byte[] buf = new byte[BUF_SIZE];
 |              if(downloadName != null && downloadName.trim().length() > 0)
 |                response.setHeader("Content-Disposition", "attachment
;filename=\"" +
 |                     downloadName + "\"");
 |              response.setHeader("Cache-Control", "no-store");
 |              response.setHeader("Pragma", "no-cache");
 |              response.setDateHeader("Expires", 0);
 |              response.setContentType("application/octet-stream");
 |              fis = new FileInputStream(file);
 |             os = response.getOutputStream();
 |             int len = -1;
 |             int x = 0;
 |             while((len = fis.read(buf)) != -1) {
 |               log.info("{0}: Writing {1} bytes of {2} to buffer", x, len, file
.length());
 |               os.write(buf, 0, len);
 |             }
 |       } catch (Throwable t) {
 |         log.error("Error serving file: "+file, t);
 |         response.sendError(HttpServletResponse.SC_NOT_FOUND);
 |       } finally {
 |         if(fis != null) try{fis.close();}catch(Throwable t){
 |           log.warn("Error closing input stream: " + t.getMessage(), t);
 |         }
 |         if( os != null) try{ os.flush();}catch(Throwable t){
 |           if("org.apache.catalina.connector.ClientAbortException".equals(t
.getClass().getCanonicalName()))
 |             log.info("client canceled download");
 |           else
 |             log.warn("Error flushing output stream: " + t.getClass()
.getCanonicalName(), t);
 |         }
 |         if( os != null) try{ os.close();}catch(Throwable t){
 |           log.warn("Error closing output stream: " + t.getMessage(), t);
 |         }
 |       }
 |     } else {
 |       log.error("Error serving unknown file: "+file);
 |       response.sendError(HttpServletResponse.SC_NOT_FOUND);
 |     }
 |   }

It works just fine under http, but croaks in https. This is with a self-signed
certificate, after accepting it, of course.

I checked the request path, and it is using the https protocol.

One problem I'm having on that page is that IE believes that the page contains
both secure and unsecure items. However, our entire web app is completely under
https, and there are no references to external resources. Looking at the source
of the page, the only things with "http:" in them are the DOCTYPE dtd and the
html xmlns declarations. Could that possibly have anything to do with it?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic
&p=4101048#4101048

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode
=reply&p=4101048
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user

©2008 junlu.com - Jax Systems, LLC, U.S.A.