91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 92KB
    文件類型: .zip
    金幣: 2
    下載: 1 次
    發布日期: 2021-06-17
  • 語言: Java
  • 標簽: 掃碼下載??安卓??

資源簡介

手機掃碼同一張二維碼,自動識別手機系統,安卓自動下載App,ios會自動跳轉應用市場。

資源截圖

代碼片段和文件信息

package?com.upload.servlet;

import?java.io.File;
import?java.io.IOException;

import?javax.servlet.ServletConfig;
import?javax.servlet.ServletContext;
import?javax.servlet.ServletException;
import?javax.servlet.http.HttpServlet;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpServletResponse;
import?javax.servlet.http.HttpSession;

public?class?DownloadServlet?extends?HttpServlet?{
static?final?private?String?CONTENT_TYPE?=?“text/html;?charset=GBK“;

//?Initialize?global?variables
public?void?init()?throws?ServletException?{
}

//?Process?the?HTTP?Get?request
public?void?doGet(HttpServletRequest?request?HttpServletResponse?response)
throws?ServletException?IOException?{
response.setContentType(“text/html;?charset=UTF-8“);
HttpSession?session?=?request.getSession();
//?要下載的文件??
//?之所以這樣處理,主要是因為文件名的中文化問題,這樣處理的話,中文文件名也會正常顯??
String?downloadfile?=?new?String((request.getParameter(“downFile“)).getBytes(“iso8859-1“)?“UTF-8“);
//String?downloadfileName?=??new?String((request.getParameter(“downName“)).getBytes(“iso8859-1“)?“UTF-8“);//request.getParameter(“downName“);
String?app=request.getParameter(“app“);
String?downloadfileName=““;
if(“app“.equals(app)){
downloadfileName?=?“改薄App“;
}else{
downloadfileName?=?request.getParameter(“downName“);
}

ServletContext?context?=?getServletContext();
ServletConfig?config?=?getServletConfig();
?
//?獲取要下載文件所在的目錄,這里是對應于服務器上的物理路徑
//?目錄的格式是這樣??
//?根目錄(WEB主目錄所對應的實際物理目錄)
//?+虛擬目錄(下載文件存放的子目錄)
//String?downloadpath?=?context.getRealPath(File.separator)+?config.getInitParameter(“downloadPath“)?+?File.separator;
String?downloadpath?=?context.getRealPath(File.separator);
//?構建下載文件的對??
java.io.File?file?=?new?java.io.File(downloadpath?+?downloadfile);

if(!file.exists()){
response.sendRedirect(“no_file.jsp“);
}else{
//?獲得文件的長??
long?filesize?=?file.length();
//?設置輸出格式
String?fileType=“.“+getFiletype(downloadfile);
String?type=?““;

if(downloadfileName.lastIndexOf(“.“)?!=?-1){
type?=?downloadfileName.substring(downloadfileName.lastIndexOf(“.“)?downloadfileName.length());
}

response.addHeader(“content-type“?“application/x-msdownload;“);
String?title=downloadfileName+fileType;
String?finalFileName=““;
if(type!=null&&fileType.equals(type)){
response.addHeader(“Content-Disposition“?“attachment;?filename=“?+?new?String(downloadfileName.getBytes(“gb2312“)?“iso8859-1“));
}else{
String?agent?=?request.getHeader(“User-Agent“);
boolean?isMSIE?=?(agent?!=?null?&&?agent.indexOf(“MSIE“)?!=?-1);
if(?isMSIE?){
finalFileName?=?java.net.URLEncoder.encode(title“UTF8“);
}else{
finalFileName?=?new?String(title.getBytes(“UTF-8“)?“ISO-8859-1“);
}
response.addHeader(“Content-Disposition“?“attachment;filename=“+finalFileName);
//response.addHeader(“Content-Disposition“?“attachment;?file

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-09-08?17:06??掃描二維碼下載app\
?????文件???????98185??2016-09-08?17:06??掃描二維碼下載app\掃碼下載代碼說明.pdf
?????目錄???????????0??2016-09-08?16:56??掃描二維碼下載app\源代碼\
?????文件????????4496??2016-09-08?13:55??掃描二維碼下載app\源代碼\DownloadServlet.java
?????文件????????2845??2016-09-08?16:45??掃描二維碼下載app\源代碼\download_apk.jsp
?????文件??????????80??2016-09-08?16:56??掃描二維碼下載app\說明.txt

評論

共有 條評論