Http與Servlet工具類

2021-09-02 21:05:14 字數 1752 閱讀 7092

/**

* http與servlet工具類.

* */

public abstract class servletutils

/*** 設定禁止客戶端快取的header.

/*** 設定lastmodified header.

/*** 設定etag header.

/*** 根據瀏覽器if-modified-since header, 計算檔案是否已被修改.

* * 如果無修改, checkifmodify返回false ,設定304 not modify status.

* * @param lastmodified 內容的最後修改時間.

* 根據瀏覽器 if-none-match header, 計算etag是否已無效.

* * 如果etag有效, checkifnonematch返回false, 設定304 not modify status.

* * @param etag 內容的etag.

* 取得帶相同字首的request parameters.

* * 返回的結果的parameter名已去除字首.

*/public static mapgetparametersstartingwith(servletrequest request, string prefix)

while (paramnames != null && paramnames.hasmoreelements()) else if (values.length > 1) else }}

return params;

}/**

* 客戶端對http basic驗證的 header進行編碼.

HTTP 請求 工具類

using system using system.collections using system.collections.generic using system.io using system.net using system.text using system.web namespace i...

http請求工具類

簡單的http請求,短連線,請求完成之後就結束了,post請求 用於key value格式的引數 post請求 用於請求json格式的引數 param url param params return public static string dopost string url,string para...

Http網路請求工具類

獲取網路 字串 param address 後台提供的介面 return string public static string getstringfromnet final string address try catch exception e return response.tostring ...