導航:首頁 > 配伺服器 > 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伺服器如何允許下載相關的資料

熱點內容
卡爾曼濾波演算法書籍 瀏覽:768
安卓手機怎麼用愛思助手傳文件進蘋果手機上 瀏覽:843
安卓怎麼下載60秒生存 瀏覽:802
外向式文件夾 瀏覽:235
dospdf 瀏覽:430
怎麼修改騰訊雲伺服器ip 瀏覽:387
pdftoeps 瀏覽:493
為什麼鴻蒙那麼像安卓 瀏覽:735
安卓手機怎麼拍自媒體視頻 瀏覽:185
單片機各個中斷的初始化 瀏覽:723
python怎麼集合元素 瀏覽:480
python逐條解讀 瀏覽:832
基於單片機的濕度控制 瀏覽:498
ios如何使用安卓的帳號 瀏覽:882
程序員公園采訪 瀏覽:811
程序員實戰教程要多長時間 瀏覽:974
企業數據加密技巧 瀏覽:134
租雲伺服器開發 瀏覽:813
程序員告白媽媽不同意 瀏覽:335
攻城掠地怎麼查看伺服器 瀏覽:600