資源描述:
《java狀態(tài)代碼(Java status code)》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫。
1、java狀態(tài)代碼(Javastatuscode)NinepointsevenWhenaWebserverrespondstoarequestfromabrowserorotherclientprogram,itsresponseisgenerallycomposedofthefollowingparts:astateline,severalresponseheads,ablankline,andacontentdocument.Here'soneoftheeasiestresponses:Thestatuslinecontai
2、nstheHTTPversion,thestatuscode,andtheshortdescriptioninformationcorrespondingtothestatuscode.Inmostcases,allresponseheadsexceptContent-Typeareoptional.ButContent-Typeisrequired,anditdescribestheMIMEtypeofthefollowingdocument.Althoughmostrepliescontainadocument,somed
3、onotinclude,forexample,theresponsetotheHEADrequestwillneverbeattachedtothedocument.Therearemanystatecodesthatareactuallyusedtoidentifyafailedrequestthatdoesnotcontainadocument(oronlyabrieferrormessage).WhenauserattemptstoaccessacontentonaserverrunningInternetinforma
4、tionservice(IIS)overHTTP,IISreturnsanumericcodethatrepresentsthestateoftherequest.Thestatuscodecanindicatewhethertherequestissuccessfulornot,andalsorevealstheexactreasonforthefailureoftherequest.1XX-informationtipsThesestatecodesrepresenttemporaryresponses.Theclient
5、shouldbereadytoreceiveoneormore1XXresponsesbeforereceivingtheregularresponse.Theinitialrequestof100-Continuehasbeenaccepted,andtheclientshouldcontinuetosendtherestoftherequest.(HTTP1.1new)101-SwitchingProtocolsserverwillbeconvertedtoanotherprotocolaccordingtoclient'
6、srequest(HTTP1.1new)2XX-successThistypeofstatecodeindicatesthattheserversuccessfullyacceptstheclientrequest.200-OKisnormal,followedbyrepliestorequestsforGETandPOSTdocuments.The201-Createdserverhascreatedthedocument,andtheLocationheadergivesitsURL.202-Acceptedhasacce
7、ptedtherequest,buttheprocessinghasnotyetbeencompleted.The203-Non-AuthoritativeInformationdocumenthasreturnednormally,butsomeresponseheadersmaynotbecorrect,becausethecopyofthedocumentisused,nonauthoritativeinformation(HTTP1.1new).Thereisnonewdocumentfor204-NoContent,
8、andthebrowsershouldcontinuetodisplaytheoriginaldocument.Iftheuserrefreshesthepageperiodically,andServletcandeterminethattheuserdocumentisn