Home > front end >  Java download when submitted to the Software under caused connection abort: socket write error to so
Java download when submitted to the Software under caused connection abort: socket write error to so

Time:04-07

Page with ajax requests to the backend, below is the back-end code:
@ RequestMapping ("/download ")
Public void the download (it request, HttpServletResponse response) throws the Exception {

The String fileName=request. The getParameter (" fileName ");
FileName=java.net.URLDecoder.decode (fileName, "utf-8");
String root=request. GetSession (). GetServletContext () getRealPath (" ") + "/file";//download address
The File File=new File (root, the File. The separator + fileName);
DownFile (response, fileName. The substring (fileName. LastIndexOf ("/") + 33), the file).

}


/* *
* on March 20, 2018
* to download file to the local elimination of file names in Chinese garbled
* @ param response
* @ param downFileName
* @ param file
* @ throws the Exception
*/
Public void downFile (HttpServletResponse response, String downFileName,
The File File) throws the Exception {
If (the file. The exists ()) {//file exists
response.setContentType("application/force-download"); Don't open//set the mandatory download
The response. SetCharacterEncoding (" utf-8 ");
The response. AddHeader (" the Content - the Disposition ", "legislation; FileName="
+ downFileName);//set the file name
byte[] buffer=new byte[1024];
FileInputStream fis=new FileInputStream (file);
BufferedInputStream bis=new BufferedInputStream (fis);
OutputStream OS=response. GetOutputStream ();
Int I;
While ((I=bis. Read ())!=1) {
OS. Write (buffer, 0, I);
OS. The flush ();
}
bis.close();
fis.close();
}
}


And then the error message:
[the 2018-03-22 13:57:30, 882] SG - UAP: ERROR RestExceptionResolver: 141 - ClientAbortException: java.net.SocketException: Software under caused connection abort: socket write ERROR
The at org. Apache. Catalina. Connector. OutputBuffer. DoFlush (OutputBuffer. Java: 319)
The at org. Apache. Catalina. Connector. OutputBuffer. Flush (OutputBuffer. Java: 288)
The at org. Apache. Catalina. Connector. CoyoteOutputStream. Flush (CoyoteOutputStream. Java: 98)
At com. Ljdy. Construction. Fzys. Ys_sgzlController. DownFile (Ys_sgzlController. Java: 271)
At com. Ljdy. Construction. Fzys. Ys_sgzlController. Download (Ys_sgzlController. Java: 244)
At sun. Reflect. NativeMethodAccessorImpl. Invoke0 (Native Method)
At sun. Reflect. NativeMethodAccessorImpl. Invoke (NativeMethodAccessorImpl. Java: 39)
At sun. Reflect. DelegatingMethodAccessorImpl. Invoke (DelegatingMethodAccessorImpl. Java: 25)
The at Java. Lang. Reflect. Method. Invoke (597) Method. The Java:
The at org. Springframework. Web. Method. Support. InvocableHandlerMethod. Invoke (InvocableHandlerMethod. Java: 213)
The at org. Springframework. Web. Method. Support. InvocableHandlerMethod. InvokeForRequest (InvocableHandlerMethod. Java: 126)
The at org. Springframework. Web. Servlet. MVC) method. The annotation. ServletInvocableHandlerMethod. InvokeAndHandle (ServletInvocableHandlerMethod. Java: 96)
The at org. Springframework. Web. Servlet. MVC) method. The annotation. RequestMappingHandlerAdapter. InvokeHandlerMethod (RequestMappingHandlerAdapter. Java: 617)
The at org. Springframework. Web. Servlet. MVC) method. The annotation. RequestMappingHandlerAdapter. HandleInternal (RequestMappingHandlerAdapter. Java: 578)
The at org. Springframework. Web. Servlet. MVC. Method. AbstractHandlerMethodAdapter. Handle (AbstractHandlerMethodAdapter. Java: 80)
At com. SGCC. Uap. Kernel. Spring. ModuleWebDispatcher. DoDispatch (ModuleWebDispatcher. Java: 211)
The at org. Springframework. Web. Servlet. DispatcherServlet. DoService (DispatcherServlet. Java: 852)
The at org. Springframework. Web. Servlet. FrameworkServlet. The processRequest (FrameworkServlet. Java: 882)
The at org. Springframework. Web. Servlet. FrameworkServlet. DoPost (FrameworkServlet. Java: 789)
The at javax.mail. Servlet. HTTP. HttpServlet. Service (HttpServlet. Java: 637)
The at javax.mail. Servlet. HTTP. HttpServlet. Service (HttpServlet. Java: 717)
At com. SGCC. Uap. Kernel. Web. Adaptor. ModuleServletAdaptor. Service (119) ModuleServletAdaptor. Java:
The at javax.mail. Servlet. HTTP. HttpServlet. Service (HttpServlet. Java: 717)
At com. SGCC. Uap. Kernel. Httpservice. Internal. ServletRegistration. DoHandleRequest (ServletRegistration. Java: 170)
At com. SGCC. Uap. Kernel. Httpservice. Internal. AbstractRegistration. HandleRequest (58) AbstractRegistration. Java:
At com. SGCC. Uap. Kernel. Httpservice. Internal. ProxyServlet. The processRequest (ProxyServlet. Java: 345)
At com. SGCC. Uap. Kernel. Httpservice. Internal. ProxyServlet. Service (175) ProxyServlet. Java:
The at javax.mail. Servlet. HTTP. HttpServlet. Service (HttpServlet. Java: 717)
Ats com. SGCC. Uap. Kernel.. Web server UapModuleContextServlet. Service (158) UapModuleContextServlet. Java:
The at javax.mail. Servlet. HTTP. HttpServlet. Service (HttpServlet. Java: 717)
The at org. Apache. Catalina. Core. ApplicationFilterChain. InternalDoFilter (ApplicationFilterChain. Java: 290)
The at org. Apache. Catalina. Core. ApplicationFilterChain. DoFilter (ApplicationFilterChain. Java: 206)
At com. SGCC. Uap. Kernel.. Web server UapModuleContextFilter $FilterChainImpl. DoFilter (UapModuleContextFilter. Java: 196)
At com. SGCC. Uap. Health. Filter. UrlMonitorFilter. DoFilter (UrlMonitorFilter. Java: 79)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related