freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

圖書館管理系統(tǒng)大學(xué)本科畢業(yè)論文-資料下載頁

2025-06-22 20:51本頁面
  

【正文】 據(jù)庫進(jìn)行會話。即使它能夠做到這一點,為了安全上的考慮,我們也不希望讓它這么做。對應(yīng)大多數(shù)其他應(yīng)用程序,也存在類似的問題。因此,我們需要Web中間層從HTTP流中提取輸入數(shù)據(jù),與應(yīng)用程序會話,并將結(jié)果嵌入到文檔中。這個文檔可以用各種格式發(fā)送,包括文本(HTML或XML),二進(jìn)制(GIF圖),甚至可以式建立在其他底層格式之上的壓縮格式,如gzip。但是,到目前為止,HTML式最常用的格式,故而servelt和JSP的重要任務(wù)之一就式將結(jié)果包裝到HTML中。圖11中顯示了一條從Web中間層到客戶端的單箭頭。但是,實際發(fā)送的數(shù)據(jù)有兩種:文檔本身,以及后臺的HTTP信息。同樣,兩種數(shù)據(jù)對開發(fā)來說都式至關(guān)重要的。HTTP響應(yīng)數(shù)據(jù)的發(fā)送過程涉及告知瀏覽器或其他客戶程序所返回文檔的類型(如HTML),設(shè)置Cookie和緩存參數(shù),以及其他類似的任務(wù)。預(yù)先建立的文檔可以滿足客戶的許多請求,服務(wù)器無需調(diào)用Servlet就可以處理這些請求。然而,許多情況下靜態(tài)的結(jié)果不能滿足要求,我們需要針對每個請求生成一個頁面。實時構(gòu)建頁面的理由有很多種:例如,搜索引擎生成的頁面,以及在線商店的訂單確認(rèn)頁面,都要針對特定的用戶請求而產(chǎn)生。在沒有讀取到用戶提交的數(shù)據(jù)之前,我們不知道應(yīng)該顯示什么。要記住,用戶提交兩種類型的數(shù)據(jù):顯示(即HTML表單的數(shù)據(jù))和隱式(即HTTP請求的報頭)。兩種輸入都可用來構(gòu)建輸出頁面。基于Cookie值針對具體用戶構(gòu)建頁面的情況尤其普遍。如果頁面需要根據(jù)每個具體的請求做出相應(yīng)的改變,當(dāng)然需要在請求發(fā)生時構(gòu)建響應(yīng)。但是,如果頁面周期性地改變,我們可以用兩種方式來處理它:周期性地在服務(wù)器上構(gòu)建新的頁面(和客戶請求無關(guān)),或者僅僅在用戶請求該頁面時再構(gòu)建。具體應(yīng)該采用哪種方式要根據(jù)具體情況而定,但后一種方式常常更為方便,因為它只需簡單地等待用戶的請求。例如,天氣預(yù)報或新聞網(wǎng)站可能會動態(tài)地構(gòu)建頁面,也有可能會返回之前構(gòu)建的頁面(如果它還是最新的話)。如果數(shù)據(jù)存儲在數(shù)據(jù)庫中,那么,即使客戶端使用動態(tài)Web內(nèi)容,比如applet,我們依舊需要執(zhí)行服務(wù)器端處理。想象以下,如果一個搜索引擎網(wǎng)站完全使用applet,那么用戶將會看到:“正在下載50TB的applet,請等待!”。顯然,這樣很愚蠢;這種情況下,我們需要與數(shù)據(jù)庫進(jìn)行會話。從客戶端到Web層再到數(shù)據(jù)庫(三層結(jié)構(gòu)),要比從applet直接到數(shù)據(jù)庫(二層結(jié)構(gòu))更靈活,也更安全,而性能上的損失很少甚至沒有。畢竟數(shù)據(jù)庫調(diào)用通常是對速度影響最大的步驟,因而,經(jīng)過中間層可以執(zhí)行高速緩存和連接共享。理論上講,servelt并非只用于處理HTTP請求的Web服務(wù)器或應(yīng)用服務(wù)器,它同樣可以用于其他類型的服務(wù)器。例如,Servlet能夠嵌入到FTP或郵件服務(wù)器中,擴(kuò)展他們的功能。而且,用于會話啟動協(xié)議服務(wù)器的Servlet API最近已經(jīng)被標(biāo)準(zhǔn)化(參見)。但在實踐中,servelt的這種用法尚不流行,在此,我們只論述HTTP Servlet。和傳統(tǒng)CGI及許多類CGI技術(shù)相比,Java servelt效率更高、更易用、更強大、更容易移植、更安全、也更廉價。應(yīng)用傳統(tǒng)的CGI,針對每個HTTP請求都用啟動一個新的進(jìn)程。如果CGI程序自身相對比較簡短,那么啟動進(jìn)程的開銷會占用大部分執(zhí)行時間。而使用Servelt,Java虛擬機(jī)會一直運行,并用輕量級的Java線程處理每個請求,而非重量級的操作系統(tǒng)進(jìn)程。類似地,應(yīng)用傳統(tǒng)的CGI技術(shù),如果存在對同一CGI程序的N個請求,那么CGI程序的代碼會載入內(nèi)存N次。同樣的情況,如果使用Servlet則啟動N個線程,單僅僅載入Servlet類的單一副本。這種方式減少了服務(wù)器的內(nèi)存需求,通過實例化更少的對象從而節(jié)省了時間。最后,當(dāng)CGI程序結(jié)束對請求的處理之后,程序結(jié)束。這種方式難以緩存計算結(jié)果,保持?jǐn)?shù)據(jù)庫連接打開,或是執(zhí)行依靠持續(xù)性數(shù)據(jù)的其他優(yōu)化。然而,Servelt會一直停留在內(nèi)存中(即使請求處理完畢),因而可以直接存儲客戶請求之間的任意復(fù)雜數(shù)據(jù)。Servlet支持常規(guī)CGI難以實現(xiàn)或根本不能實現(xiàn)的幾項功能。Servlet能夠直接于Web服務(wù)器對話,而常規(guī)的CGI程序做不到這一點,至少在不使用服務(wù)器專有API的情況下是這樣。例如,與Web服務(wù)器的通信使得講相對URL轉(zhuǎn)換成具體的路徑名變得更為容易。多個Servelt還可以共享數(shù)據(jù),從而易于實現(xiàn)數(shù)據(jù)庫連接共享和類似的資源共享優(yōu)化。Servelt還能維護(hù)請求之間的信息,使得諸如會話跟蹤和計算結(jié)果緩存等技術(shù)變得更為簡單。 附錄2 英文參考資料Servlet program running in the serverside, dynamically generated Web page with the traditional CGI and many other similar pared to CGI technology, Java Servlet with a more efficient, easier to use, more powerful and has better portability, more savings to invest.Servlets are Java programs that run on Web or application servers, acting as a middle layer between requests ing from Web browsers or other HTTP clients and databases or applications on the HTTP server. Their job is to perform the following tasks, as illustrated in Figure 11.Figure 11  Web middleware roleFigure 11 shows a single arrow going from the client to the Web server (the layer where servlets and JSP execute), but there are really two varieties of data: the explicit data that the end user enters in a form and the behindthescenes HTTP information. Both varieties are critical. The HTTP information includes cookies, information about media types and pression schemes the browser understands, and so on.This process may require talking to a database, executing an RMI or EJB call, invoking a Web service, or puting the response directly. Your real data may be in a relational database. Fine. But your database probably doesn39。t speak HTTP or return results in HTML, so the Web browser can39。t talk directly to the database. Even if it could, for security reasons, you probably would not want it to. The same argument applies to most other need the Web middle layer to extract the results inside a document.This document can be sent in a variety of formats, including text (HTML or XML), binary (GIF images), or even a pressed format like gzip that is layered on top of some other underlying format. But, HTML is by far the most mon format, so an important servlet/JSP task is to wrap the results inside of HTML.Figure 11 shows a single arrow going from the Web middle layer (the servlet or JSP page) to the client. But, there are really two varieties of data sent: the document itself and the behindthescenes HTTP information. Again, both varieties are critical to effective development. Sending HTTP response data involves telling the browser or other client what type of document is being returned (., HTML), setting cookies and caching parameters, and other such tasks. For instance, the results page from search engines and orderconfirmation pages at online stores are specific to particular user requests. You don39。t know what to display until you read the data that the user submits. Just remember that the user submits two kinds of data: explicit (., HTML form data) and implicit (., HTTP request headers). Either kind of input can be used to build the output page. In particular, it is quite mon to build a userspecific page based on a cookie value.If the page changes for every request, then you certainly need to build the response at request time. If it changes only periodically, however, you could do it two ways: you could periodically build a new Web page on the server (independently of client requests), or you could wait and only build the page when the user requests it. The right approach depends on the situation, but sometimes it is more convenient to do the latter: wait for the user request. For example, a weather report or news headlines site might build the pages dynamically, perhaps returning a previously built page if that page is still up to date.In principle, servlets are not restricted to Web or application servers that handle HTTP requests but can be used for other types of servers as well. For example, servlets could be embedded in FTP or mail servers to extend their functionality. And, a servlet API for SIP (Session Initiation Protocol) servers was recently standardized (see ). In practice, however, this use of servlets has not caught on, and we39。ll only be discussing HTTP servlets.Java servlets are more efficient, easier to use, more powerful, more portable, safer, and cheaper than traditional CGI and many alternative CGIlike technologies.With traditional CGI, a new process is started for each HTTP request. If th
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1