級互聯(lián)網(wǎng)服務(wù)客戶數(shù)據(jù)統(tǒng)計分析系統(tǒng)_第1頁
級互聯(lián)網(wǎng)服務(wù)客戶數(shù)據(jù)統(tǒng)計分析系統(tǒng)_第2頁
級互聯(lián)網(wǎng)服務(wù)客戶數(shù)據(jù)統(tǒng)計分析系統(tǒng)_第3頁
級互聯(lián)網(wǎng)服務(wù)客戶數(shù)據(jù)統(tǒng)計分析系統(tǒng)_第4頁
級互聯(lián)網(wǎng)服務(wù)客戶數(shù)據(jù)統(tǒng)計分析系統(tǒng)_第5頁
已閱讀5頁,還剩64頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

第1章緒 內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)開發(fā)背 該系統(tǒng)解決的主要問 本文的主要工 的組織結(jié) 第2章內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)需求分 內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)概 內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)項目背 內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)項目說 2內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)目標(biāo)和解決的問 內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)目標(biāo) 內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)解決的問題 內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)需求問題描 內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)功能性需 內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)非功能性需 第3章內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)架構(gòu)設(shè) 內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)設(shè)計目標(biāo)和原 整體框 模塊設(shè) 數(shù)據(jù)庫設(shè) 實體E-R 數(shù)據(jù)庫 第4章內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)詳細(xì)設(shè) 界面詳細(xì)設(shè) 各項功能詳細(xì)設(shè) 登錄功 定時收集數(shù)據(jù)并分 查詢用戶列 查詢app總連接 查詢app內(nèi)網(wǎng)ip的總連接 查看app的信 異常日志分 第5章內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)的實現(xiàn)與測 5.1內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)的界面實 登錄頁 查詢頁 查詢異常日志頁 5.2定時數(shù)據(jù)功 5.3查詢列表功 查詢用戶列 查詢App連接數(shù)實 查詢App各內(nèi)網(wǎng)ip連接總數(shù)的實 查詢App詳細(xì)信息資源統(tǒng)計的實 查詢異常日志功能實 Pojo類的實 輔助工具類的實 5.7異常處 tomcat容器不能正常關(guān)閉線程池問 查詢?nèi)掌谳斎敫袷絾?5.8配置信 Mysql配 RedisCluster配 Nginx日志的路徑配 Servlet器的配 LoginFilter器的配 5.9測 第6章結(jié) 致 參考文 附錄1英文原 附錄2譯 云服務(wù)公司統(tǒng)計分析系統(tǒng)設(shè)計與實傳統(tǒng)的公司對于內(nèi)部客戶的數(shù)據(jù)管理往往因為過于龐大的信息量和較為復(fù)進(jìn)而作出合理的導(dǎo)向和判斷針對公司的內(nèi)部業(yè)務(wù)需求SpringMVCwebSpringMVCwebStruts+Spring+HibernateSpringValidatorAJAX,可測試性強,同時新增功能易于嵌入框架,代碼的可性和系統(tǒng)的可擴展性也隨之提高此外內(nèi)部數(shù)據(jù)統(tǒng)計分析系統(tǒng)的開發(fā)完成在應(yīng)用層面來說也解決了公司對于數(shù)據(jù)的分類管理和信息的統(tǒng)計分析問題為公司定下下一步方向和做出性決策奠定了有效的理論依據(jù)另外也關(guān)鍵字:數(shù)據(jù)統(tǒng)計分析系統(tǒng);SpringMVC;Thetraditionalcompanyforinternalcustomerdatamanagementisoftenbecauseitistoohugeamountofinformationandamorecomplexlogicassociatedwiththedata,andhadtospendalotofhumanandfinancialresourcestocollatestatisticalysisinordertodrawvalidconclusions,andthenmakeareasonablethestrategicorientationandjudgment.Forthecompany'sinternalbusinessneeds,theneedforthecompany'strafficmanagement,userinformation,products,architecture,securityotherservicesrelatedtostatisticsanddisplaythemtothepageintheformofvisualdiagrams,weusetoquicklydesignbasedonSpringMVCframeworkwebsystemsdevelopmentsolutionstocompletionoftheinternaldataysissystem.Finally,theactualresultsshowthatusingSpringMVCframeworktobuildwebprojectscomparedtothemoretraditionaluseofStruts+Spring+Hibernateframework,onlyprovidesaneasy-to-useandflexibleandstabledevelopmentframeworkthatgreatlysimplifiesthedevelopmentcycle,directlyimproveourdevelopmentefficiency,anditsseamlessintegrationwithSpring,learninglowcost,highlyintegratedValidatorandAJAX,testabilityandstrong,andeasytoembedtheframeworkofthenewfeatures,codemaintainabilityandscalabilityofthesystemalsoincreases.Inaddition,thedevelopmentofinternaldataysissystemtocompletetheapplicationlevel,butalsosolvethecompany'smanagementandinformationfortheclassificationstatisticalysisofdata,andestablishesaneffectivetheoreticalbasisforthecompanytosetthedirectionofthenextstepandmakestrategicdecisionsinadditionthecompanyalsoprovidesdeveloperswithagoodcaseofinternaldataysissystemprojectforthedevelopmentofsimilarcompaniesneedtomanagetheprojectonceagainprovideareferencetemplate.:statisticalysissystem;SpringMVC;dataysis;1內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)開發(fā)背該系統(tǒng)解決的主要問,門,或者是整合數(shù)據(jù)僅此而已地是管理分析功能。有效的數(shù)據(jù)整合相當(dāng)于,本文的主要的組織2內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)需求分1內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)概內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)項目背excel表格中,再高級點的過程可能就將數(shù)據(jù)公司的app信息就繁多冗雜,這里包括用戶的如用戶id,,手機號,公司名稱,所使用的app信息如appId,最近使用的流量,app的總數(shù),內(nèi)網(wǎng)的ip數(shù)等,出于上述目的,公司安排我進(jìn)行項目的開發(fā),對數(shù)據(jù)內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)項目說ringmcbStruts框架相比,使用該框架是因為其簡單、靈活、快速上手、直接好處是使事件響應(yīng)中的各個組成部分都模塊化,只負(fù)責(zé)自己的邏輯業(yè)Orvicejspjscss總的來說就是如下圖:圖2-1用戶的瀏覽器發(fā)出一個請求經(jīng)過DispathServlet處理將請求根據(jù)url映射到controller上處理,controller再根據(jù)請求的需要去進(jìn)行數(shù)據(jù)庫的查js,css返回到瀏覽器,由瀏覽器直接2內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)目標(biāo)和解決的問內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)目標(biāo)對新的用戶進(jìn)行一個有效的信息統(tǒng)計并以表格形式展現(xiàn)對服務(wù)端系統(tǒng)中總體的app連接數(shù)進(jìn)行定時統(tǒng)計并繪制圖表反映對服務(wù)端系統(tǒng)中總體的app的內(nèi)網(wǎng)ip連接數(shù)進(jìn)行定時統(tǒng)計并繪制app對nginx反向服務(wù)器的日志進(jìn)行分析內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)解決的問題來源類似,UserAgent都一樣,并且該行為集中在某個時間區(qū)間。app所有的總的連接數(shù),可以根據(jù)以往的時間區(qū)間進(jìn)行趨勢appip的連接數(shù),目的是判斷當(dāng)天某個app進(jìn)行全面的分析,可以理解為判斷用戶的行為,以便我們內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)需求問題描內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)功能性需1.源源數(shù)據(jù)服定務(wù)端程信息日志圖2- 系統(tǒng)原理框架設(shè)計系統(tǒng)的定時程序定時向源數(shù)據(jù)請求數(shù)據(jù),在定時程序中經(jīng)過處理再請客戶端向服務(wù)端發(fā) 請發(fā)送發(fā)送發(fā)送內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)非功能性需第3章內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)架構(gòu)設(shè)1內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)設(shè)計目標(biāo)和系統(tǒng)采用基于springMVCweb框架區(qū)別于傳統(tǒng)的web框架,springMVC2整體框mysqlspringMVCjsp負(fù)責(zé),其中可以在jsp中放置某些jscss使得頁面更加美觀,邏輯控制部分由controllercontrollermodeldaoservicecontrollerservice對象進(jìn)行各種邏輯的操作,而在service中又進(jìn)行dao層的數(shù)據(jù)獲取處理。3模塊設(shè)Filter用戶賬圖3- 數(shù)據(jù)庫實體圖3- 模塊設(shè)計4數(shù)據(jù)庫設(shè)E-R數(shù)據(jù)庫用戶信息表用途:用戶賬號信值鍵空用戶是空0個01970-01-1是0是ip圖3- 數(shù)據(jù)庫用戶表用戶用途:用戶個人信鍵否0否0否否號否否否圖3- 數(shù)據(jù)庫用戶表App連接總數(shù)用途:app連接總值鍵否空是0是是0e是1970-01-圖3- 數(shù)據(jù)庫App連接數(shù)表Appip用途:app內(nèi)網(wǎng)ip連接總否空是是0是是0是1970-01-1圖3- 數(shù)據(jù)庫App的ip表App用途:app內(nèi)網(wǎng)ip連接總值鍵否空否否0)否0否0否0否0否0否1970-01-1否1970-01-1圖3- 數(shù)據(jù)庫App信息表第4章內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)詳細(xì)設(shè)1界面詳細(xì)設(shè)App內(nèi)網(wǎng)各ip連接數(shù)查詢頁:請求頁面包含兩個文本輸入框以及一個按ip區(qū)分)。App間,以及ip字段和每頁顯示的條數(shù),可以得到經(jīng)過處理后的nginx日志分析,分析的字段包括host,ip,s,useragent,refer,需要這個頁面的主要目的是防止機的干擾,通過將可疑ip的信息輸入后,觀察分析host,UA和refer信息等等,如果發(fā)現(xiàn)是機行為就直接將該ip進(jìn)行官網(wǎng)的2各項功能詳細(xì)設(shè)登錄功提供了一個過濾器filter,在每次對系統(tǒng)中任意頁面資源進(jìn)行時都必須先進(jìn)行過濾器的請求,只有在器中通過了才允許進(jìn)行請求的正常攔截器圖4- 器流程定時收集數(shù)據(jù)并分定的統(tǒng)計規(guī)則是每5分鐘一次當(dāng)前時刻的兩小時內(nèi)所使用過的app的總連接valueip:<連接數(shù)>javaredisjedis對象進(jìn)行對redis數(shù)據(jù)庫的,但是經(jīng)過查看jedis的文檔,我們發(fā)現(xiàn)jedis并不支hash結(jié)構(gòu)的遍歷,所以決定采取一種迂回的戰(zhàn)術(shù)實現(xiàn)。app信息列表存放在app_stat中,我們可以根據(jù)其中的字段create_time和update_timeappappappappapp和“conn_stat_”進(jìn)行拼接,再根據(jù)需要在java內(nèi)存中轉(zhuǎn)換為我們所需要的數(shù)據(jù)結(jié)構(gòu)以對象的形mysql中,appconn_stat,appip連接數(shù)的表名是查詢用戶列、用戶的賬號信息列表在mysql的r表中字包括賬號名,ip,號碼,時間等,該表的用戶記錄是用戶在賬號(包括第三方如時往該表插入一條記錄客戶端在進(jìn)行請求時只需輸入查詢的起始時間和結(jié)束時間,就可以得到在指定時間區(qū)間內(nèi)的所有用戶的賬號信息、查詢app總連接當(dāng)需要查詢的app總連接數(shù)時,我們只需要直接從conn_stat這張表中conn_stat5分鐘采dayapp連接數(shù)。查詢app內(nèi)網(wǎng)ip的總連接和查詢app的總連接數(shù)類似,當(dāng)需要查詢的app內(nèi)網(wǎng)ip總連接數(shù)務(wù)中我們提到conn_stat_ip這張表是每5分鐘一次各個ip總連接數(shù)而在展表不同的ip,所以,我們只需要根據(jù)表的字段day進(jìn)行篩選即可,另外,在默認(rèn)app各個連接數(shù)。app的信appmysql數(shù)據(jù)庫中的app_stat表中主要有app的流入流量,流出流量,創(chuàng)建時間,更新時間,并且該表中由其他程序記錄每個app的使用情況。app的信息展示主要是四app異常日志分這個模塊在整個統(tǒng)計分析系統(tǒng)中看來似乎是很突兀地存在,但是存在即合理事出必有因在之前公司舉辦相關(guān)門票的活動時我們發(fā)現(xiàn)了機刷票的行為直接現(xiàn)象在M觀察上述用戶信息列表時偶然發(fā)現(xiàn)存在多個來自同一個ip的賬號緊著我們讓運維工作人員查看nginx服務(wù)器日志時發(fā)現(xiàn)在短時間內(nèi)有大量的ip進(jìn)行了這個行為而且其useraget無一例外都是來自這個明顯就是一個java程序直接調(diào)用我們的接口,再有就是refer[-]果是正常的用戶進(jìn)行其refer就是官網(wǎng)的url out/sinup這種形式因此依公司的要求讓我完成這個模塊就可以節(jié)省每次讓運維人員人工查看異常日志信息的時間,M只需要直接輸出異常ip信息和查詢的時間區(qū)間就可以查看該ip的志信息。此外,考慮到異常ip志的信息量可能太大,因此我們增加了選擇了每頁條數(shù)的功能,可以是10條、100條、1000條不等。第5章內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)的實現(xiàn)與測1內(nèi)部數(shù)據(jù)統(tǒng)計分析管理系統(tǒng)的界面實登錄頁否則,任何過賬號的url請求資源都將強制跳轉(zhuǎn)到登錄頁,也就是說,即便你事先知道其他頁面的url,但是你每次進(jìn)行都是無filter的過濾器,filter比如在此項目中驗證session中是否帶有通過登錄驗證后的合規(guī)標(biāo)識,再復(fù)雜點的可以在filter實現(xiàn)類中判斷s的信息以及設(shè)置多個filter讓每個filter進(jìn)行web.xmlfilter,如下圖:配置的filter對應(yīng)的java類是loginFilter,是重寫doFilter()這個方法,主要邏輯是除了css、js、images、這些靜態(tài)資源以外的所有請求,在doFilter中取出session的user字段判斷是否為空為空則讓其重定向跳轉(zhuǎn)到login登錄頁,不為空則說明已經(jīng)是登錄用戶,運行通過請求,代碼如下圖:在login登錄過程中涉及到頁面login.jsp以及對應(yīng)的邏輯控制器1。圖5- 登錄界面查詢頁AppAppipApp各個頁面的大致樣式風(fēng)格都保持一致,都包括導(dǎo)航菜單欄,標(biāo)題,form表單輸入框,作為唯一的區(qū)別在于數(shù)據(jù)可視化呈現(xiàn)的形式,jsp的頁面和功能實現(xiàn)圖5- 用戶查詢列表圖5- App連接數(shù)查詢圖5- App的ip連接數(shù)查詢圖5- App的資源信息統(tǒng)計查詢異常日志頁ipnginxip5.2定時數(shù)據(jù)功,數(shù)據(jù)的過程發(fā)生在程序啟動后的定時器中,和前面描述的一樣信5mysqlredis打交道。,首先我們介紹項目中的定時器,在定時器中主要完成的操作是從mysql的app_stat中獲取近兩個小時的app列表再把獲取到的app列表在redis數(shù)據(jù)庫中mysqlappservicedaojava的內(nèi)存中得到app的連接數(shù)以及app的內(nèi)網(wǎng)ip及連接數(shù)用mapservicedaoappappmysql中的conn_statconn_stat_ip這兩張表中,dao5.3查詢列表功AppAppipAppr234點則是由四個折線圖組成,下面開始詳細(xì)介紹其實現(xiàn)過程以及最終的直觀界面。查詢用戶列r是由用戶的過自動往庫表中插入一條記錄我們只需要根據(jù)輸入itContrllr中需要mysqldaomysqluserLitList<W>tttribut()userLjp。UserListControllerUserListControllerdaouserList.jsp的設(shè)計和其他的jsp的風(fēng)格都統(tǒng)一,左側(cè)是導(dǎo)航菜單欄,右側(cè)是userListformDiscovery。Jsp中從request中取出的用戶列表List<WdUser>以及用于分頁的信息,將List<WdUser>jspjscss,在用到表格的地方只要放置一個<divclass="dataTable_wrapper">,另外在時間輸入框js時間選擇器。.jsp的主要功能負(fù)責(zé)導(dǎo)航菜單欄,userList.jspuserList.jspjsApp連接數(shù)實pjspConnStatControlleConntatContollrdao數(shù)據(jù)庫的接口,從conn_stt這張表獲取符合查詢條件的數(shù)據(jù)列表,然rviceListInteger形式的數(shù)據(jù)以便適應(yīng)在折線圖中的展現(xiàn)。最終ConntContrller返回一個connStatjsp頁面給客戶端呈現(xiàn)。ConnStatControllerservicedaoList<Integer>元素代表一天的最高連接數(shù),service接口代碼的實現(xiàn)如下:daomysqlgroupdaoList<Integer>只是滿足了折線縱軸,而折線圖的橫軸日期同樣需要一個List<String>作為輸入。因此我們需要一個函數(shù)將日期轉(zhuǎn)換成List<String>,代碼實現(xiàn)如下:conn_stat.jsp中需要表格的展示和折線圖的展示,需要在jsp中獲取到ConnStatController傳遞的參數(shù)數(shù)據(jù)列表List<Integer>finalList和日期列表List<String>daist,conns_stat.jsp的主要代碼實現(xiàn)如下:conns_stat.jsp的折線圖需要highchart.js,實現(xiàn)的代碼如下Appip連接總數(shù)的實App各內(nèi)網(wǎng)的ipApp總連接數(shù)列表的形式類似,代碼框架同樣分為負(fù)責(zé)視圖層的jsp和負(fù)責(zé)邏輯控制層的ConnStatController。客戶端瀏覽器發(fā)出查詢請求,ConnStatController中接受到請求并進(jìn)行參數(shù)的解析,調(diào)用dao層mysql數(shù)據(jù)庫的接口,從conn_stat_ip這張表中獲取符合查詢條件的數(shù)據(jù)列表,然后service層中對數(shù)據(jù)列表進(jìn)行數(shù)據(jù)結(jié)構(gòu)的形式轉(zhuǎn)化,與app總連接數(shù)不同的是,這里需要將數(shù)據(jù)集合轉(zhuǎn)化成一個Map<String,List<Integer>>形式的數(shù)據(jù),Mapkeyipvalue是一個存數(shù)量的List,以便適應(yīng)在折線圖中的展現(xiàn),最終ConnStatController返回一個connStatIp.jsp頁面給客戶端呈現(xiàn),其代碼實現(xiàn)和上一章節(jié)的查詢總連接數(shù)類似,查詢App詳細(xì)信息資源統(tǒng)計的實查詢App的詳細(xì)信息資源統(tǒng)計的實現(xiàn)原理與上面列表查詢方式大同小異,mysql數(shù)據(jù)庫中的表app_statjava的內(nèi)存中進(jìn)行數(shù)據(jù)結(jié)構(gòu)的轉(zhuǎn)換,StatsController其中負(fù)責(zé)邏輯處理的部分需要將從mysql中查詢的數(shù)據(jù)進(jìn)行格式的轉(zhuǎn)換分4個折線圖中,主要代碼如下:daomysqlstats.jspangularJS對數(shù)據(jù)進(jìn)行雙向綁定,angularJSstat.jscontroller射到頁面中,stat.jsstat.jspangular查詢異常日志功能實ipnginx日志并進(jìn)行分析,這里和前面的功能模塊都不一樣,我們的數(shù)據(jù)源不是mysql了,而成為了服務(wù)器上的nginx日志,日志的存放形式是按天存放,比如 在日志文件時,我們編寫了一個類r來行javaio處理,為了避免內(nèi)存占用過大日志文件的內(nèi)存設(shè)置為5M并且每次按行邏輯處理,rlogReader()在service邏輯控制層我們可以進(jìn)行調(diào)用DataReader的logReader()方法,然后封裝在QueryIpBehaveController此外QueryIpBehaveController需要負(fù)責(zé)對于輸ip的格式是否正確。ServiceQueryIpBehaveControllerqueryIp.jspcontroller中生成的數(shù)據(jù)信息列List<UserBehaveInfo>jsp的頁面中即可.Pojo類的實java類來不同的對象,下面進(jìn)行一一介紹,順序和上一章的各個模塊保持一致用 用戶的賬號信用于app的id值,其他屬性未來可以擴AppAppipAppappId輔助工具類的實ipList用于收集 數(shù)據(jù)的定時7異常處tomcat容器不能正常關(guān)閉線程池問在項目在公司的實際運行過經(jīng)常發(fā)現(xiàn)tomcat不能很好的關(guān)閉并且安全地退出,時有進(jìn)程號還存在不能退出的情況,經(jīng)過對tomcat下的系統(tǒng)日志catalina.out以及對殘留進(jìn)程號使用jstack追蹤可知是由于非守護(hù)線程不能安全退JVM中,只有所有的非守護(hù)線程退出了守護(hù)線程才能退出,如果存在至少一個守護(hù)線程則會導(dǎo)致內(nèi)存溢出,JVM不能正常關(guān)閉。因此,為了解決timerdestroytimer安全退出了。主要的代碼如下:查詢?nèi)掌谳斎敫袷絾?016-05-12,否則程序?qū)o法識別請求時間的參數(shù),進(jìn)行報錯處js的5.8配置信Mysql配Mysql使用本地的數(shù)據(jù)庫,主要使用到的數(shù)據(jù)庫有兩個,包括wdcloud和wdstat,在java中配置mysql以便進(jìn)行數(shù)據(jù)庫的連接操作,配置文件主要涉及到RedisCluster配redis3redisredis節(jié)ip和端口,連接數(shù)Nginx日志的路徑配要在java中使用日志的查詢功能,必須讓java程序到日志的存放路徑文件Java的日志文件的類是Servlet器的配Servlet器的作用是在整個項目啟動時初始化Servlet和項目退出時關(guān)閉timertimer的LoginFilter器的配面前必須通過登錄頁認(rèn)證能,filter便是解決這個問題的關(guān)鍵,只要我們配置了filter就可以使其全局的所有頁面并進(jìn)行一個的校驗,只有通過認(rèn)證才允許其他頁面,以下是filter的配置:5.9測對于測試的環(huán)節(jié)采用白盒測試以及黑盒測試這兩種主要的方式[13]web項目,httpmochajs測試框架,可以直接http的請求。在登錄頁輸入錯誤的賬號信在登錄頁不輸任何強制重定向到登錄頁登錄后關(guān)閉瀏覽器再進(jìn)入系統(tǒng)其他頁面強制重定向到登錄得到正確時間區(qū)間段內(nèi)的正確用戶列輸入錯誤的時間區(qū)輸入錯誤的時間格式App輸入錯誤的時間區(qū)程序自動將先后時App輸入錯誤的時間格式App內(nèi)網(wǎng)ip連接總數(shù)輸入錯誤的時間區(qū)程序自動將先后時App內(nèi)網(wǎng)ip輸入錯誤的時間格式Nginx輸入錯誤的時間區(qū)程序自動將先后時Nginx輸入錯誤的時間格式NginxipNginx10、100、1000作為每頁分頁響應(yīng)頁面每頁對應(yīng) 條AppAppapp第6結(jié)分析系統(tǒng)已實現(xiàn)預(yù)期目的,實現(xiàn)了登錄、用戶信息查詢、app連接數(shù)查詢、appip連接數(shù)查詢、nginx異常日志查詢等功能,并在實現(xiàn)以上功能的基礎(chǔ)jav能性需求考慮不夠,系統(tǒng)實現(xiàn)的細(xì)節(jié)以及算法還有優(yōu)化空間致參考文[1]深入理解Java虛擬機:機械工業(yè)BruceEckel Joshua Effectivejava中文 Budi Servlet和JSP學(xué)習(xí)指 :機械工業(yè)構(gòu)建高性能Web站點(修訂版):電子工業(yè),2012鳥哥鳥哥的Linux私房菜基礎(chǔ)學(xué)習(xí)篇(第三版):人民郵電Patton·R軟件測試(第2版 :機械工 ,科Java技術(shù)卷1基礎(chǔ)知識(第9版):機謝計算機網(wǎng)絡(luò)(第6版):電子工業(yè)百科()黑盒測百科()RFC2616.RFC機BaronSchwartz,PeterZaitsev,VadimTkachenko,JeremyD.Zawodny,ArjenLent,DerekJ.Ballin 1英文原ADevelopmentFrameApplicationBasedontheHibernate、theStrutsandtheSpringJ2EEOneprefacealongwiththeJavatechniqueofgradualmatureandperfect.Beestablishmentbusinessenterpriseclassapplicationofstandardterrace,theJ2EEterracegotsubstantialofdevelopment.SeveraltechniqueaskedforhelpfromtoincludeintheJ2EEnorm:EnterpriseJavaBean(EJB),JavaServlets(Servlet),JavaServerPages(JSP),JavaMessageService(JMS)etc.,developmentmanyapplicationsystem.But,alsoappearedsomeprobleminthetraditionJ2EEtheapplicationofthedevelopmenttheprocess:theantinomyofofdatamodelandlogicmodel.Currentlythedatabaseofusagebasicallyandallisrelationtypedatabase,buttheJavabeessentiallyakindofthelanguagewhichfacetoobject,objectatsavingwithreadusageSQLandJDBCcarryonadatabaseoperationandloweredplaitdistanceofefficiencyandsystemofcanmaintenance;traditionofJ2EEapplicationmuchtheadoptionisaccordingtotheEJBheavyweightframe,thiskindofframesuitablefordevelopalargebusinessenterpriseapplication,butusagetheEJBcontainercarryondevelopmentandadjusttotrytoneedtobewasteagreatdealoftime.ForloweringtheOuofcodetomatchsex,exaltationsystemofdevelopmentefficiency,thistextputforwardonekindEEaccordingtotheJ2oftheStrutsframe、theHibernateframeandtheSpringframeapplicationdevelopmentstrategy.TheHibernateData'sholdingoutforlongtimelayerandHibernateisonepieceaccordingtoholdoutforlongtimelayerframe,isakindofrealizationobjectandrelationofthetoolwhichreflecttoshoot(O/RMap),itcarriedontheobjectofthelightweighttopacktotheJDBCandmakeproceduremembercanusageobjectplaitthoughttooperationdatabase.ItnotonlyprovidedtoshootfromJavatoreflectofdataform,butalsoprovidedadataasearchandinstaurationmechanism.OppositeinusageJDBCandSQLtooperationdatabase,useHibernateabilityconsumedlyofexaltationrealizationofefficiency.TheHibernateframeuseallocationoftheformcometothereflectofthedefinitionJavaobjectanddataformtoshootrelation,inthemeatmoredeepoflevelofdataformofrelationexplanationfortherelationssuchasinheritofandcontainmentetc.ofJavaobject.PasstheusageHQLlanguagesentencecomplicationsofrelationthecalculatewayusethewayofobjectdescription,toalargeextentsimplificationlogarithmsaccordingtoofsearch,speeddevelopmentofefficiency.HaveintheHibernateasimplebutkeeptheAPIview,usedfortothedatabasemeanofobjectperformancesearch.Wanttoestablishorthemodificationbetheseobjects,needintheprocedurecarryonwiththemtohandoverwitheachother,thenlHibernatetokeep.So,agreatdealofpackholdoutforlongtimeturnoperationofbusinesslogicnolongerdemandwriteatrivialJDBClanguagesentence,makedatalastlongthusthelayergotbiggestofsimplification.UsetheStrutsrealizationMVCstructureMVC(Model-View-Controller)isputforwardbytheTrygveReenskaug,firstdriveapplicationintheenvironmentSmallTalk-80,ismanytohandoverwitheachotherwithinterfacesystemofconstitutefoundation.Accordingtotheneedofvariableoftheinterfacedesign,MVChandoverwitheachotherconstituteofsystemtoresolveintomodelandseediagram,controllerthreepart.Model(Model)issoftwareprocessingproblemlogicatindependenceinoutsidemanifestationundercontentsandformcircumstanceof,packedthecoredata,logicofproblemandfunctionofcalculationrelation,independenceinconcreteofinterfaceexpressionandI/Ooperation.Seediagram(View)meaninformationandparticularformdemonstrationofmodeldataandlogicrelationandappearancetothecustomer.Itacquireamanifestationinformationfromthemodel,therecanbemanyforhomologyofinformationdissimilarityofmanifestationformorseediagram.Thecontroller(Controller)isaprocessingthecustomerhandoverwithsoftwarewitheachotheroperationof,itsjobiscontrolprovidemodelinanyvarietyofdissemination,insureacustomeramongthemodelofrightnessshouldcontact;Itacceptacustomerofimportation,give°theimportationfeedbackmodel,thenrealizationcomputemodelcontrol,ismakemodelandseediagramtomoderateworkofparts.Usually1seeadiagramrightnessshouldacontroller.Model,seeseparateofdiagramandcontroller,makeamodelbeabletohavemanymanifestationtoseediagram.Ifthecustomerpassacertainseethecontrollerofdiagramchangethedataofmodel,allotherdependenceintheseseeofdatadiagramallshouldreflectionarrivethesevariety.Whenthereforeandregardlessoccurrencewhatdatavariety,controllerallwouldvarietynoticeallyseediagram,causemanifestationofrenewal.Thisisactuallyakindofvarietyofmodel-disseminationmechanism.TheStrutsTheStrutsframeistobetheitemofApacheJakartatoconstituteparttopublishlucktodoattheearlieststage,itinheritedMVCofeachitemcharacteristic,anddidaccordingtothecharacteristicsofJ2EEcorrespondofvarietywithexpand.TheStrutsframewasgoodtocombineJsp,JavaServlet,JavaBean,Taliaetc.technique.IntheStruts,whattoundertakethecontrollerroleintheMVCbeanActionServlet.TheActionServletisaningeneralusecontrolmodule.ThiscontrolmoduleprovidedaprocessingallHTTPclaimwhichsendoutStrutsofentrancepoint.Itsinterceptionwithdistributetheseclaimtoarrivecorrespondofactiontype.(theseactionalloftypeisActionsontype)MoreoverthecontrolmoduleisalsoresponsibleforusingtocorrespondofclaimtheparameterfillActionForm(FromBean),andpassactiontype(ActionBean).Actiontypethebusinesslogicoftheinterviewcore,theninterviewJavaBeanoradjusttouseEJB.Endactiontypecontrolthepowerpassfollow-upJSP,fromJSPbornseediagram.AllthesecontrollogicmakeuseofStruts-config.xmlthecometoallocation.SeediagramintheStrutsframemainfromJSPbornpagecompletion,theStrutsprovideabundantofJSPlabeldatabase,thisisadvantageoustoseparatingperformancelogicandprocedurelogic.Themodeliswith1ortheformexistenceofseveralJavaBean.IntheStruts,mainexistencethreekindsofBean,respectivelyBE:Action,ActionForm,EJBperhapsJavaBean.TheStrutsframehavenoconcretedefinitionmodellayerrealization,inactuallythedevelopment,modellayerusuallyisclosewithbusinesslogicconnectwitheachother,andwanttocarryonoperationtothefirstfloordata.Theunderneath'sintroductionisakindofdevelopmentstrategy,leadtheHibernateintothemodellayerofStrutsframe,usageittocarryonadatatopackwithreflecttoshoot,provideholdoutforlongtimeturnofsupport.4usageHibernateandtheStrutsdevelopmentJ2EEapplication4.1systemstructurediagram3manifestationaccordingtoHibernateandStrutsdevelopmentstrategyofsystemstructurediagram.theSpringSpringisn'tparticularlyawebframeworkbutagenericlightweightapplicationframeworkwithdedicatedwebsupport,andshowthearchitecturaldifferencestoStrutsandWebWorkIncontrasttoStrutsorWebWork,Springisanapplicationframeworkforalllayers:Itoffersabeanconfigurationfoundation,AOPsupport,JDBC transactionsupportetc.Itisaverynon-intrusiveeffort:YourapplicationclassesdonotneedtodependonanySpringclassesifnotnecessary,andyoucanreuseeverypartonitsownifyouliketo.Fromitsverydesign,theframeworkencouragescleanseparationoftiers,mostimportantlywebtierandbusinesslogic.e.g:thevalidationframeworkdoesnotdependonwebcontrollers.Majorgoalsarereusabilityandtestability:Unnecessarycontainerorframeworkdependenciescanbeconsideredavoidableevils.Ofcourse,Spring'sownwebsupportisnicelyintegratedwiththeframework'sgeneralpatterns.Nevertheless,replacingthewebsolutionwithStruts,WebWork,orthelikeiseasy.BothwithSpring'swebsupportoradifferentone,Springallowsforbuildingatruededicatedmiddletierinthewebcontainer,withtheoptiontoreuseexactlythesamebusinesslogicintestenvironmentsorstandaloneapplications.AndwithinJ2EE,yourbusinesslogicwillnotunnecessarilydependoncontainerserviceslikeJTAorEJB-allowingcomplex,well-architectedwebapplicationstorunina"simple"containerlikeTomcatorResin.NotethatSpringdoesn'tgenerallyaimtocompetewithexistingsolutions.ItratherfostersseamlessintegrationwithstandardslikeServlet,JSP,JTA,JNDI,JDBC,andJDO,andwell-suitedtoolslikeHibernate,Velocity,Log4J,andCaucho'sHessian/Burlap.Theframeworkisdesignedtogrowwiththeneedsofyourapplications,intermsoftechnologychoice:Forexample,youwillprobablyuseJTAviaSpring'sJtaTransactionManagerifyouneeddistributedtransactions-butonlythen,asthereareperfectreplacementsforsingledatabases,likeDataSourceTransactionManagerorHibernateTransactionManager.Spring'swebframeworkisdesignedaroundaDispatcherServletthatdispatchesrequeststohandlers,withconfigurablehandlermaps,viewresolution,andlocaleandthemeresolution.ThedefaulthandlerisaverysimpleControllerinterface,justofferinga"ModelAndViewhandleRequest(request,response)"method.Thiscanalreadybeusedforapplicationcontrollers,butyouwillpreferthe WizardFormController.Applicationcontrollerswilltypicallybesubclassesofthose.Notethatyoucanchooseanappropriatebaseclass:Ifyoudon'thaveaform,youdon'tneedaFormController.ThisisamajordifferencetoStruts.Youcantakeanyobjectascommandorformobject:There'snoneedtoimplementaninterfaceorderivefromabaseclass.Spring'sdatabindingishighlyflexible,e.g.ittreatstypemismatchesasvalidationerrorsthatcanbeevaluatedbytheapplication,notassystemerrors.Soyoudon'tneedtoduplicateyourbusinessobjects'propertiesasStringsinyourformobjects,justtobeabletohandleinvalidsubmissions,ortoconverttheStringsproperly.Instead,it'softenpreferabletobinddirectlytoyourbusinessobjects.ThisisanothermajordifferencetoStrutswhichisbuiltaroundrequiredbaseclasseslikeActionandActionForm-foreverytypeofaction.ComparedtoWebWork,Springhasmoredifferentiatedobjectroles:ItsupportsthenotionofaController,anoptionalcommandorformobject,andamodelthatgetspassedtotheview.Themodelwillnormallyincludethecommandorformobjectbutalsoarbitraryreferencedata.Instead,aWebWorkActioncombinesallthoserolesintoonesingleobject.WebWorkdoesallowyoutouseexistingbusinessobjectsaspartofyourform,butjustbymakingthembeanpropertiesoftherespectiveActionclass.Finally,thesameActioninstancethathandlestherequestgetsusedforevaluationandformpopulationintheview.Thus,referencedataneedstobemodelledasbeanpropertiesoftheActiontoo.Regardingviews:Spring'sviewresolutionisextremelyflexible.AControllerimplementationcanevenwriteaviewdirectlytotheresponse,returningnullasModelAndView.Inthenormalcase,aModelAndViewinstanceconsistsofaviewnameandamodelMap,containingbeannamesandcorrespondingobjects(likeacommandorform,referencedata,etc).Viewnameresolutionishighlyconfigurable,eitherviabeannames,viaapropertiesfile,orviayourownViewResolverimplementation.The modelMapallowsforcomplete ionoftheviewtechnology,withoutanyhassle:BeitJSP,Velocity,oranythingelse-everyrenderercanbeintegrateddirectly.ThemodelMapsimplygetstransformedintoanappropriateformat,likeJSPrequestattributesoraVelocitytemplatemodel.Ifyoudon'twanttouseSpring'swebMVCbutintendtoleverageothersolutionsthatSpringoffers,youcanintegratethewebframeworkofyourchoicewithSpringeasily.SimplystartupaSpringrootapplicationcontextviaitsContextLoaderListener,andaccessitviaitsServletContextattribute(orSpring'srespectivehelpermethod)fromwithinaStrutsorWebWorkaction.Notethattherearen'tany"plugins"involved,thereforenodedicatedintegration:Fromtheviewoftheweblayer,you'llsimplyuseSpringasalibrary,withtherootapplicationcontextinstanceasentrypoint.AllyourregisteredbeansandallofSpring'sservicescanbeatyourfingertipsevenwithoutSpring'swebMVC.Springdoesn'tcompetewithStrutsorWebWorkinthisusage,itjustaddressesthemanyareasthatthepurewebframeworksdon't,frombeanconfigurationtodataaccessandtransactionhandling.SoyouareabletoenrichyourapplicationwithaSpringmiddletierand/ordataaccesstier,evenifyoujustwanttousee.g.thetransaction ionwithJDBCorHibernate.Ifjustfocussingonthewebsupport,someofSpring'suniquefeaturesare:.Clearseparationofroles:controllervsvalidatorvscommandobjectvsformobjectvsmodelobject,DispatcherServletvshandlermapvsviewresolver,etc..PowerfulandstraightforwardconfigurationofbothframeworkandapplicationclassesasJavaBeans,includingeasyin-betweenreferencingviaanapplicationcontext,fromwebcontrollerstobusinessobjectsandvalidators..Adaptability,non-intrusiveness:UsewhateverControllersubclassyouneed(plain,command,form,wizard,multiaction,oracustomone)foragivenscenarioinsteadofderivingfromAction/ActionFormforeverything..Reusablebusinesscode,noneedforduplication:YoucanuseexistingbusinessobjectsascommandorformobjectsinsteadofmirroringtheminspecialActionFormsubclasses..Customizablebindingandvalidation:typemismatchesasapplication-levelvalidationerrorsthatkeeptheoffendingvalue,localizeddateandnumberbinding,etcinsteadofString-onlyformobjectswithmanualparsingandconversiontobusinessobjects.Customizablehandlermap,customizableviewresolution:flexiblemodeltransfervianame/valuehandlermapandviewresolutionstrategiesfromsimpletosophisticatedofonesingleWithintheJ2theEEtheapplicationverywidespreadcustomerregisterprocessforexample,elucidationabove-mentionedsystemstructureishowconcreteusage.Theproces

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論