<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      比如現在在后端生成一個.sql文件并下載到當前瀏覽器:比如我的后端接口是localhost:8087/user/userController/exportSql,

      前端地址是localhost:9095/user#。

      一、前端:

      <el-button @click="getSql()">導出</el-button>
      
      var url = process.env.BASE_API
      url += '/userController/exportSql?userId=' + userId
      window.open(url)

      注意這里url不能是/user/userController/expoerSql,因為window.open,會把/當成前端的頁面地址,而不是后端。 

      二、后端:

      /**
      	 * 導出SQL
      	 */
          @ResponseBody
      	@RequestMapping("/exportSql")
      	public HttpResult exportSql(String userId,HttpServletResponse response){
      		try {
      			
      			response.reset();
      		    response.setContentType("text/plain");  
      	        response.addHeader("Content-Disposition",  
      	                "attachment;filename=測試user.sql");
      	        BufferedOutputStream buff = null;  
      	        StringBuffer write = new StringBuffer();  
      	        String enter = "\r\n";  
      	        ServletOutputStream outSTr = null;  
      	        try {  
      	            outSTr = response.getOutputStream();
      	            buff = new BufferedOutputStream(outSTr);  
      	            //拼接SQL
      	            write.append("內容為"+userId);	      
      	            buff.write(write.toString().getBytes("UTF-8"));  
      	            buff.flush();  
      	            buff.close();  
      	        } catch (Exception e) {  
      	            e.printStackTrace();  
      	        } finally {  
      	            try {  
      	                buff.close();  
      	                outSTr.close();  
      	            } catch (Exception e) {  
      	                e.printStackTrace();  
      	            }  
      	        }  
      	        
      			return HttpResult.getSuccessInstance();
      		} catch (Exception e) {
      			logger.error("導出SQL:" + e.getMessage(), e);
      			return HttpResult.getFailedInstance("生成SQL失敗");
      		}
      		
      	}
      }
      

        如果是視頻,修改為:

      response.setContentType("video/mpeg4");
                  response.addHeader("Content-Disposition",
                          "attachment;filename="+ossResourcesInfo.getName());  

       

      如果要顯示文件大小和預計時長,加上下面這段邏輯

      InputStream inputStream = urlConnection.getInputStream();
       response.setHeader("Content-Length", ""+contentLength);
      

        

       

      原文:https://blog.csdn.net/w_t_y_y/article/details/95603361

      posted on 2022-01-10 16:57  Sincerity  閱讀(1199)  評論(0)    收藏  舉報

      主站蜘蛛池模板: 伊人色综合久久天天| 午夜成人精品福利网站在线观看| 欧美福利电影A在线播放| 天堂mv在线mv免费mv香蕉| 日韩乱码人妻无码中文字幕视频 | 国产对白老熟女正在播放| 资源在线观看视频一区二区 | 国产精品亚洲二区在线看| 強壮公弄得我次次高潮A片| 国产成人无码精品亚洲| 白山市| 精品久久久久国产免费| 国产一区二区黄色激情片| 国产永久免费高清在线| 色翁荡熄又大又硬又粗又视频| 99网友自拍视频在线| 潮喷失禁大喷水无码| 福利一区二区1000| 国产精品人伦一区二区三| 少妇人妻偷人偷人精品| 桑植县| 激情综合五月网| 国产盗摄xxxx视频xxxx| 国产仑乱无码内谢| 精品国产不卡在线观看免费| 久久久这里只有精品10| 成人国产精品日本在线观看| 在线中文字幕国产一区| 97人人模人人爽人人少妇| 久久综合狠狠综合久久激情| 日日碰狠狠添天天爽五月婷| 亚洲中文字幕av无码区| 狠狠亚洲超碰狼人久久| 久久99精品久久水蜜桃| 影音先锋啪啪av资源网站| 东京热高清无码精品| 国语对白做受xxxxx在线中国| 九九热在线精品视频观看| 普定县| 蜜臀av入口一区二区三区| 国产精品第一页一区二区|