计算机网络英文版课件:slide 14 The Application Layer – Part 2_第1页
计算机网络英文版课件:slide 14 The Application Layer – Part 2_第2页
计算机网络英文版课件:slide 14 The Application Layer – Part 2_第3页
计算机网络英文版课件:slide 14 The Application Layer – Part 2_第4页
计算机网络英文版课件:slide 14 The Application Layer – Part 2_第5页
已阅读5页,还剩40页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

TheApplicationLayer–Part2ContentsTheWorldWideWeb(Section7.3)TheWorldWideWebIntroductionArchitecturalOverviewStaticWebDocumentsDynamicWebDocumentsHTTP–TheHyperTextTransferProtocolIntroductionTheWorldWideWebisanarchitecturalframeworkforaccessinglinkeddocumentsspreadoutovermillionsofmachinesallovertheInternet.TheWeb(alsoknownasWWW)beganin1989atCERN,theEuropeancenterfornuclearresearch.In1994,CERNandM.I.T.signedanagreementsettinguptheWorldWideWebConsortium(sometimesabbreviatedasW3C),anorganizationdevotedtofurtherdevelopingtheWeb,standardizingprotocols,andencouraginginteroperabilitybetweensites.Theconsortium'shomepageisat

Introduction(2)Fromtheusers'pointofview,theWebconsistsofavast,worldwidecollectionofdocumentsorWebpages,oftenjustcalledpagesforshort.Eachpagemaycontainlinkstootherpagesanywhereintheworld.Theideaofhavingonepagepointtoanother,nowcalledhypertext,wasinventedbyavisionaryM.I.T.professorofelectricalengineering,VannevarBush,in1945,longbeforetheInternetwasinvented.Introduction(3)Pagesareviewedwithaprogramcalledabrowser,ofwhichInternetExplorerandNetscapeNavigatoraretwopopularones.Thebrowserfetchesthepagerequested,interpretsthetextandformattingcommandsonit,anddisplaysthepage,properlyformatted,onthescreen.Stringsoftextthatarelinkstootherpages,calledhyperlinks,areoftenhighlighted,byunderlining,displayingtheminaspecialcolor,orboth.(a)AWebpage(b)Thepagereachedbyclickingon

DepartmentofAnimalPsychology.ArchitecturalOverviewThepartsoftheWebmodel.PagesarenamedusingURLs(UniformResourceLocators).URL(UniformResourceLocators)PagesarenamedusingURLs(UniformResourceLocators).AtypicalURLis

/products.htmlaURLhasthreeparts:thenameoftheprotocol(http),theDNSnameofthemachinewherethepageislocated(),and(usually)thenameofthefilecontainingthepage(products.html).ArchitecturalOverview(2)WebpagesarewritteninastandardizedlanguagecalledHTML,whichdescribesWebpages.Webpagescanalsocontainicons,linedrawings,maps,andphotographs.Eachofthesecan(optionally)belinkedtoanotherpage.NotallpagescontainHTML.ApagemayconsistofaformatteddocumentinPDFformat,aniconinGIFformat,aphotographinJPEGformat,asonginMP3format,avideoinMPEGformat,oranyoneofhundredsofotherfiletypes.Whenaserverreturnsapage,italsoreturnssomeadditionalinformationaboutthepage.ThisinformationincludestheMIME

typeofthepage.TheClientSide(a)Abrowserplug-in.(b)Ahelperapplication.IftheMIMEtypeisnotoneofthebuilt-inones,thebrowserconsultsitstableofMIMEtypestotellithowtodisplaythepage.ThistableassociatesaMIMEtypewithaviewer.Therearetwopossibilities:plug-insandhelperapplications.TheServerSideAmultithreadedWebserverwithafrontendandprocessingmodules.URLs–UniformResourceLocatersSomecommonURLs.URLshavethreeparts:theprotocol(alsoknownasthescheme),theDNSnameofthemachineonwhichthepageislocated,andalocalnameuniquelyindicatingthespecificpage(usuallyjustafilenameonthemachinewhereitresides).StatelessnessandCookies(1)RequirementsSomeWebsitesrequireclientstoregister(andpossiblypaymoney)tousethem.Thisraisesthequestionofhowserverscandistinguishbetweenrequestsfromregisteredusersandeveryoneelse.E-commerce:howdoestheserverkeeptrackofthecontentsofthecart?CustomizedWebportalssuchasYahoo.StatelessnessandCookies(2)SolutionWhenaclientrequestsaWebpage,theservercansupplyadditionalinformationalongwiththerequestedpage.Thisinformationmayincludeacookie,whichisasmall(atmost4KB)file(orstring).Browsersstoreofferedcookiesinacookiedirectoryontheclient'sharddiskunlesstheuserhasdisabledcookies.Acookiemaycontainuptofivefields:Domain,Path,Content,Expires,Secure

JustbeforeabrowsersendsarequestforapagetosomeWebsite,itchecksitscookiedirectorytoseeifanycookiestherewereplacedbythedomaintherequestisgoingto.Ifso,allthecookiesplacedbythatdomainareincludedintherequestmessage.Whentheservergetsthem,itcaninterpretthemanywayitwantsto.StatelessnessandCookies(3)Someexamplesofcookies.StaticWebDocumentsInthesimplestform,Webpagesarestatic,thatis,arejustfilessittingonsomeserverwaitingtoberetrieved.HTML—TheHyperTextMarkupLanguageWebpagesarecurrentlywritteninalanguagecalledHTML.FormsFormscontainboxesorbuttonsthatallowuserstofillininformationormakechoicesandthensendtheinformationbacktothepage'sowner.XMLandXSL

HTML,withorwithoutforms,doesnotprovideanystructuretoWebpages.Italsomixesthecontentwiththeformatting.theW3ChasdevelopedanenhancementtoHTMLtoallowWebpagestobestructuredforautomatedprocessing.Twonewlanguageshavebeendevelopedforthispurpose.XML(eXtensibleMarkupLanguage)describesWebcontentinastructuredwayandsecond,XSL(eXtensibleStyleLanguage)describestheformattingindependentlyofthecontent.HTML-TheHyperTextMarkupLanguageHTMLallowsuserstoproduceWebpagesthatincludetext,graphics,andpointerstootherWebpages.HTMLisamarkup

language,alanguagefordescribinghowdocumentsaretobeformatted.Theadvantageofamarkuplanguageoveronewithnoexplicitmarkupisthatwritingabrowserforitisstraightforward:thebrowsersimplyhastounderstandthemarkupcommands.AWebpageconsistsofaheadandabody,eachenclosedby<html>and</html>tags(formattingcommands),althoughmostbrowsersdonotcomplainifthesetagsaremissing.Thestringsinsidethetagsarecalleddirectives.Sometagshave(named)parameters,calledattributes.HTML–HyperTextMarkupLanguage(a)TheHTMLforasampleWebpage.HTML–HyperTextMarkupLanguage(b)Theformattedpage.AselectionofcommonHTMLtags.somecanhaveadditionalparameters.HTMLVersionsHTMLkeepsevolving.HTML1.0andHTML2.0didnothavetables,buttheywereaddedinHTML3.0.AnHTMLtableconsistsofoneormorerows,eachconsistingofoneormorecells.Cellscancontainawiderangeofmaterial,includingtext,figures,icons,photographs,andevenothertables.Cellscanbemerged,so,forexample,aheadingcanspanmultiplecolumns.(a)AnHTMLtable.(b)Apossiblerenditionofthistable.(a)TheHTMLforanorderform.(b)TheformattedpageApossibleresponsefromthebrowsertotheserverwithinformationfilledinbytheuser.XMLandXSLHTML,withorwithoutforms,doesnotprovideanystructuretoWebpages.Italsomixesthecontentwiththeformatting.Ase-commerceandotherapplicationsbecomemorecommon,thereisanincreasingneedforstructuringWebpagesandseparatingthecontentfromtheformatting.

Forthisreason,theW3ChasdevelopedanenhancementtoHTMLtoallowWebpagestobestructuredforautomatedprocessing.Twonewlanguageshavebeendevelopedforthispurpose.XML(eXtensibleMarkupLanguage)describesWebcontentinastructuredwayXSL(eXtensibleStyleLanguage)describestheformattingindependentlyofthecontentAsimpleWebpageinXML.AstylesheetinXSL.DynamicWebDocumentsInrecentyears,moreandmorecontenthasbecomedynamic,thatis,generatedondemand,ratherthanstoredondisk.Contentgenerationcantakeplaceeitherontheserversideorontheclientside.Server-SideDynamicWebPageGenerationCGI(CommonGatewayInterface)JSP(JavaServerPages),ASP(ActiveServerPages),Client-SideDynamicWebPageGenerationJavaScriptappletsActiveXcontrolsServer-SideDynamicWebPageGenerationStepsinprocessingtheinformationfromanHTMLform.Server-SideDynamicWebPageGeneration(2)AsampleHTMLpagewithembeddedPHP(HypertextPreprocessor)AlthoughPHPiseasytouse,itisactuallyapowerfulprogramminglanguageorientedtowardinterfacingbetweentheWebandaserverdatabase.Server-SideDynamicWebPageGeneration(3)WehavenowseentwodifferentwaystogeneratedynamicHTMLpages:CGIscriptsandembeddedPHP.Thereisalsoathirdtechnique,calledJSP(JavaServerPages),whichissimilartoPHP,exceptthatthedynamicpartiswrittenintheJavaprogramminglanguageinsteadofinPHP.Afourthtechnique,ASP(ActiveServerPages),isMicrosoft'sversionofPHPandJavaServerPages.ItusesMicrosoft'sproprietaryscriptinglanguage,VisualBasicScript,forgeneratingthedynamiccontent.Client-SideDynamicWebPageGenerationCGI,PHP,JSP,andASPscriptssolvetheproblemofhandlingformsandinteractionswithdatabasesontheserver.ItisnecessarytohavescriptsembeddedinHTMLpagesthatareexecutedontheclientmachineratherthantheservermachine.StartingwithHTML4.0,suchscriptsarepermittedusingthetag<script>.ThemostpopularscriptinglanguagefortheclientsideisJavaScript.JavaScriptisascriptinglanguage,verylooselyinspiredbysomeideasfromtheJavaprogramminglanguage.ItisdefinitelynotJava.UseofJavaScriptforprocessingaform.(a)Server-sidescriptingwithPHP.(b)Client-sidescriptingwithJavaScript.JavaScriptJavaScriptisafull-blownprogramminglanguage,withallthepowerofCorJava.Ithasvariables,strings,arrays,objects,functions,andalltheusualcontrolstructures.ItalsohasalargenumberoffacilitiesspecificforWebpages,includingtheabilitytomanagewindowsandframes,setandgetcookies,dealwithforms,andhandlehyperlinks.JavaScriptcanalsotrackmousemotionoverobjectsonthescreen.ManyJavaScriptWebpageshavethepropertythatwhenthemousecursorismovedoversometextorimage,somethinghappens.AppletsJavaScriptisnottheonlywaytomakeWebpageshighlyinteractive.Anotherpopularmethodisthroughtheuseofapplets.AppletsaresmallJavaprogramsthathavebeencompiledintomachineinstructionsforavirtualcomputercalledtheJVM(JavaVirtualMachine).AppletscanbeembeddedinHTMLpages(between<applet>and</applet>)andinterpretedbyJVM-capablebrowsers.Microsoft'sanswertoSun'sJavaappletswasallowingWebpagestoholdActiveXcontrols,whichareprogramscompiledtoPentiummachinelanguageandexecutedonthebarehardware.Client-SideDynamicWebPageGenerationThevariouswaystogenerateanddisplaycontent.HTTP—TheHyperTextTransferProtocol

HTTP(Hy

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论