hi,I use a servlet to get a file from FTP
and my code like:
response.reset();
response.setContentType("application/octet-stream");
response.setHeader("Content-disposition", "attachment; filename="
+ gbToUtf8(fileName));
ServletOutputStream out = response.getOutputStream();
//connect to ftp and success
ftpclient=FtpDao.ConnToFtp(ftpuser);
ftpclient.setType(FTPTransferType.BINARY);
ftpclient.get(out,fileName);
and I call the servlet URL,get a dialog which have three button like 'open','save' and 'cancel'
if I click open or save button it get ok
but if i click 'cancel' and the file i get larger than 500K
I get such Exception:
java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at weblogic.servlet.internal.ChunkUtils.writeChunkTransfer(ChunkUtils.ja
va:247)
at weblogic.servlet.internal.ChunkUtils.writeChunks(ChunkUtils.java:223)
at weblogic.servlet.internal.ChunkOutput.flush(ChunkOutput.java:296)
at weblogic.servlet.internal.ChunkOutput.checkForFlush(ChunkOutput.java:
371)
at weblogic.servlet.internal.ChunkOutput.write(ChunkOutput.java:241)
at weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper
.java:113)
at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutput
StreamImpl.java:184)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
at com.enterprisedt.net.ftp.FTPClient.getDataAfterInitGet(FTPClient.java
:1833)
at com.enterprisedt.net.ftp.FTPClient.getData(FTPClient.java:1757)
at com.enterprisedt.net.ftp.FTPClient.get(FTPClient.java:1650)
at com.bsnnms.servlet.ftp.FtpDownload.doGet(FtpDownload.java:76)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:971)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:402)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
at com.bsnnms.pub.FilterPrivilege.doFilter(FilterPrivilege.java:59)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
at com.bsnnms.pub.FilterSecurity.doFilter(FilterSecurity.java:104)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6356)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3635)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2585)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
I need help,thanks