導航:首頁 > 配伺服器 > tomcat伺服器如何允許下載

tomcat伺服器如何允許下載

發布時間:2023-06-16 06:21:12

⑴ 如何配置Tomcat伺服器環境

一、安裝JDK和Tomcat

1,安裝JDK:直接運行jdk-7-windows-i586.exe可執行程序,默認安裝即可。

備註:路徑可以其他盤符,不建議路徑包含中文名及特殊符號。

2、安裝Tomcat:直接解壓縮下載文件「apache-tomcat-7.0.33-windows-x86.zip」到C盤下。安裝路徑建議修改為:c: omcat。

備註:如下載的是可執行文件,雙擊運行,默認安裝即可。

android 如何從tomcat伺服器上下載文件

//下載
private InputStream FileDownload(String url_str) throws Exception{

URL url = new URL(url_str);
// 創建連接
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(3000);
conn.setConnectTimeout(3000);
conn.connect();

// 獲取文件大小
length = conn.getContentLength();
// 創建輸入流
InputStream is = conn.getInputStream();

return is;
}
//保存
private void FileSave(String filename,InputStream is,int length) throws Exception{

File file = new File(mSavePath);
// 判斷文件目錄是否存在
if (!file.exists())
{
file.mkdir();
}
File apkFile = new File(mSavePath, filename);
FileOutputStream fos = new FileOutputStream(apkFile);
int count = 0;
// 緩存
byte buf[] = new byte[1024];
// 寫入到文件中
do
{
int numread = is.read(buf);
count += numread;
// 計算進度條位置
progress = (int) (((float) count / length) * 100);
// 更新進度
mHandler.sendEmptyMessage(DOWNLOAD);
if (numread <= 0)
{
// 下載完成
mHandler.sendEmptyMessage(DOWNLOAD_FINISH);
break;
}
// 寫入文件
fos.write(buf, 0, numread);
} while (!cancelUpdate);// 點擊取消就停止下載.
fos.close();
}

/**
* 安裝APK文件
*/
private void installApk()
{
File apkfile = new File(mSavePath, mHashMap.get("name"));
if (!apkfile.exists())
{
return;
}
// 通過Intent安裝APK文件
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse("file://" + apkfile.toString()), "application/vnd.android.package-archive");
mContext.startActivity(i);
}

閱讀全文

與tomcat伺服器如何允許下載相關的資料

熱點內容
什麼音樂app最好 瀏覽:925
牙膏自製解壓神器 瀏覽:325
卸載linuxwps 瀏覽:224
threadjavarunnable 瀏覽:356
一元線性回歸計演算法 瀏覽:946
刷寶app是什麼鬼 瀏覽:740
linux動態載入模塊 瀏覽:21
javamd5工具類 瀏覽:74
安保嘉獎命令 瀏覽:647
bt種子能壓縮嗎 瀏覽:674
JAVA特點是什麼 瀏覽:884
字幕網app怎麼找 瀏覽:531
奧迪a4l壓縮比 瀏覽:696
iis7伺服器怎麼安裝 瀏覽:978
孩子上學壓力太大怎麼解壓 瀏覽:239
javaurl格式 瀏覽:345
勻稱app怎麼用 瀏覽:64
pythonemail中文亂碼 瀏覽:446
android訪問html 瀏覽:91
做一個app或者網頁用什麼編程 瀏覽:779