導航:首頁 > 配伺服器 > 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 瀏覽:430
阿里雲域名綁定香港伺服器 瀏覽:549
java文本文件壓縮 瀏覽:531
心靈解壓大笑視頻 瀏覽:600
東學西學單片機 瀏覽:671
phpstudy做伺服器如何使用 瀏覽:950
平板怎麼下載安卓國服 瀏覽:775
源碼時代找不到工作會退錢嗎 瀏覽:214
如何app搭建伺服器 瀏覽:846
javastringblob 瀏覽:297
王瑤pdf 瀏覽:859
開掛軟體顯示請連接伺服器地址 瀏覽:917
蘋果怎麼下載安卓倩女 瀏覽:586
vip藍光視頻解析網站源碼 瀏覽:942
伺服器ps1ps2是什麼意思 瀏覽:858
seo命令 瀏覽:869
可代理雲伺服器 瀏覽:973
本地伺服器連接失敗是什麼意思 瀏覽:868
華為平板如何將應用app分身 瀏覽:899
微信顯示無法連接到伺服器1302什麼意思 瀏覽:627