资源描述:
《java状态代码(Java status code)》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、java状态代码(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