java servlet development kit 2.3 documentation by f.allimant · notes la documentation ......

337
English

Upload: others

Post on 23-Mar-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

English

Page 2: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

AproposdecedocumentCedocumentaétéconstruitautomatiquementàpartirdeladocumentationHTMLdisponiblesurjava.sun.com.Ilestpériodiquementremisàjour,lorsquedenouvellesversionsdesdocumentationsoriginalesdeviennentdisponibles.Pourtéléchargerlibrementetgratuitementcesmisesàjour,maisaussid''autresdocumentsJavaauformatHTMLHelpouWinHelp,visitezlesitedeFranckAllimant:

http://www.confluent.fr/javadoc(enFrançais)

http://www.confluent.fr/javadoc/indexe.html(enAnglais)

Bonneutilisation!

Contact

Lesremarquesetlessuggestionssontlesbienvenues.MercidelesfaireparveniràFranckAllimant.

Notes

LadocumentationHTMLoriginaleestdisponiblesurjava.sun.com.Mercidelaconsultersivousavezdesincertitudesàproposlesinformationsprésentéesdanscedocument.

LaversionHTMLHelpdecettedocumentationdiffèreparquelquespointsdelaversionHTML,àcausedecertaineslimitationsdeHTMLHelp.

1.AppletsJava

LesappletsJava1fonctionnentcorrectementdansHTMLHelp,pourvuquelesclassesJavanesoientpasembarquéesdanslefichierd'aide(chm)lui-même.Ellessontstockéesdanslerépertoireapplets,quisetrouveaumêmeendroitquelefichierd'aide.Cerépertoiren'estpasnécessaireaufonctionnementdel'aide:s'ilestabsent,lesappletsneserontpasaffichées.

LepluginJavan'estpassupportéparHTMLHelp.LesappletsnécessitantunemachinevirtuelleJava2nepeuventpasêtreexécutées.

2.Fichiersnécessitantunplugin

Lesupportdespluginsn'estpascompletdansHTMLHelp.Enfonctiondelaconfigurationdevotremachine,certainsproblèmespeuventsurvenirlorsdelavisualisationdecesfichiers,enparticulierlesdocumentsPDF.

Page 3: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

3.Occurrencesmultiplesd'unmot-clefdel'index

Siunmotclefdel'indexpointeversplusieursdocuments,unepagelistanttouteslesoccurrencestrouvéesestaffichée.Cettepagefournitletitredesdocumentsdanslequellemotclefapparaît,ets'ils'agitd'uneméthode,lesparamètresdecetteméthode.Cemoded'affichagetrèsdétailléaétépréféréàlaboîtededialogue"RubriquesTrouvées"proposéesenstandardparHTMLHelp,pourpermettreunenavigationplusefficaceetplusrapidedansungrandnombrededocuments.

Mercià...

a.doConsulting,pouroffrirgratuitementunparserHTMLécritenJavaaussicompactetefficace.

DougKramer,deSun,quiaautoriséladistributiondesdocumentationsJavapourWinHelpetHTMLHelp.

Distribution

Celogicielestgratuit.IlnepeutêtrediffusésurInternetoudupliquéquedansdesbutsnoncommerciaux,pourusageprivéexclusivement.ToutedistributionparCD-ROMestsoumiseàuneautorisationpréalable[contact].

TouteslesrestrictionsdedistributionimposéesparSunàladocumentationoriginalesontapplicablesauprésentdocument.Consultezcettepage(enanglais)pourenprendreconnaissance.

Copyright©1997-2002,FranckAllimant

Page 4: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

French

Page 5: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

AboutthisdocumentThisdocumentisbuiltfromtheHTMLdocumentationsavailableatjava.sun.com.Itisregularlyupdated,whennewversionsoforiginaldocumentationsbecomeavailable.TodownloadupdatesandmanyotherWinHelpandHTMLHelpJavadocumentationsforfree,visitFranckAllimant'swebsite:

http://www.confluent.fr/javadoc/indexe.html(inEnglish)

http://www.confluent.fr/javadoc(inFrench)

Contact

Commentsandsuggestionsarewelcome.FeelfreetosendthemtoFranckAllimant.

Notes

TheoriginalHTMLdocumentationisavailableatjava.sun.com.Pleaserefertothisoriginaldocumentationifyou'renotconfidentwiththepresentdocument.

DuetosomeHTMLHelplimitations,therearesomedifferencesbetweenthishelpfileandtheoriginalHTMLversionofthedocumentation.

1.JavaApplets

Inmostcases,Java1appletsarerunninginsidetheHTMLHelpviewer,providedthey'renotembeddedinthehelp(chm)file.Theyarestoredintheappletsdirectory,locatedatthesamelevelasthehelpfile.Thisfolderisnotrequiredforbrowsinghelp,butifitismissing,appletswillnotbedisplayed.

Java2appletsrequiretheJavaPlugin,whichisnotsupportedbytheHTMLHelpviewer.Theseappletswillnotbedisplayed.

2.Documentsthatrequireaplugin

PluginsarenotfullysupportedbytheHTMLHelpviewer.Dependingontheconfigurationofyourmachine,someproblemsmayoccurwhenviewingthesefiles,forexamplePDFdocuments.

3.Multipleoccurrencesofanindexkeyword

Ifanindexkeywordpointstomorethanonedocument,apagethatlistsallfoundoccurrencesisdisplayed.Thispageshowsthetitleofeverydocumentinwhichthekeyword

Page 6: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

appears,andifthiskeywordisamethod,theparametersofthismethod.ThisdetaileddisplayhasbeenpreferredtothestandardHTMLHelp"TopicsFound"dialogbox,toprovideafasterandmoreefficientbrowsingofalargenumberofdocuments.

Thanksto...

a.doConsulting,forHtmlStreamTokenizer™,acompact,efficientandfreeHTMLparserwritteninJava.

DougKrameratSun,whoauthorizedthedistributionofthisdocument.

Distribution

Thissoftwareisfree.Permissiontouse,copy,anddistributethissoftwarefornon-commercialpurposesviatheInternetwithoutfeeisherebygranted.PermissionisnotgrantedforanydistributionintheformofCD-ROM[contact].

Sun'sdocumentationredistributionpolicyisapplicabletothisdocument.Pleaseseethispagefordetails.

Copyright©1997-2002,FranckAllimant

Page 7: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 8: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SerializedForm

Packagejavax.servlet

Classjavax.servlet.GenericServletimplementsSerializable

Classjavax.servlet.ServletContextAttributeEventimplementsSerializable

SerializedFields

name

java.lang.Stringname

value

java.lang.Objectvalue

Classjavax.servlet.ServletContextEventimplementsSerializable

Classjavax.servlet.ServletExceptionimplementsSerializable

SerializedFields

Page 9: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

rootCause

java.lang.ThrowablerootCause

Classjavax.servlet.UnavailableExceptionimplementsSerializable

SerializedFields

permanent

booleanpermanent

seconds

intseconds

servlet

Servletservlet

Packagejavax.servlet.http

Classjavax.servlet.http.HttpServletimplementsSerializable

Classjavax.servlet.http.HttpSessionBindingEventimplementsSerializable

SerializedFields

Page 10: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

name

java.lang.Stringname

value

java.lang.Objectvalue

Classjavax.servlet.http.HttpSessionEventimplementsSerializable

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 11: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated Index HelpPREVNEXT FRAMESNOFRAMES

Page 12: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

HowThisAPIDocumentIsOrganized

ThisAPI(ApplicationProgrammingInterface)documenthaspagescorrespondingtotheitemsinthenavigationbar,describedasfollows.

Overview

TheOverviewpageisthefrontpageofthisAPIdocumentandprovidesalistofallpackageswithasummaryforeach.Thispagecanalsocontainanoveralldescriptionofthesetofpackages.

Package

Eachpackagehasapagethatcontainsalistofitsclassesandinterfaces,withasummaryforeach.Thispagecancontainfourcategories:

Interfaces(italic)ClassesExceptionsErrors

Class/Interface

Eachclass,interface,innerclassandinnerinterfacehasitsownseparatepage.Eachofthesepageshasthreesectionsconsistingofaclass/interfacedescription,summarytables,anddetailedmemberdescriptions:

ClassinheritancediagramDirectSubclassesAllKnownSubinterfacesAllKnownImplementingClassesClass/interfacedeclarationClass/interfacedescription

Page 13: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

InnerClassSummaryFieldSummaryConstructorSummaryMethodSummary

FieldDetailConstructorDetailMethodDetail

Eachsummaryentrycontainsthefirstsentencefromthedetaileddescriptionforthatitem.Thesummaryentriesarealphabetical,whilethedetaileddescriptionsareintheordertheyappearinthesourcecode.Thispreservesthelogicalgroupingsestablishedbytheprogrammer.

Tree(ClassHierarchy)

ThereisaClassHierarchypageforallpackages,plusahierarchyforeachpackage.Eachhierarchypagecontainsalistofclassesandalistofinterfaces.Theclassesareorganizedbyinheritancestructurestartingwithjava.lang.Object.Theinterfacesdonotinheritfromjava.lang.Object.

WhenviewingtheOverviewpage,clickingon"Tree"displaysthehierarchyforallpackages.Whenviewingaparticularpackage,classorinterfacepage,clicking"Tree"displaysthehierarchyforonlythatpackage.

DeprecatedAPI

TheDeprecatedAPIpagelistsalloftheAPIthathavebeendeprecated.AdeprecatedAPIisnotrecommendedforuse,generallyduetoimprovements,andareplacementAPIisusuallygiven.DeprecatedAPIsmayberemovedinfutureimplementations.

Index

TheIndexcontainsanalphabeticlistofallclasses,interfaces,constructors,methods,andfields.

Page 14: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Prev/Next

Theselinkstakeyoutothenextorpreviousclass,interface,package,orrelatedpage.

Frames/NoFrames

TheselinksshowandhidetheHTMLframes.Allpagesareavailablewithorwithoutframes.

SerializedForm

Eachserializableorexternalizableclasshasadescriptionofitsserializationfieldsandmethods.Thisinformationisofinteresttore-implementors,nottodevelopersusingtheAPI.Whilethereisnolinkinthenavigationbar,youcangettothisinformationbygoingtoanyserializedclassandclicking"SerializedForm"inthe"Seealso"sectionoftheclassdescription.

ThishelpfileappliestoAPIdocumentationgeneratedusingthestandarddoclet.

Overview Package Class Tree Deprecated Index HelpPREVNEXT FRAMESNOFRAMES

Page 15: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 16: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

HierarchyForAllPackages

PackageHierarchies:javax.servlet,javax.servlet.http

Page 17: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ClassHierarchy

classjava.lang.Objectclassjavax.servlet.http.Cookie(implementsjava.lang.Cloneable)classjava.util.EventObject(implementsjava.io.Serializable)

classjavax.servlet.http.HttpSessionEventclassjavax.servlet.http.HttpSessionBindingEvent

classjavax.servlet.ServletContextEventclassjavax.servlet.ServletContextAttributeEvent

classjavax.servlet.GenericServlet(implementsjava.io.Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig)

classjavax.servlet.http.HttpServlet(implementsjava.io.Serializable)

classjavax.servlet.http.HttpUtilsclassjava.io.InputStream

classjavax.servlet.ServletInputStreamclassjava.io.OutputStream

classjavax.servlet.ServletOutputStreamclassjavax.servlet.ServletRequestWrapper(implementsjavax.servlet.ServletRequest)

classjavax.servlet.http.HttpServletRequestWrapper(implementsjavax.servlet.http.HttpServletRequest)

classjavax.servlet.ServletResponseWrapper(implementsjavax.servlet.ServletResponse)

classjavax.servlet.http.HttpServletResponseWrapper(implementsjavax.servlet.http.HttpServletResponse)

classjava.lang.Throwable(implementsjava.io.Serializable)classjava.lang.Exception

classjavax.servlet.ServletExceptionclassjavax.servlet.UnavailableException

Page 18: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

InterfaceHierarchy

interfacejava.util.EventListenerinterfacejavax.servlet.http.HttpSessionActivationListenerinterfacejavax.servlet.http.HttpSessionAttributeListenerinterfacejavax.servlet.http.HttpSessionBindingListenerinterfacejavax.servlet.http.HttpSessionListenerinterfacejavax.servlet.ServletContextAttributeListenerinterfacejavax.servlet.ServletContextListener

interfacejavax.servlet.Filterinterfacejavax.servlet.FilterChaininterfacejavax.servlet.FilterConfiginterfacejavax.servlet.http.HttpSessioninterfacejavax.servlet.http.HttpSessionContextinterfacejavax.servlet.RequestDispatcherinterfacejavax.servlet.Servletinterfacejavax.servlet.ServletConfiginterfacejavax.servlet.ServletContextinterfacejavax.servlet.ServletRequest

interfacejavax.servlet.http.HttpServletRequestinterfacejavax.servlet.ServletResponse

interfacejavax.servlet.http.HttpServletResponseinterfacejavax.servlet.SingleThreadModel

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 19: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

ABCDEFGHIJLPRSUV

Page 20: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

A

addCookie(Cookie)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistocalladdCookie(Cookiecookie)onthewrappedresponseobject.

addCookie(Cookie)-Methodininterfacejavax.servlet.http.HttpServletResponse

Addsthespecifiedcookietotheresponse.addDateHeader(String,long)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistocalladdDateHeader(Stringname,longdate)onthewrappedresponseobject.

addDateHeader(String,long)-Methodininterfacejavax.servlet.http.HttpServletResponse

Addsaresponseheaderwiththegivennameanddate-value.addHeader(String,String)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistoreturnaddHeader(Stringname,Stringvalue)onthewrappedresponseobject.

addHeader(String,String)-Methodininterfacejavax.servlet.http.HttpServletResponse

Addsaresponseheaderwiththegivennameandvalue.addIntHeader(String,int)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistocalladdIntHeader(Stringname,intvalue)onthewrappedresponseobject.

addIntHeader(String,int)-Methodininterfacejavax.servlet.http.HttpServletResponse

Addsaresponseheaderwiththegivennameandintegervalue.attributeAdded(HttpSessionBindingEvent)-Methodininterfacejavax.servlet.http.HttpSessionAttributeListener

Notificationthatanattributehasbeenaddedtoasession.attributeAdded(ServletContextAttributeEvent)-Methodininterfacejavax.servlet.ServletContextAttributeListener

Notificationthatanewattributewasaddedtotheservletcontext.attributeRemoved(HttpSessionBindingEvent)-Methodininterface

Page 21: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.http.HttpSessionAttributeListenerNotificationthatanattributehasbeenremovedfromasession.

attributeRemoved(ServletContextAttributeEvent)-Methodininterfacejavax.servlet.ServletContextAttributeListener

Notificationthatanexistingattributehasbeenremvedfromtheservletcontext.

attributeReplaced(HttpSessionBindingEvent)-Methodininterfacejavax.servlet.http.HttpSessionAttributeListener

Notificationthatanattributehasbeenreplacedinasession.attributeReplaced(ServletContextAttributeEvent)-Methodininterfacejavax.servlet.ServletContextAttributeListener

Notificationthatanattributeontheservletcontexthasbeenreplaced.

Page 22: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

B

BASIC_AUTH-Staticvariableininterfacejavax.servlet.http.HttpServletRequest

StringidentifierforBasicauthentication.

Page 23: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

C

CLIENT_CERT_AUTH-Staticvariableininterfacejavax.servlet.http.HttpServletRequest

StringidentifierforBasicauthentication.clone()-Methodinclassjavax.servlet.http.Cookie

Overridesthestandardjava.lang.Object.clonemethodtoreturnacopyofthiscookie.

containsHeader(String)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistocallcontainsHeader(Stringname)onthewrappedresponseobject.

containsHeader(String)-Methodininterfacejavax.servlet.http.HttpServletResponse

Returnsabooleanindicatingwhetherthenamedresponseheaderhasalreadybeenset.

contextDestroyed(ServletContextEvent)-Methodininterfacejavax.servlet.ServletContextListener

Notificationthattheservletcontextisabouttobeshutdown.contextInitialized(ServletContextEvent)-Methodininterfacejavax.servlet.ServletContextListener

Notificationthatthewebapplicationisreadytoprocessrequests.Cookie-classjavax.servlet.http.Cookie.

Createsacookie,asmallamountofinformationsentbyaservlettoaWebbrowser,savedbythebrowser,andlatersentbacktotheserver.

Cookie(String,String)-Constructorforclassjavax.servlet.http.CookieConstructsacookiewithaspecifiednameandvalue.

Page 24: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

D

destroy()-Methodininterfacejavax.servlet.FilterCalledbythewebcontainertoindicatetoafilterthatitisbeingtakenoutofservice.

destroy()-Methodininterfacejavax.servlet.ServletCalledbytheservletcontainertoindicatetoaservletthattheservletisbeingtakenoutofservice.

destroy()-Methodinclassjavax.servlet.GenericServletCalledbytheservletcontainertoindicatetoaservletthattheservletisbeingtakenoutofservice.

DIGEST_AUTH-Staticvariableininterfacejavax.servlet.http.HttpServletRequest

StringidentifierforBasicauthentication.doDelete(HttpServletRequest,HttpServletResponse)-Methodinclassjavax.servlet.http.HttpServlet

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaDELETErequest.

doFilter(ServletRequest,ServletResponse)-Methodininterfacejavax.servlet.FilterChain

Causesthenextfilterinthechaintobeinvoked,orifthecallingfilteristhelastfilterinthechain,causestheresourceattheendofthechaintobeinvoked.

doFilter(ServletRequest,ServletResponse,FilterChain)-Methodininterfacejavax.servlet.Filter

ThedoFiltermethodoftheFilteriscalledbythecontainereachtimearequest/responsepairispassedthroughthechainduetoaclientrequestforaresourceattheendofthechain.

doGet(HttpServletRequest,HttpServletResponse)-Methodinclassjavax.servlet.http.HttpServlet

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaGETrequest.

doHead(HttpServletRequest,HttpServletResponse)-Methodinclassjavax.servlet.http.HttpServlet

ReceivesanHTTPHEADrequestfromtheprotectedservicemethodandhandlestherequest.

doOptions(HttpServletRequest,HttpServletResponse)-Methodinclass

Page 25: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.http.HttpServletCalledbytheserver(viatheservicemethod)toallowaservlettohandleaOPTIONSrequest.

doPost(HttpServletRequest,HttpServletResponse)-Methodinclassjavax.servlet.http.HttpServlet

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaPOSTrequest.

doPut(HttpServletRequest,HttpServletResponse)-Methodinclassjavax.servlet.http.HttpServlet

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaPUTrequest.

doTrace(HttpServletRequest,HttpServletResponse)-Methodinclassjavax.servlet.http.HttpServlet

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaTRACErequest.

Page 26: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

E

encodeRedirectUrl(String)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistoreturnencodeRedirectUrl(Stringurl)onthewrappedresponseobject.

encodeRedirectUrl(String)-Methodininterfacejavax.servlet.http.HttpServletResponse

Deprecated.Asofversion2.1,useencodeRedirectURL(Stringurl)insteadencodeRedirectURL(String)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistoreturnencodeRedirectURL(Stringurl)onthewrappedresponseobject.

encodeRedirectURL(String)-Methodininterfacejavax.servlet.http.HttpServletResponse

EncodesthespecifiedURLforuseinthesendRedirectmethodor,ifencodingisnotneeded,returnstheURLunchanged.

encodeUrl(String)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistocallencodeUrl(Stringurl)onthewrappedresponseobject.

encodeUrl(String)-Methodininterfacejavax.servlet.http.HttpServletResponseDeprecated.Asofversion2.1,useencodeURL(Stringurl)instead

encodeURL(String)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistocallencodeURL(Stringurl)onthewrappedresponseobject.

encodeURL(String)-Methodininterfacejavax.servlet.http.HttpServletResponse

EncodesthespecifiedURLbyincludingthesessionIDinit,or,ifencodingisnotneeded,returnstheURLunchanged.

Page 27: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

F

Filter-interfacejavax.servlet.Filter.Afilterisanobjectthanperformfilteringtasksoneithertherequesttoaresource(aservletorstaticcontent),orontheresponsefromaresource,orboth.

FiltersperformfilteringinthedoFiltermethod.FilterChain-interfacejavax.servlet.FilterChain.

AFilterChainisanobjectprovidedbytheservletcontainertothedevelopergivingaviewintotheinvocationchainofafilteredrequestforaresource.

FilterConfig-interfacejavax.servlet.FilterConfig.Afilterconfigurationobjectusedbyaservletcontainerusedtopassinformationtoafilterduringinitialization.

flushBuffer()-Methodininterfacejavax.servlet.ServletResponseForcesanycontentinthebuffertobewrittentotheclient.

flushBuffer()-Methodinclassjavax.servlet.ServletResponseWrapperThedefaultbehaviorofthismethodistocallflushBuffer()onthewrappedresponseobject.

FORM_AUTH-Staticvariableininterfacejavax.servlet.http.HttpServletRequest

StringidentifierforBasicauthentication.forward(ServletRequest,ServletResponse)-Methodininterfacejavax.servlet.RequestDispatcher

Forwardsarequestfromaservlettoanotherresource(servlet,JSPfile,orHTMLfile)ontheserver.

Page 28: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

G

GenericServlet-classjavax.servlet.GenericServlet.Definesageneric,protocol-independentservlet.

GenericServlet()-Constructorforclassjavax.servlet.GenericServletDoesnothing.

getAttribute(String)-Methodininterfacejavax.servlet.ServletContextReturnstheservletcontainerattributewiththegivenname,ornullifthereisnoattributebythatname.

getAttribute(String)-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistocallgetAttribute(Stringname)onthewrappedrequestobject.

getAttribute(String)-Methodininterfacejavax.servlet.ServletRequestReturnsthevalueofthenamedattributeasanObject,ornullifnoattributeofthegivennameexists.

getAttribute(String)-Methodininterfacejavax.servlet.http.HttpSessionReturnstheobjectboundwiththespecifiednameinthissession,ornullifnoobjectisboundunderthename.

getAttributeNames()-Methodininterfacejavax.servlet.ServletContextReturnsanEnumerationcontainingtheattributenamesavailablewithinthisservletcontext.

getAttributeNames()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetAttributeNames()onthewrappedrequestobject.

getAttributeNames()-Methodininterfacejavax.servlet.ServletRequestReturnsanEnumerationcontainingthenamesoftheattributesavailabletothisrequest.

getAttributeNames()-Methodininterfacejavax.servlet.http.HttpSessionReturnsanEnumerationofStringobjectscontainingthenamesofalltheobjectsboundtothissession.

getAuthType()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsthenameoftheauthenticationschemeusedtoprotecttheservlet.

getAuthType()-Methodinclassjavax.servlet.http.HttpServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetAuthType()onthewrappedrequestobject.

getBufferSize()-Methodininterfacejavax.servlet.ServletResponseReturnstheactualbuffersizeusedfortheresponse.

Page 29: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getBufferSize()-Methodinclassjavax.servlet.ServletResponseWrapperThedefaultbehaviorofthismethodistoreturngetBufferSize()onthewrappedresponseobject.

getCharacterEncoding()-Methodininterfacejavax.servlet.ServletResponseReturnsthenameofthecharsetusedfortheMIMEbodysentinthisresponse.

getCharacterEncoding()-Methodinclassjavax.servlet.ServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetCharacterEncoding()onthewrappedrequestobject.

getCharacterEncoding()-Methodininterfacejavax.servlet.ServletRequestReturnsthenameofthecharacterencodingusedinthebodyofthisrequest.

getCharacterEncoding()-Methodinclassjavax.servlet.ServletResponseWrapper

ThedefaultbehaviorofthismethodistoreturngetCharacterEncoding()onthewrappedresponseobject.

getComment()-Methodinclassjavax.servlet.http.CookieReturnsthecommentdescribingthepurposeofthiscookie,ornullifthecookiehasnocomment.

getContentLength()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetContentLength()onthewrappedrequestobject.

getContentLength()-Methodininterfacejavax.servlet.ServletRequestReturnsthelength,inbytes,oftherequestbodyandmadeavailablebytheinputstream,or-1ifthelengthisnotknown.

getContentType()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetContentType()onthewrappedrequestobject.

getContentType()-Methodininterfacejavax.servlet.ServletRequestReturnstheMIMEtypeofthebodyoftherequest,ornullifthetypeisnotknown.

getContext(String)-Methodininterfacejavax.servlet.ServletContextReturnsaServletContextobjectthatcorrespondstoaspecifiedURLontheserver.

getContextPath()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnstheportionoftherequestURIthatindicatesthecontextoftherequest.

getContextPath()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

Page 30: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThedefaultbehaviorofthismethodistoreturngetContextPath()onthewrappedrequestobject.

getCookies()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsanarraycontainingalloftheCookieobjectstheclientsentwiththisrequest.

getCookies()-Methodinclassjavax.servlet.http.HttpServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetCookies()onthewrappedrequestobject.

getCreationTime()-Methodininterfacejavax.servlet.http.HttpSessionReturnsthetimewhenthissessionwascreated,measuredinmillisecondssincemidnightJanuary1,1970GMT.

getDateHeader(String)-Methodininterfacejavax.servlet.http.HttpServletRequest

ReturnsthevalueofthespecifiedrequestheaderasalongvaluethatrepresentsaDateobject.

getDateHeader(String)-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetDateHeader(Stringname)onthewrappedrequestobject.

getDomain()-Methodinclassjavax.servlet.http.CookieReturnsthedomainnamesetforthiscookie.

getFilterName()-Methodininterfacejavax.servlet.FilterConfigReturnsthefilter-nameofthisfilterasdefinedinthedeploymentdescriptor.

getHeader(String)-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsthevalueofthespecifiedrequestheaderasaString.

getHeader(String)-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetHeader(Stringname)onthewrappedrequestobject.

getHeaderNames()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsanenumerationofalltheheadernamesthisrequestcontains.

getHeaderNames()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetHeaderNames()onthewrappedrequestobject.

getHeaders(String)-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsallthevaluesofthespecifiedrequestheaderasanEnumerationofStringobjects.

getHeaders(String)-Methodinclass

Page 31: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.http.HttpServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetHeaders(Stringname)onthewrappedrequestobject.

getId()-Methodininterfacejavax.servlet.http.HttpSessionReturnsastringcontainingtheuniqueidentifierassignedtothissession.

getIds()-Methodininterfacejavax.servlet.http.HttpSessionContextDeprecated.AsofJavaServletAPI2.1withnoreplacement.ThismethodmustreturnanemptyEnumerationandwillberemovedinafutureversionofthisAPI.

getInitParameter(String)-Methodininterfacejavax.servlet.FilterConfigReturnsaStringcontainingthevalueofthenamedinitializationparameter,ornulliftheparameterdoesnotexist.

getInitParameter(String)-Methodininterfacejavax.servlet.ServletConfigReturnsaStringcontainingthevalueofthenamedinitializationparameter,ornulliftheparameterdoesnotexist.

getInitParameter(String)-Methodininterfacejavax.servlet.ServletContextReturnsaStringcontainingthevalueofthenamedcontext-wideinitializationparameter,ornulliftheparameterdoesnotexist.

getInitParameter(String)-Methodinclassjavax.servlet.GenericServletReturnsaStringcontainingthevalueofthenamedinitializationparameter,ornulliftheparameterdoesnotexist.

getInitParameterNames()-Methodininterfacejavax.servlet.FilterConfigReturnsthenamesoftheservlet'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationiftheservlethasnoinitializationparameters.

getInitParameterNames()-Methodininterfacejavax.servlet.ServletConfigReturnsthenamesoftheservlet'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationiftheservlethasnoinitializationparameters.

getInitParameterNames()-Methodininterfacejavax.servlet.ServletContextReturnsthenamesofthecontext'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationifthecontexthasnoinitializationparameters.

getInitParameterNames()-Methodinclassjavax.servlet.GenericServletReturnsthenamesoftheservlet'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationiftheservlethasnoinitializationparameters.

getInputStream()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetInputStream()onthe

Page 32: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

wrappedrequestobject.getInputStream()-Methodininterfacejavax.servlet.ServletRequest

RetrievesthebodyoftherequestasbinarydatausingaServletInputStream.

getIntHeader(String)-Methodininterfacejavax.servlet.http.HttpServletRequest

Returnsthevalueofthespecifiedrequestheaderasanint.getIntHeader(String)-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetIntHeader(Stringname)onthewrappedrequestobject.

getLastAccessedTime()-Methodininterfacejavax.servlet.http.HttpSessionReturnsthelasttimetheclientsentarequestassociatedwiththissession,asthenumberofmillisecondssincemidnightJanuary1,1970GMT,andmarkedbythetimethecontainerrecievedtherequest.

getLastModified(HttpServletRequest)-Methodinclassjavax.servlet.http.HttpServlet

ReturnsthetimetheHttpServletRequestobjectwaslastmodified,inmillisecondssincemidnightJanuary1,1970GMT.

getLocale()-Methodininterfacejavax.servlet.ServletResponseReturnsthelocaleassignedtotheresponse.

getLocale()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetLocale()onthewrappedrequestobject.

getLocale()-Methodininterfacejavax.servlet.ServletRequestReturnsthepreferredLocalethattheclientwillacceptcontentin,basedontheAccept-Languageheader.

getLocale()-Methodinclassjavax.servlet.ServletResponseWrapperThedefaultbehaviorofthismethodistoreturngetLocale()onthewrappedresponseobject.

getLocales()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetLocales()onthewrappedrequestobject.

getLocales()-Methodininterfacejavax.servlet.ServletRequestReturnsanEnumerationofLocaleobjectsindicating,indecreasingorderstartingwiththepreferredlocale,thelocalesthatareacceptabletotheclientbasedontheAccept-Languageheader.

getMajorVersion()-Methodininterfacejavax.servlet.ServletContextReturnsthemajorversionoftheJavaServletAPIthatthisservletcontainer

Page 33: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

supports.getMaxAge()-Methodinclassjavax.servlet.http.Cookie

Returnsthemaximumageofthecookie,specifiedinseconds,Bydefault,-1indicatingthecookiewillpersistuntilbrowsershutdown.

getMaxInactiveInterval()-Methodininterfacejavax.servlet.http.HttpSessionReturnsthemaximumtimeinterval,inseconds,thattheservletcontainerwillkeepthissessionopenbetweenclientaccesses.

getMethod()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsthenameoftheHTTPmethodwithwhichthisrequestwasmade,forexample,GET,POST,orPUT.

getMethod()-Methodinclassjavax.servlet.http.HttpServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetMethod()onthewrappedrequestobject.

getMimeType(String)-Methodininterfacejavax.servlet.ServletContextReturnstheMIMEtypeofthespecifiedfile,ornulliftheMIMEtypeisnotknown.

getMinorVersion()-Methodininterfacejavax.servlet.ServletContextReturnstheminorversionoftheServletAPIthatthisservletcontainersupports.

getName()-Methodinclassjavax.servlet.ServletContextAttributeEventReturnthenameoftheattributethatchangedontheServletContext.

getName()-Methodinclassjavax.servlet.http.HttpSessionBindingEventReturnsthenamewithwhichtheattributeisboundtoorunboundfromthesession.

getName()-Methodinclassjavax.servlet.http.CookieReturnsthenameofthecookie.

getNamedDispatcher(String)-Methodininterfacejavax.servlet.ServletContext

ReturnsaRequestDispatcherobjectthatactsasawrapperforthenamedservlet.

getOutputStream()-Methodininterfacejavax.servlet.ServletResponseReturnsaServletOutputStreamsuitableforwritingbinarydataintheresponse.

getOutputStream()-Methodinclassjavax.servlet.ServletResponseWrapperThedefaultbehaviorofthismethodistoreturngetOutputStream()onthewrappedresponseobject.

getParameter(String)-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetParameter(Stringname)onthewrappedrequestobject.

Page 34: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getParameter(String)-Methodininterfacejavax.servlet.ServletRequestReturnsthevalueofarequestparameterasaString,ornulliftheparameterdoesnotexist.

getParameterMap()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetParameterMap()onthewrappedrequestobject.

getParameterMap()-Methodininterfacejavax.servlet.ServletRequestReturnsajava.util.Mapoftheparametersofthisrequest.

getParameterNames()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetParameterNames()onthewrappedrequestobject.

getParameterNames()-Methodininterfacejavax.servlet.ServletRequestReturnsanEnumerationofStringobjectscontainingthenamesoftheparameterscontainedinthisrequest.

getParameterValues(String)-Methodinclassjavax.servlet.ServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetParameterValues(Stringname)onthewrappedrequestobject.

getParameterValues(String)-Methodininterfacejavax.servlet.ServletRequestReturnsanarrayofStringobjectscontainingallofthevaluesthegivenrequestparameterhas,ornulliftheparameterdoesnotexist.

getPath()-Methodinclassjavax.servlet.http.CookieReturnsthepathontheservertowhichthebrowserreturnsthiscookie.

getPathInfo()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsanyextrapathinformationassociatedwiththeURLtheclientsentwhenitmadethisrequest.

getPathInfo()-Methodinclassjavax.servlet.http.HttpServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetPathInfo()onthewrappedrequestobject.

getPathTranslated()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsanyextrapathinformationaftertheservletnamebutbeforethequerystring,andtranslatesittoarealpath.

getPathTranslated()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetPathTranslated()onthewrappedrequestobject.

getProtocol()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetProtocol()onthewrappedrequestobject.

Page 35: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getProtocol()-Methodininterfacejavax.servlet.ServletRequestReturnsthenameandversionoftheprotocoltherequestusesintheformprotocol/majorVersion.minorVersion,forexample,HTTP/1.1.

getQueryString()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsthequerystringthatiscontainedintherequestURLafterthepath.

getQueryString()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetQueryString()onthewrappedrequestobject.

getReader()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetReader()onthewrappedrequestobject.

getReader()-Methodininterfacejavax.servlet.ServletRequestRetrievesthebodyoftherequestascharacterdatausingaBufferedReader.

getRealPath(String)-Methodininterfacejavax.servlet.ServletContextReturnsaStringcontainingtherealpathforagivenvirtualpath.

getRealPath(String)-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetRealPath(Stringpath)onthewrappedrequestobject.

getRealPath(String)-Methodininterfacejavax.servlet.ServletRequestDeprecated.AsofVersion2.1oftheJavaServletAPI,useServletContext.getRealPath(java.lang.String)instead.

getRemoteAddr()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetRemoteAddr()onthewrappedrequestobject.

getRemoteAddr()-Methodininterfacejavax.servlet.ServletRequestReturnstheInternetProtocol(IP)addressoftheclientthatsenttherequest.

getRemoteHost()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetRemoteHost()onthewrappedrequestobject.

getRemoteHost()-Methodininterfacejavax.servlet.ServletRequestReturnsthefullyqualifiednameoftheclientthatsenttherequest.

getRemoteUser()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnstheloginoftheusermakingthisrequest,iftheuserhasbeenauthenticated,ornulliftheuserhasnotbeenauthenticated.

getRemoteUser()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetRemoteUser()onthewrappedrequestobject.

Page 36: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getRequest()-Methodinclassjavax.servlet.ServletRequestWrapperReturnthewrappedrequestobject.

getRequestDispatcher(String)-Methodininterfacejavax.servlet.ServletContext

ReturnsaRequestDispatcherobjectthatactsasawrapperfortheresourcelocatedatthegivenpath.

getRequestDispatcher(String)-Methodinclassjavax.servlet.ServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetRequestDispatcher(Stringpath)onthewrappedrequestobject.

getRequestDispatcher(String)-Methodininterfacejavax.servlet.ServletRequest

ReturnsaRequestDispatcherobjectthatactsasawrapperfortheresourcelocatedatthegivenpath.

getRequestedSessionId()-Methodininterfacejavax.servlet.http.HttpServletRequest

ReturnsthesessionIDspecifiedbytheclient.getRequestedSessionId()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetRequestedSessionId()onthewrappedrequestobject.

getRequestURI()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsthepartofthisrequest'sURLfromtheprotocolnameuptothequerystringinthefirstlineoftheHTTPrequest.

getRequestURI()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetRequestURI()onthewrappedrequestobject.

getRequestURL()-Methodininterfacejavax.servlet.http.HttpServletRequestReconstructstheURLtheclientusedtomaketherequest.

getRequestURL()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetRequestURL()onthewrappedrequestobject.

getRequestURL(HttpServletRequest)-Staticmethodinclassjavax.servlet.http.HttpUtils

Deprecated.ReconstructstheURLtheclientusedtomaketherequest,usinginformationintheHttpServletRequestobject.

getResource(String)-Methodininterfacejavax.servlet.ServletContext

Page 37: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ReturnsaURLtotheresourcethatismappedtoaspecifiedpath.getResourceAsStream(String)-Methodininterfacejavax.servlet.ServletContext

ReturnstheresourcelocatedatthenamedpathasanInputStreamobject.getResourcePaths(String)-Methodininterfacejavax.servlet.ServletContext

Returnsadirectory-likelistingofallthepathstoresourceswithinthewebapplicationwhoselongestsub-pathmatchesthesuppliedpathargument.

getResponse()-Methodinclassjavax.servlet.ServletResponseWrapperReturnthewrappedServletResponseobject.

getRootCause()-Methodinclassjavax.servlet.ServletExceptionReturnstheexceptionthatcausedthisservletexception.

getScheme()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetScheme()onthewrappedrequestobject.

getScheme()-Methodininterfacejavax.servlet.ServletRequestReturnsthenameoftheschemeusedtomakethisrequest,forexample,http,https,orftp.

getSecure()-Methodinclassjavax.servlet.http.CookieReturnstrueifthebrowserissendingcookiesonlyoverasecureprotocol,orfalseifthebrowsercansendcookiesusinganyprotocol.

getServerInfo()-Methodininterfacejavax.servlet.ServletContextReturnsthenameandversionoftheservletcontaineronwhichtheservletisrunning.

getServerName()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetServerName()onthewrappedrequestobject.

getServerName()-Methodininterfacejavax.servlet.ServletRequestReturnsthehostnameoftheserverthatreceivedtherequest.

getServerPort()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetServerPort()onthewrappedrequestobject.

getServerPort()-Methodininterfacejavax.servlet.ServletRequestReturnstheportnumberonwhichthisrequestwasreceived.

getServlet()-Methodinclassjavax.servlet.UnavailableExceptionDeprecated.AsofJavaServletAPI2.2,withnoreplacement.Returnstheservletthatisreportingitsunavailability.

getServlet(String)-Methodininterfacejavax.servlet.ServletContextDeprecated.AsofJavaServletAPI2.1,withnodirectreplacement.

Page 38: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThismethodwasoriginallydefinedtoretrieveaservletfromaServletContext.Inthisversion,thismethodalwaysreturnsnullandremainsonlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

Inlieuofthismethod,servletscanshareinformationusingtheServletContextclassandcanperformsharedbusinesslogicbyinvokingmethodsoncommonnon-servletclasses.

getServletConfig()-Methodininterfacejavax.servlet.ServletReturnsaServletConfigobject,whichcontainsinitializationandstartupparametersforthisservlet.

getServletConfig()-Methodinclassjavax.servlet.GenericServletReturnsthisservlet'sServletConfigobject.

getServletContext()-Methodininterfacejavax.servlet.FilterConfigReturnsareferencetotheServletContextinwhichthecallerisexecuting.

getServletContext()-Methodininterfacejavax.servlet.ServletConfigReturnsareferencetotheServletContextinwhichthecallerisexecuting.

getServletContext()-Methodinclassjavax.servlet.ServletContextEventReturntheServletContextthatchanged.

getServletContext()-Methodinclassjavax.servlet.GenericServletReturnsareferencetotheServletContextinwhichthisservletisrunning.

getServletContext()-Methodininterfacejavax.servlet.http.HttpSessionReturnstheServletContexttowhichthissessionbelongs.

getServletContextName()-Methodininterfacejavax.servlet.ServletContextReturnsthenameofthiswebapplicationcorrepondingtothisServletContextasspecifiedinthedeploymentdescriptorforthiswebapplicationbythedisplay-nameelement.

getServletInfo()-Methodininterfacejavax.servlet.ServletReturnsinformationabouttheservlet,suchasauthor,version,andcopyright.

getServletInfo()-Methodinclassjavax.servlet.GenericServletReturnsinformationabouttheservlet,suchasauthor,version,andcopyright.

getServletName()-Methodininterfacejavax.servlet.ServletConfigReturnsthenameofthisservletinstance.

getServletName()-Methodinclassjavax.servlet.GenericServletReturnsthenameofthisservletinstance.

getServletNames()-Methodininterfacejavax.servlet.ServletContext

Page 39: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Deprecated.AsofJavaServletAPI2.1,withnoreplacement.

ThismethodwasoriginallydefinedtoreturnanEnumerationofalltheservletnamesknowntothiscontext.Inthisversion,thismethodalwaysreturnsanemptyEnumerationandremainsonlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

getServletPath()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsthepartofthisrequest'sURLthatcallstheservlet.

getServletPath()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetServletPath()onthewrappedrequestobject.

getServlets()-Methodininterfacejavax.servlet.ServletContextDeprecated.AsofJavaServletAPI2.0,withnoreplacement.

ThismethodwasoriginallydefinedtoreturnanEnumerationofalltheservletsknowntothisservletcontext.Inthisversion,thismethodalwaysreturnsanemptyenumerationandremainsonlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

getSession()-Methodinclassjavax.servlet.http.HttpSessionEventReturnthesessionthatchanged.

getSession()-Methodinclassjavax.servlet.http.HttpSessionBindingEventReturnthesessionthatchanged.

getSession()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsthecurrentsessionassociatedwiththisrequest,oriftherequestdoesnothaveasession,createsone.

getSession()-Methodinclassjavax.servlet.http.HttpServletRequestWrapperThedefaultbehaviorofthismethodistoreturngetSession()onthewrappedrequestobject.

getSession(boolean)-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsthecurrentHttpSessionassociatedwiththisrequestor,ififthereisnocurrentsessionandcreateistrue,returnsanewsession.

getSession(boolean)-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetSession(booleancreate)

Page 40: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

onthewrappedrequestobject.getSession(String)-Methodininterfacejavax.servlet.http.HttpSessionContext

Deprecated.AsofJavaServletAPI2.1withnoreplacement.ThismethodmustreturnnullandwillberemovedinafutureversionofthisAPI.

getSessionContext()-Methodininterfacejavax.servlet.http.HttpSessionDeprecated.AsofVersion2.1,thismethodisdeprecatedandhasnoreplacement.ItwillberemovedinafutureversionoftheJavaServletAPI.

getUnavailableSeconds()-Methodinclassjavax.servlet.UnavailableExceptionReturnsthenumberofsecondstheservletexpectstobetemporarilyunavailable.

getUserPrincipal()-Methodininterfacejavax.servlet.http.HttpServletRequestReturnsajava.security.Principalobjectcontainingthenameofthecurrentauthenticateduser.

getUserPrincipal()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturngetUserPrincipal()onthewrappedrequestobject.

getValue()-Methodinclassjavax.servlet.ServletContextAttributeEventReturnsthevalueoftheattributethathasbeenaddedremovedorreplaced.

getValue()-Methodinclassjavax.servlet.http.HttpSessionBindingEventReturnsthevalueoftheattributethathasbeenadded,removedorreplaced.

getValue()-Methodinclassjavax.servlet.http.CookieReturnsthevalueofthecookie.

getValue(String)-Methodininterfacejavax.servlet.http.HttpSessionDeprecated.AsofVersion2.2,thismethodisreplacedbyHttpSession.getAttribute(java.lang.String).

getValueNames()-Methodininterfacejavax.servlet.http.HttpSessionDeprecated.AsofVersion2.2,thismethodisreplacedbyHttpSession.getAttributeNames()

getVersion()-Methodinclassjavax.servlet.http.CookieReturnstheversionoftheprotocolthiscookiecomplieswith.

getWriter()-Methodininterfacejavax.servlet.ServletResponseReturnsaPrintWriterobjectthatcansendcharactertexttotheclient.

getWriter()-Methodinclassjavax.servlet.ServletResponseWrapperThedefaultbehaviorofthismethodistoreturngetWriter()onthewrappedresponseobject.

Page 41: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

H

HttpServlet-classjavax.servlet.http.HttpServlet.ProvidesanabstractclasstobesubclassedtocreateanHTTPservletsuitableforaWebsite.

HttpServlet()-Constructorforclassjavax.servlet.http.HttpServletDoesnothing,becausethisisanabstractclass.

HttpServletRequest-interfacejavax.servlet.http.HttpServletRequest.ExtendstheServletRequestinterfacetoproviderequestinformationforHTTPservlets.

HttpServletRequestWrapper-classjavax.servlet.http.HttpServletRequestWrapper.

ProvidesaconvenientimplementationoftheHttpServletRequestinterfacethatcanbesubclassedbydeveloperswishingtoadapttherequesttoaServlet.

HttpServletRequestWrapper(HttpServletRequest)-Constructorforclassjavax.servlet.http.HttpServletRequestWrapper

Constructsarequestobjectwrappingthegivenrequest.HttpServletResponse-interfacejavax.servlet.http.HttpServletResponse.

ExtendstheServletResponseinterfacetoprovideHTTP-specificfunctionalityinsendingaresponse.

HttpServletResponseWrapper-classjavax.servlet.http.HttpServletResponseWrapper.

ProvidesaconvenientimplementationoftheHttpServletResponseinterfacethatcanbesubclassedbydeveloperswishingtoadapttheresponsefromaServlet.

HttpServletResponseWrapper(HttpServletResponse)-Constructorforclassjavax.servlet.http.HttpServletResponseWrapper

Constructsaresponseadaptorwrappingthegivenresponse.HttpSession-interfacejavax.servlet.http.HttpSession.

ProvidesawaytoidentifyauseracrossmorethanonepagerequestorvisittoaWebsiteandtostoreinformationaboutthatuser.

HttpSessionActivationListener-interfacejavax.servlet.http.HttpSessionActivationListener.

Objectsthatareboundtoasessionmaylistentocontainereventsnotifyingthemthatsessionswillbepassivatedandthatsessionwillbeactivated.

HttpSessionAttributeListener-interface

Page 42: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.http.HttpSessionAttributeListener.Thislistenerinterfacecanbeimplementedinordertogetnotificationsofchangestotheattributelistsofsessionswithinthiswebapplication.

HttpSessionBindingEvent-classjavax.servlet.http.HttpSessionBindingEvent.EventsofthistypeareeithersenttoanobjectthatimplementsHttpSessionBindingListenerwhenitisboundorunboundfromasession,ortoaHttpSessionAttributeListenerthathasbeenconfiguredinthedeploymentdescriptorwhenanyattributeisbound,unboundorreplacedinasession.

HttpSessionBindingEvent(HttpSession,String)-Constructorforclassjavax.servlet.http.HttpSessionBindingEvent

Constructsaneventthatnotifiesanobjectthatithasbeenboundtoorunboundfromasession.

HttpSessionBindingEvent(HttpSession,String,Object)-Constructorforclassjavax.servlet.http.HttpSessionBindingEvent

Constructsaneventthatnotifiesanobjectthatithasbeenboundtoorunboundfromasession.

HttpSessionBindingListener-interfacejavax.servlet.http.HttpSessionBindingListener.

Causesanobjecttobenotifiedwhenitisboundtoorunboundfromasession.

HttpSessionContext-interfacejavax.servlet.http.HttpSessionContext.Deprecated.AsofJava(tm)ServletAPI2.1forsecurityreasons,withnoreplacement.ThisinterfacewillberemovedinafutureversionofthisAPI.

HttpSessionEvent-classjavax.servlet.http.HttpSessionEvent.Thisistheclassrepresentingeventnotificationsforchangestosessionswithinawebapplication.

HttpSessionEvent(HttpSession)-Constructorforclassjavax.servlet.http.HttpSessionEvent

Constructasessioneventfromthegivensource.HttpSessionListener-interfacejavax.servlet.http.HttpSessionListener.

Implementationsofthisinterfacemayarenotifiedofchangestothelistofactivesessionsinawebapplication.

HttpUtils-classjavax.servlet.http.HttpUtils.Deprecated.AsofJava(tm)ServletAPI2.3.Thesemethodswereonlyusefulwiththedefaultencodingandhavebeenmovedtotherequestinterfaces.

HttpUtils()-Constructorforclassjavax.servlet.http.HttpUtilsDeprecated.ConstructsanemptyHttpUtilsobject.

Page 43: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index
Page 44: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

I

include(ServletRequest,ServletResponse)-Methodininterfacejavax.servlet.RequestDispatcher

Includesthecontentofaresource(servlet,JSPpage,HTMLfile)intheresponse.

init()-Methodinclassjavax.servlet.GenericServletAconveniencemethodwhichcanbeoverriddensothatthere'snoneedtocallsuper.init(config).

init(FilterConfig)-Methodininterfacejavax.servlet.FilterCalledbythewebcontainertoindicatetoafilterthatitisbeingplacedintoservice.

init(ServletConfig)-Methodininterfacejavax.servlet.ServletCalledbytheservletcontainertoindicatetoaservletthattheservletisbeingplacedintoservice.

init(ServletConfig)-Methodinclassjavax.servlet.GenericServletCalledbytheservletcontainertoindicatetoaservletthattheservletisbeingplacedintoservice.

invalidate()-Methodininterfacejavax.servlet.http.HttpSessionInvalidatesthissessionthenunbindsanyobjectsboundtoit.

isCommitted()-Methodininterfacejavax.servlet.ServletResponseReturnsabooleanindicatingiftheresponsehasbeencommitted.

isCommitted()-Methodinclassjavax.servlet.ServletResponseWrapperThedefaultbehaviorofthismethodistoreturnisCommitted()onthewrappedresponseobject.

isNew()-Methodininterfacejavax.servlet.http.HttpSessionReturnstrueiftheclientdoesnotyetknowaboutthesessionoriftheclientchoosesnottojointhesession.

isPermanent()-Methodinclassjavax.servlet.UnavailableExceptionReturnsabooleanindicatingwhethertheservletispermanentlyunavailable.

isRequestedSessionIdFromCookie()-Methodininterfacejavax.servlet.http.HttpServletRequest

CheckswhethertherequestedsessionIDcameinasacookie.isRequestedSessionIdFromCookie()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

Thedefaultbehaviorofthismethodistoreturn

Page 45: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

isRequestedSessionIdFromCookie()onthewrappedrequestobject.isRequestedSessionIdFromUrl()-Methodininterfacejavax.servlet.http.HttpServletRequest

Deprecated.AsofVersion2.1oftheJavaServletAPI,useHttpServletRequest.isRequestedSessionIdFromURL()instead.

isRequestedSessionIdFromUrl()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturnisRequestedSessionIdFromUrl()onthewrappedrequestobject.

isRequestedSessionIdFromURL()-Methodininterfacejavax.servlet.http.HttpServletRequest

CheckswhethertherequestedsessionIDcameinaspartoftherequestURL.

isRequestedSessionIdFromURL()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturnisRequestedSessionIdFromURL()onthewrappedrequestobject.

isRequestedSessionIdValid()-Methodininterfacejavax.servlet.http.HttpServletRequest

CheckswhethertherequestedsessionIDisstillvalid.isRequestedSessionIdValid()-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturnisRequestedSessionIdValid()onthewrappedrequestobject.

isSecure()-Methodinclassjavax.servlet.ServletRequestWrapperThedefaultbehaviorofthismethodistoreturnisSecure()onthewrappedrequestobject.

isSecure()-Methodininterfacejavax.servlet.ServletRequestReturnsabooleanindicatingwhetherthisrequestwasmadeusingasecurechannel,suchasHTTPS.

isUserInRole(String)-Methodininterfacejavax.servlet.http.HttpServletRequest

Returnsabooleanindicatingwhethertheauthenticateduserisincludedinthespecifiedlogical"role".

isUserInRole(String)-Methodinclassjavax.servlet.http.HttpServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturnisUserInRole(Stringrole)onthewrappedrequestobject.

Page 46: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

J

javax.servlet-packagejavax.servlet

javax.servlet.http-packagejavax.servlet.http

Page 47: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

L

log(Exception,String)-Methodininterfacejavax.servlet.ServletContextDeprecated.AsofJavaServletAPI2.1,useServletContext.log(Stringmessage,Throwablethrowable)instead.

Thismethodwasoriginallydefinedtowriteanexception'sstacktraceandanexplanatoryerrormessagetotheservletlogfile.

log(String)-Methodininterfacejavax.servlet.ServletContextWritesthespecifiedmessagetoaservletlogfile,usuallyaneventlog.

log(String)-Methodinclassjavax.servlet.GenericServletWritesthespecifiedmessagetoaservletlogfile,prependedbytheservlet'sname.

log(String,Throwable)-Methodininterfacejavax.servlet.ServletContextWritesanexplanatorymessageandastacktraceforagivenThrowableexceptiontotheservletlogfile.

log(String,Throwable)-Methodinclassjavax.servlet.GenericServletWritesanexplanatorymessageandastacktraceforagivenThrowableexceptiontotheservletlogfile,prependedbytheservlet'sname.

Page 48: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

P

parsePostData(int,ServletInputStream)-Staticmethodinclassjavax.servlet.http.HttpUtils

Deprecated.ParsesdatafromanHTMLformthattheclientsendstotheserverusingtheHTTPPOSTmethodandtheapplication/x-www-form-urlencodedMIMEtype.

parseQueryString(String)-Staticmethodinclassjavax.servlet.http.HttpUtilsDeprecated.ParsesaquerystringpassedfromtheclienttotheserverandbuildsaHashTableobjectwithkey-valuepairs.

print(boolean)-Methodinclassjavax.servlet.ServletOutputStreamWritesabooleanvaluetotheclient,withnocarriagereturn-linefeed(CRLF)characterattheend.

print(char)-Methodinclassjavax.servlet.ServletOutputStreamWritesacharactertotheclient,withnocarriagereturn-linefeed(CRLF)attheend.

print(double)-Methodinclassjavax.servlet.ServletOutputStreamWritesadoublevaluetotheclient,withnocarriagereturn-linefeed(CRLF)attheend.

print(float)-Methodinclassjavax.servlet.ServletOutputStreamWritesafloatvaluetotheclient,withnocarriagereturn-linefeed(CRLF)attheend.

print(int)-Methodinclassjavax.servlet.ServletOutputStreamWritesaninttotheclient,withnocarriagereturn-linefeed(CRLF)attheend.

print(long)-Methodinclassjavax.servlet.ServletOutputStreamWritesalongvaluetotheclient,withnocarriagereturn-linefeed(CRLF)attheend.

print(String)-Methodinclassjavax.servlet.ServletOutputStreamWritesaStringtotheclient,withoutacarriagereturn-linefeed(CRLF)characterattheend.

println()-Methodinclassjavax.servlet.ServletOutputStreamWritesacarriagereturn-linefeed(CRLF)totheclient.

println(boolean)-Methodinclassjavax.servlet.ServletOutputStreamWritesabooleanvaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).

println(char)-Methodinclassjavax.servlet.ServletOutputStream

Page 49: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Writesacharactertotheclient,followedbyacarriagereturn-linefeed(CRLF).

println(double)-Methodinclassjavax.servlet.ServletOutputStreamWritesadoublevaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).

println(float)-Methodinclassjavax.servlet.ServletOutputStreamWritesafloatvaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).

println(int)-Methodinclassjavax.servlet.ServletOutputStreamWritesaninttotheclient,followedbyacarriagereturn-linefeed(CRLF)character.

println(long)-Methodinclassjavax.servlet.ServletOutputStreamWritesalongvaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).

println(String)-Methodinclassjavax.servlet.ServletOutputStreamWritesaStringtotheclient,followedbyacarriagereturn-linefeed(CRLF).

putValue(String,Object)-Methodininterfacejavax.servlet.http.HttpSessionDeprecated.AsofVersion2.2,thismethodisreplacedbyHttpSession.setAttribute(java.lang.String,java.lang.Object)

Page 50: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

R

readLine(byte[],int,int)-Methodinclassjavax.servlet.ServletInputStreamReadstheinputstream,onelineatatime.

removeAttribute(String)-Methodininterfacejavax.servlet.ServletContextRemovestheattributewiththegivennamefromtheservletcontext.

removeAttribute(String)-Methodinclassjavax.servlet.ServletRequestWrapper

ThedefaultbehaviorofthismethodistocallremoveAttribute(Stringname)onthewrappedrequestobject.

removeAttribute(String)-Methodininterfacejavax.servlet.ServletRequestRemovesanattributefromthisrequest.

removeAttribute(String)-Methodininterfacejavax.servlet.http.HttpSessionRemovestheobjectboundwiththespecifiednamefromthissession.

removeValue(String)-Methodininterfacejavax.servlet.http.HttpSessionDeprecated.AsofVersion2.2,thismethodisreplacedbyHttpSession.removeAttribute(java.lang.String)

RequestDispatcher-interfacejavax.servlet.RequestDispatcher.Definesanobjectthatreceivesrequestsfromtheclientandsendsthemtoanyresource(suchasaservlet,HTMLfile,orJSPfile)ontheserver.

reset()-Methodininterfacejavax.servlet.ServletResponseClearsanydatathatexistsinthebufferaswellasthestatuscodeandheaders.

reset()-Methodinclassjavax.servlet.ServletResponseWrapperThedefaultbehaviorofthismethodistocallreset()onthewrappedresponseobject.

resetBuffer()-Methodininterfacejavax.servlet.ServletResponseClearsthecontentoftheunderlyingbufferintheresponsewithoutclearingheadersorstatuscode.

resetBuffer()-Methodinclassjavax.servlet.ServletResponseWrapperThedefaultbehaviorofthismethodistocallresetBuffer()onthewrappedresponseobject.

Page 51: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

S

SC_ACCEPTED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(202)indicatingthatarequestwasacceptedforprocessing,butwasnotcompleted.

SC_BAD_GATEWAY-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(502)indicatingthattheHTTPserverreceivedaninvalidresponsefromaserveritconsultedwhenactingasaproxyorgateway.

SC_BAD_REQUEST-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(400)indicatingtherequestsentbytheclientwassyntacticallyincorrect.

SC_CONFLICT-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(409)indicatingthattherequestcouldnotbecompletedduetoaconflictwiththecurrentstateoftheresource.

SC_CONTINUE-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(100)indicatingtheclientcancontinue.SC_CREATED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(201)indicatingtherequestsucceededandcreatedanewresourceontheserver.

SC_EXPECTATION_FAILED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(417)indicatingthattheservercouldnotmeettheexpectationgivenintheExpectrequestheader.

SC_FORBIDDEN-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(403)indicatingtheserverunderstoodtherequestbutrefusedtofulfillit.

SC_GATEWAY_TIMEOUT-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(504)indicatingthattheserverdidnotreceiveatimelyresponsefromtheupstreamserverwhileactingasagatewayorproxy.

Page 52: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SC_GONE-Staticvariableininterfacejavax.servlet.http.HttpServletResponseStatuscode(410)indicatingthattheresourceisnolongeravailableattheserverandnoforwardingaddressisknown.

SC_HTTP_VERSION_NOT_SUPPORTED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(505)indicatingthattheserverdoesnotsupportorrefusestosupporttheHTTPprotocolversionthatwasusedintherequestmessage.

SC_INTERNAL_SERVER_ERROR-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(500)indicatinganerrorinsidetheHTTPserverwhichpreventeditfromfulfillingtherequest.

SC_LENGTH_REQUIRED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(411)indicatingthattherequestcannotbehandledwithoutadefinedContent-Length.

SC_METHOD_NOT_ALLOWED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(405)indicatingthatthemethodspecifiedintheRequest-LineisnotallowedfortheresourceidentifiedbytheRequest-URI.

SC_MOVED_PERMANENTLY-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(301)indicatingthattheresourcehaspermanentlymovedtoanewlocation,andthatfuturereferencesshoulduseanewURIwiththeirrequests.

SC_MOVED_TEMPORARILY-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(302)indicatingthattheresourcehastemporarilymovedtoanotherlocation,butthatfuturereferencesshouldstillusetheoriginalURItoaccesstheresource.

SC_MULTIPLE_CHOICES-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(300)indicatingthattherequestedresourcecorrespondstoanyoneofasetofrepresentations,eachwithitsownspecificlocation.

SC_NO_CONTENT-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(204)indicatingthattherequestsucceededbutthattherewasnonewinformationtoreturn.

SC_NON_AUTHORITATIVE_INFORMATION-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Page 53: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Statuscode(203)indicatingthatthemetainformationpresentedbytheclientdidnotoriginatefromtheserver.

SC_NOT_ACCEPTABLE-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(406)indicatingthattheresourceidentifiedbytherequestisonlycapableofgeneratingresponseentitieswhichhavecontentcharacteristicsnotacceptableaccordingtotheacceptheaderssentintherequest.

SC_NOT_FOUND-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(404)indicatingthattherequestedresourceisnotavailable.SC_NOT_IMPLEMENTED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(501)indicatingtheHTTPserverdoesnotsupportthefunctionalityneededtofulfilltherequest.

SC_NOT_MODIFIED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(304)indicatingthataconditionalGEToperationfoundthattheresourcewasavailableandnotmodified.

SC_OK-Staticvariableininterfacejavax.servlet.http.HttpServletResponseStatuscode(200)indicatingtherequestsucceedednormally.

SC_PARTIAL_CONTENT-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(206)indicatingthattheserverhasfulfilledthepartialGETrequestfortheresource.

SC_PAYMENT_REQUIRED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(402)reservedforfutureuse.SC_PRECONDITION_FAILED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(412)indicatingthatthepreconditiongiveninoneormoreoftherequest-headerfieldsevaluatedtofalsewhenitwastestedontheserver.

SC_PROXY_AUTHENTICATION_REQUIRED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(407)indicatingthattheclientMUSTfirstauthenticateitselfwiththeproxy.

SC_REQUEST_ENTITY_TOO_LARGE-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(413)indicatingthattheserverisrefusingtoprocesstherequest

Page 54: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

becausetherequestentityislargerthantheserveriswillingorabletoprocess.

SC_REQUEST_TIMEOUT-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(408)indicatingthattheclientdidnotproducearequestwithinthetimethattheserverwaspreparedtowait.

SC_REQUEST_URI_TOO_LONG-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(414)indicatingthattheserverisrefusingtoservicetherequestbecausetheRequest-URIislongerthantheserveriswillingtointerpret.

SC_REQUESTED_RANGE_NOT_SATISFIABLE-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(416)indicatingthattheservercannotservetherequestedbyterange.

SC_RESET_CONTENT-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(205)indicatingthattheagentSHOULDresetthedocumentviewwhichcausedtherequesttobesent.

SC_SEE_OTHER-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(303)indicatingthattheresponsetotherequestcanbefoundunderadifferentURI.

SC_SERVICE_UNAVAILABLE-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(503)indicatingthattheHTTPserveristemporarilyoverloaded,andunabletohandletherequest.

SC_SWITCHING_PROTOCOLS-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(101)indicatingtheserverisswitchingprotocolsaccordingtoUpgradeheader.

SC_TEMPORARY_REDIRECT-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(307)indicatingthattherequestedresourceresidestemporarilyunderadifferentURI.

SC_UNAUTHORIZED-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(401)indicatingthattherequestrequiresHTTPauthentication.SC_UNSUPPORTED_MEDIA_TYPE-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Page 55: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Statuscode(415)indicatingthattheserverisrefusingtoservicetherequestbecausetheentityoftherequestisinaformatnotsupportedbytherequestedresourcefortherequestedmethod.

SC_USE_PROXY-Staticvariableininterfacejavax.servlet.http.HttpServletResponse

Statuscode(305)indicatingthattherequestedresourceMUSTbeaccessedthroughtheproxygivenbytheLocationfield.

sendError(int)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistocallsendError(intsc)onthewrappedresponseobject.

sendError(int)-Methodininterfacejavax.servlet.http.HttpServletResponseSendsanerrorresponsetotheclientusingthespecifiedstatuscodeandclearingthebuffer.

sendError(int,String)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistocallsendError(intsc,Stringmsg)onthewrappedresponseobject.

sendError(int,String)-Methodininterfacejavax.servlet.http.HttpServletResponse

Sendsanerrorresponsetotheclientusingthespecifiedstatusclearingthebuffer.

sendRedirect(String)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistoreturnsendRedirect(Stringlocation)onthewrappedresponseobject.

sendRedirect(String)-Methodininterfacejavax.servlet.http.HttpServletResponse

SendsatemporaryredirectresponsetotheclientusingthespecifiedredirectlocationURL.

service(HttpServletRequest,HttpServletResponse)-Methodinclassjavax.servlet.http.HttpServlet

ReceivesstandardHTTPrequestsfromthepublicservicemethodanddispatchesthemtothedoXXXmethodsdefinedinthisclass.

service(ServletRequest,ServletResponse)-Methodininterfacejavax.servlet.Servlet

Calledbytheservletcontainertoallowtheservlettorespondtoarequest.service(ServletRequest,ServletResponse)-Methodinclassjavax.servlet.GenericServlet

Page 56: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Calledbytheservletcontainertoallowtheservlettorespondtoarequest.service(ServletRequest,ServletResponse)-Methodinclassjavax.servlet.http.HttpServlet

Dispatchesclientrequeststotheprotectedservicemethod.Servlet-interfacejavax.servlet.Servlet.

Definesmethodsthatallservletsmustimplement.ServletConfig-interfacejavax.servlet.ServletConfig.

Aservletconfigurationobjectusedbyaservletcontainerusedtopassinformationtoaservletduringinitialization.

ServletContext-interfacejavax.servlet.ServletContext.Definesasetofmethodsthataservletusestocommunicatewithitsservletcontainer,forexample,togettheMIMEtypeofafile,dispatchrequests,orwritetoalogfile.

ServletContextAttributeEvent-classjavax.servlet.ServletContextAttributeEvent.

Thisistheeventclassfornotificationsaboutchangestotheattributesoftheservletcontextofawebapplication.

ServletContextAttributeEvent(ServletContext,String,Object)-Constructorforclassjavax.servlet.ServletContextAttributeEvent

ConstructaServletContextAttributeEventfromthegivencontextforthegivenattributenameandattributevalue.

ServletContextAttributeListener-interfacejavax.servlet.ServletContextAttributeListener.

Implementationsofthisinterfacerecievenotificationsofchangestotheattributelistontheservletcontextofawebapplication.

ServletContextEvent-classjavax.servlet.ServletContextEvent.Thisistheeventclassfornotificationsaboutchangestotheservletcontextofawebapplication.

ServletContextEvent(ServletContext)-Constructorforclassjavax.servlet.ServletContextEvent

ConstructaServletContextEventfromthegivencontext.ServletContextListener-interfacejavax.servlet.ServletContextListener.

Implementationsofthisinterfacerecievenotificationsaboutchangestotheservletcontextofthewebapplicationtheyarepartof.

ServletException-exceptionjavax.servlet.ServletException.Definesageneralexceptionaservletcanthrowwhenitencountersdifficulty.

ServletException()-Constructorforclassjavax.servlet.ServletExceptionConstructsanewservletexception.

Page 57: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ServletException(String)-Constructorforclassjavax.servlet.ServletExceptionConstructsanewservletexceptionwiththespecifiedmessage.

ServletException(String,Throwable)-Constructorforclassjavax.servlet.ServletException

Constructsanewservletexceptionwhentheservletneedstothrowanexceptionandincludeamessageaboutthe"rootcause"exceptionthatinterferedwithitsnormaloperation,includingadescriptionmessage.

ServletException(Throwable)-Constructorforclassjavax.servlet.ServletException

Constructsanewservletexceptionwhentheservletneedstothrowanexceptionandincludeamessageaboutthe"rootcause"exceptionthatinterferedwithitsnormaloperation.

ServletInputStream-classjavax.servlet.ServletInputStream.Providesaninputstreamforreadingbinarydatafromaclientrequest,includinganefficientreadLinemethodforreadingdataonelineatatime.

ServletInputStream()-Constructorforclassjavax.servlet.ServletInputStreamDoesnothing,becausethisisanabstractclass.

ServletOutputStream-classjavax.servlet.ServletOutputStream.Providesanoutputstreamforsendingbinarydatatotheclient.

ServletOutputStream()-Constructorforclassjavax.servlet.ServletOutputStream

Doesnothing,becausethisisanabstractclass.ServletRequest-interfacejavax.servlet.ServletRequest.

Definesanobjecttoprovideclientrequestinformationtoaservlet.ServletRequestWrapper-classjavax.servlet.ServletRequestWrapper.

ProvidesaconvenientimplementationoftheServletRequestinterfacethatcanbesubclassedbydeveloperswishingtoadapttherequesttoaServlet.

ServletRequestWrapper(ServletRequest)-Constructorforclassjavax.servlet.ServletRequestWrapper

CreatesaServletRequestadaptorwrappingthegivenrequestobject.ServletResponse-interfacejavax.servlet.ServletResponse.

Definesanobjecttoassistaservletinsendingaresponsetotheclient.ServletResponseWrapper-classjavax.servlet.ServletResponseWrapper.

ProvidesaconvenientimplementationoftheServletResponseinterfacethatcanbesubclassedbydeveloperswishingtoadapttheresponsefromaServlet.

ServletResponseWrapper(ServletResponse)-Constructorforclassjavax.servlet.ServletResponseWrapper

CreatesaServletResponseadaptorwrappingthegivenresponseobject.

Page 58: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

sessionCreated(HttpSessionEvent)-Methodininterfacejavax.servlet.http.HttpSessionListener

Notificationthatasessionwascreated.sessionDestroyed(HttpSessionEvent)-Methodininterfacejavax.servlet.http.HttpSessionListener

Notificationthatasessionwasinvalidated.sessionDidActivate(HttpSessionEvent)-Methodininterfacejavax.servlet.http.HttpSessionActivationListener

Notificationthatthesessionhasjustbeenactivated.sessionWillPassivate(HttpSessionEvent)-Methodininterfacejavax.servlet.http.HttpSessionActivationListener

Notificationthatthesessionisabouttobepassivated.setAttribute(String,Object)-Methodininterfacejavax.servlet.ServletContext

Bindsanobjecttoagivenattributenameinthisservletcontext.setAttribute(String,Object)-Methodinclassjavax.servlet.ServletRequestWrapper

ThedefaultbehaviorofthismethodistoreturnsetAttribute(Stringname,Objecto)onthewrappedrequestobject.

setAttribute(String,Object)-Methodininterfacejavax.servlet.ServletRequestStoresanattributeinthisrequest.

setAttribute(String,Object)-Methodininterfacejavax.servlet.http.HttpSession

Bindsanobjecttothissession,usingthenamespecified.setBufferSize(int)-Methodininterfacejavax.servlet.ServletResponse

Setsthepreferredbuffersizeforthebodyoftheresponse.setBufferSize(int)-Methodinclassjavax.servlet.ServletResponseWrapper

ThedefaultbehaviorofthismethodistocallsetBufferSize(intsize)onthewrappedresponseobject.

setCharacterEncoding(String)-Methodinclassjavax.servlet.ServletRequestWrapper

Thedefaultbehaviorofthismethodistosetthecharacterencodingonthewrappedrequestobject.

setCharacterEncoding(String)-Methodininterfacejavax.servlet.ServletRequest

Overridesthenameofthecharacterencodingusedinthebodyofthisrequest.

setComment(String)-Methodinclassjavax.servlet.http.CookieSpecifiesacommentthatdescribesacookie'spurpose.

setContentLength(int)-Methodininterfacejavax.servlet.ServletResponse

Page 59: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SetsthelengthofthecontentbodyintheresponseInHTTPservlets,thismethodsetstheHTTPContent-Lengthheader.

setContentLength(int)-Methodinclassjavax.servlet.ServletResponseWrapperThedefaultbehaviorofthismethodistocallsetContentLength(intlen)onthewrappedresponseobject.

setContentType(String)-Methodininterfacejavax.servlet.ServletResponseSetsthecontenttypeoftheresponsebeingsenttotheclient.

setContentType(String)-Methodinclassjavax.servlet.ServletResponseWrapper

ThedefaultbehaviorofthismethodistocallsetContentType(Stringtype)onthewrappedresponseobject.

setDateHeader(String,long)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistocallsetDateHeader(Stringname,longdate)onthewrappedresponseobject.

setDateHeader(String,long)-Methodininterfacejavax.servlet.http.HttpServletResponse

Setsaresponseheaderwiththegivennameanddate-value.setDomain(String)-Methodinclassjavax.servlet.http.Cookie

Specifiesthedomainwithinwhichthiscookieshouldbepresented.setHeader(String,String)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistoreturnsetHeader(Stringname,Stringvalue)onthewrappedresponseobject.

setHeader(String,String)-Methodininterfacejavax.servlet.http.HttpServletResponse

Setsaresponseheaderwiththegivennameandvalue.setIntHeader(String,int)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistocallsetIntHeader(Stringname,intvalue)onthewrappedresponseobject.

setIntHeader(String,int)-Methodininterfacejavax.servlet.http.HttpServletResponse

Setsaresponseheaderwiththegivennameandintegervalue.setLocale(Locale)-Methodininterfacejavax.servlet.ServletResponse

Setsthelocaleoftheresponse,settingtheheaders(includingtheContent-Type'scharset)asappropriate.

setLocale(Locale)-Methodinclassjavax.servlet.ServletResponseWrapperThedefaultbehaviorofthismethodistocallsetLocale(Localeloc)onthe

Page 60: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

wrappedresponseobject.setMaxAge(int)-Methodinclassjavax.servlet.http.Cookie

Setsthemaximumageofthecookieinseconds.setMaxInactiveInterval(int)-Methodininterfacejavax.servlet.http.HttpSession

Specifiesthetime,inseconds,betweenclientrequestsbeforetheservletcontainerwillinvalidatethissession.

setPath(String)-Methodinclassjavax.servlet.http.CookieSpecifiesapathforthecookietowhichtheclientshouldreturnthecookie.

setRequest(ServletRequest)-Methodinclassjavax.servlet.ServletRequestWrapper

Setstherequestobjectbeingwrapped.setResponse(ServletResponse)-Methodinclassjavax.servlet.ServletResponseWrapper

Setstheresponsebeingwrapped.setSecure(boolean)-Methodinclassjavax.servlet.http.Cookie

Indicatestothebrowserwhetherthecookieshouldonlybesentusingasecureprotocol,suchasHTTPSorSSL.

setStatus(int)-Methodinclassjavax.servlet.http.HttpServletResponseWrapperThedefaultbehaviorofthismethodistocallsetStatus(intsc)onthewrappedresponseobject.

setStatus(int)-Methodininterfacejavax.servlet.http.HttpServletResponseSetsthestatuscodeforthisresponse.

setStatus(int,String)-Methodinclassjavax.servlet.http.HttpServletResponseWrapper

ThedefaultbehaviorofthismethodistocallsetStatus(intsc,Stringsm)onthewrappedresponseobject.

setStatus(int,String)-Methodininterfacejavax.servlet.http.HttpServletResponse

Deprecated.Asofversion2.1,duetoambiguousmeaningofthemessageparameter.TosetastatuscodeusesetStatus(int),tosendanerrorwithadescriptionusesendError(int,String).Setsthestatuscodeandmessageforthisresponse.

setValue(String)-Methodinclassjavax.servlet.http.CookieAssignsanewvaluetoacookieafterthecookieiscreated.

setVersion(int)-Methodinclassjavax.servlet.http.CookieSetstheversionofthecookieprotocolthiscookiecomplieswith.

SingleThreadModel-interfacejavax.servlet.SingleThreadModel.Ensuresthatservletshandleonlyonerequestatatime.

Page 61: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index
Page 62: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

U

UnavailableException-exceptionjavax.servlet.UnavailableException.Definesanexceptionthataservletorfilterthrowstoindicatethatitispermanentlyortemporarilyunavailable.

UnavailableException(int,Servlet,String)-Constructorforclassjavax.servlet.UnavailableException

Deprecated.AsofJavaServletAPI2.2,useUnavailableException.UnavailableException(String,int)instead.

UnavailableException(Servlet,String)-Constructorforclassjavax.servlet.UnavailableException

Deprecated.AsofJavaServletAPI2.2,useUnavailableException.UnavailableException(String)instead.

UnavailableException(String)-Constructorforclassjavax.servlet.UnavailableException

Constructsanewexceptionwithadescriptivemessageindicatingthattheservletispermanentlyunavailable.

UnavailableException(String,int)-Constructorforclassjavax.servlet.UnavailableException

Constructsanewexceptionwithadescriptivemessageindicatingthattheservletistemporarilyunavailableandgivinganestimateofhowlongitwillbeunavailable.

Page 63: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

V

valueBound(HttpSessionBindingEvent)-Methodininterfacejavax.servlet.http.HttpSessionBindingListener

Notifiestheobjectthatitisbeingboundtoasessionandidentifiesthesession.

valueUnbound(HttpSessionBindingEvent)-Methodininterfacejavax.servlet.http.HttpSessionBindingListener

Notifiestheobjectthatitisbeingunboundfromasessionandidentifiesthesession.

ABCDEFGHIJLPRSUVOverview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 64: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 65: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

DeprecatedAPI

DeprecatedClassesjavax.servlet.http.HttpUtilsAsofJava(tm)ServletAPI2.3.Thesemethodswereonlyusefulwiththedefaultencodingandhavebeenmovedtotherequestinterfaces.

DeprecatedInterfacesjavax.servlet.http.HttpSessionContextAsofJava(tm)ServletAPI2.1forsecurityreasons,withnoreplacement.ThisinterfacewillberemovedinafutureversionofthisAPI.

DeprecatedMethodsjavax.servlet.http.HttpServletResponse.encodeRedirectUrl(String)Asofversion2.1,useencodeRedirectURL(Stringurl)insteadjavax.servlet.http.HttpServletResponse.encodeUrl(String)Asofversion2.1,useencodeURL(Stringurl)insteadjavax.servlet.http.HttpSessionContext.getIds()AsofJavaServletAPI2.1withnoreplacement.ThismethodmustreturnanemptyEnumerationandwillberemovedinafutureversionofthisAPI.javax.servlet.ServletRequest.getRealPath(String)AsofVersion2.1oftheJavaServletAPI,useServletContext.getRealPath(java.lang.String)instead.javax.servlet.UnavailableException.getServlet()AsofJavaServletAPI2.2,withnoreplacement.Returnstheservletthatisreportingitsunavailability.javax.servlet.ServletContext.getServlet(String)AsofJavaServletAPI2.1,withnodirectreplacement.

ThismethodwasoriginallydefinedtoretrieveaservletfromaServletContext.Inthisversion,thismethodalwaysreturnsnullandremains

Page 66: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

onlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

Inlieuofthismethod,servletscanshareinformationusingtheServletContextclassandcanperformsharedbusinesslogicbyinvokingmethodsoncommonnon-servletclasses.

javax.servlet.ServletContext.getServletNames()AsofJavaServletAPI2.1,withnoreplacement.

ThismethodwasoriginallydefinedtoreturnanEnumerationofalltheservletnamesknowntothiscontext.Inthisversion,thismethodalwaysreturnsanemptyEnumerationandremainsonlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

javax.servlet.ServletContext.getServlets()AsofJavaServletAPI2.0,withnoreplacement.

ThismethodwasoriginallydefinedtoreturnanEnumerationofalltheservletsknowntothisservletcontext.Inthisversion,thismethodalwaysreturnsanemptyenumerationandremainsonlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

javax.servlet.http.HttpSessionContext.getSession(String)AsofJavaServletAPI2.1withnoreplacement.ThismethodmustreturnnullandwillberemovedinafutureversionofthisAPI.javax.servlet.http.HttpSession.getSessionContext()AsofVersion2.1,thismethodisdeprecatedandhasnoreplacement.ItwillberemovedinafutureversionoftheJavaServletAPI.javax.servlet.http.HttpSession.getValue(String)AsofVersion2.2,thismethodisreplacedbyHttpSession.getAttribute(java.lang.String).javax.servlet.http.HttpSession.getValueNames()AsofVersion2.2,thismethodisreplacedbyHttpSession.getAttributeNames()javax.servlet.http.HttpServletRequest.isRequestedSessionIdFromUrl()

Page 67: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

AsofVersion2.1oftheJavaServletAPI,useHttpServletRequest.isRequestedSessionIdFromURL()instead.

javax.servlet.ServletContext.log(Exception,String)AsofJavaServletAPI2.1,useServletContext.log(Stringmessage,Throwablethrowable)instead.

Thismethodwasoriginallydefinedtowriteanexception'sstacktraceandanexplanatoryerrormessagetotheservletlogfile.

javax.servlet.http.HttpSession.putValue(String,Object)AsofVersion2.2,thismethodisreplacedbyHttpSession.setAttribute(java.lang.String,java.lang.Object)javax.servlet.http.HttpSession.removeValue(String)AsofVersion2.2,thismethodisreplacedbyHttpSession.removeAttribute(java.lang.String)javax.servlet.http.HttpServletResponse.setStatus(int,String)Asofversion2.1,duetoambiguousmeaningofthemessageparameter.TosetastatuscodeusesetStatus(int),tosendanerrorwithadescriptionusesendError(int,String).Setsthestatuscodeandmessageforthisresponse.

DeprecatedConstructorsjavax.servlet.UnavailableException(int,Servlet,String)AsofJavaServletAPI2.2,useUnavailableException.UnavailableException(String,int)instead.javax.servlet.UnavailableException(Servlet,String)AsofJavaServletAPI2.2,useUnavailableException.UnavailableException(String)instead.

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 68: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Packagesjavax.servlet javax.servlet.http

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 69: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 70: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

HierarchyForPackagejavax.servlet

PackageHierarchies:AllPackages

Page 71: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ClassHierarchy

classjava.lang.Objectclassjava.util.EventObject(implementsjava.io.Serializable)

classjavax.servlet.ServletContextEventclassjavax.servlet.ServletContextAttributeEvent

classjavax.servlet.GenericServlet(implementsjava.io.Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig)classjava.io.InputStream

classjavax.servlet.ServletInputStreamclassjava.io.OutputStream

classjavax.servlet.ServletOutputStreamclassjavax.servlet.ServletRequestWrapper(implementsjavax.servlet.ServletRequest)classjavax.servlet.ServletResponseWrapper(implementsjavax.servlet.ServletResponse)classjava.lang.Throwable(implementsjava.io.Serializable)

classjava.lang.Exceptionclassjavax.servlet.ServletException

classjavax.servlet.UnavailableException

Page 72: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

InterfaceHierarchy

interfacejava.util.EventListenerinterfacejavax.servlet.ServletContextAttributeListenerinterfacejavax.servlet.ServletContextListener

interfacejavax.servlet.Filterinterfacejavax.servlet.FilterChaininterfacejavax.servlet.FilterConfiginterfacejavax.servlet.RequestDispatcherinterfacejavax.servlet.Servletinterfacejavax.servlet.ServletConfiginterfacejavax.servlet.ServletContextinterfacejavax.servlet.ServletRequestinterfacejavax.servlet.ServletResponseinterfacejavax.servlet.SingleThreadModel

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 73: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVPACKAGENEXTPACKAGE FRAMESNOFRAMES

Page 74: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Packagejavax.servlet

InterfaceSummary

Filter

Afilterisanobjectthanperformfilteringtasksoneithertherequesttoaresource(aservletorstaticcontent),orontheresponsefromaresource,orboth.

FiltersperformfilteringinthedoFiltermethod.

FilterChain

AFilterChainisanobjectprovidedbytheservletcontainertothedevelopergivingaviewintotheinvocationchainofafilteredrequestforaresource.

FilterConfigAfilterconfigurationobjectusedbyaservletcontainerusedtopassinformationtoafilterduringinitialization.

RequestDispatcher

Definesanobjectthatreceivesrequestsfromtheclientandsendsthemtoanyresource(suchasaservlet,HTMLfile,orJSPfile)ontheserver.

Servlet Definesmethodsthatallservletsmustimplement.

ServletConfigAservletconfigurationobjectusedbyaservletcontainerusedtopassinformationtoaservletduringinitialization.

ServletContext

Definesasetofmethodsthataservletusestocommunicatewithitsservletcontainer,forexample,togettheMIMEtypeofafile,dispatchrequests,orwritetoalogfile.

ServletContextAttributeListenerImplementationsofthisinterfacerecievenotificationsofchangestotheattributelistontheservletcontextofawebapplication.Implementationsofthisinterfacerecieve

Page 75: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ServletContextListener notificationsaboutchangestotheservletcontextofthewebapplicationtheyarepartof.

ServletRequest Definesanobjecttoprovideclientrequestinformationtoaservlet.

ServletResponse Definesanobjecttoassistaservletinsendingaresponsetotheclient.

SingleThreadModel Ensuresthatservletshandleonlyonerequestatatime.

ClassSummaryGenericServlet Definesageneric,protocol-independent

servlet.

ServletContextAttributeEventThisistheeventclassfornotificationsaboutchangestotheattributesoftheservletcontextofawebapplication.

ServletContextEventThisistheeventclassfornotificationsaboutchangestotheservletcontextofawebapplication.

ServletInputStream

Providesaninputstreamforreadingbinarydatafromaclientrequest,includinganefficientreadLinemethodforreadingdataonelineatatime.

ServletOutputStream Providesanoutputstreamforsendingbinarydatatotheclient.

ServletRequestWrapper

ProvidesaconvenientimplementationoftheServletRequestinterfacethatcanbesubclassedbydeveloperswishingtoadapttherequesttoaServlet.

ServletResponseWrapper

ProvidesaconvenientimplementationoftheServletResponseinterfacethatcanbesubclassedbydeveloperswishingtoadapttheresponsefromaServlet.

Page 76: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ExceptionSummaryServletException Definesageneralexceptionaservletcanthrowwhenit

encountersdifficulty.

UnavailableExceptionDefinesanexceptionthataservletorfilterthrowstoindicatethatitispermanentlyortemporarilyunavailable.

Overview Package Class Tree Deprecated IndexHelpPREVPACKAGENEXTPACKAGE FRAMESNOFRAMES

Page 77: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 78: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceSingleThreadModel

publicabstractinterfaceSingleThreadModel

Ensuresthatservletshandleonlyonerequestatatime.Thisinterfacehasnomethods.

Ifaservletimplementsthisinterface,youareguaranteedthatnotwothreadswillexecuteconcurrentlyintheservlet'sservicemethod.Theservletcontainercanmakethisguaranteebysynchronizingaccesstoasingleinstanceoftheservlet,orbymaintainingapoolofservletinstancesanddispatchingeachnewrequesttoafreeservlet.

Thisinterfacedoesnotpreventsynchronizationproblemsthatresultfromservletsaccessingsharedresourcessuchasstaticclassvariablesorclassesoutsidethescopeoftheservlet.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 79: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 80: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceFilter

publicabstractinterfaceFilter

Afilterisanobjectthanperformfilteringtasksoneithertherequesttoaresource(aservletorstaticcontent),orontheresponsefromaresource,orboth.

FiltersperformfilteringinthedoFiltermethod.EveryFilterhasaccesstoaFilterConfigobjectfromwhichitcanobtainitsinitializationparameters,areferencetotheServletContextwhichitcanuse,forexample,toloadresourcesneededforfilteringtasks.

Filtersareconfiguredinthedeploymentdescriptorofawebapplication

Examplesthathavebeenidentifiedforthisdesignare1)AuthenticationFilters2)LoggingandAuditingFilters3)ImageconversionFilters4)DatacompressionFilters5)EncryptionFilters6)TokenizingFilters7)Filtersthattriggerresourceaccessevents8)XSL/Tfilters9)Mime-typechainFilter

Since:Servlet2.3

MethodSummary

void

destroy()Calledbythewebcontainertoindicatetoafilterthatitisbeingtakenoutofservice.

void

doFilter(ServletRequestrequest,ServletResponseresponse,

FilterChainchain)ThedoFiltermethodoftheFilteriscalledbythecontainereach

Page 81: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

timearequest/responsepairispassedthroughthechainduetoaclientrequestforaresourceattheendofthechain.

void

init(FilterConfigfilterConfig)Calledbythewebcontainertoindicatetoafilterthatitisbeingplacedintoservice.

MethodDetail

init

publicvoidinit(FilterConfigfilterConfig)

throwsServletException

Calledbythewebcontainertoindicatetoafilterthatitisbeingplacedintoservice.Theservletcontainercallstheinitmethodexactlyonceafterinstantiatingthefilter.Theinitmethodmustcompletesuccessfullybeforethefilterisaskedtodoanyfilteringwork.

Thewebcontainercannotplacethefilterintoserviceiftheinitmethodeither1.ThrowsaServletException2.Doesnotreturnwithinatimeperioddefinedbythewebcontainer

doFilter

publicvoiddoFilter(ServletRequestrequest,

ServletResponseresponse,

FilterChainchain)

throwsjava.io.IOException,

ServletException

ThedoFiltermethodoftheFilteriscalledbythecontainereachtimearequest/responsepairispassedthroughthechainduetoaclientrequestforaresourceattheendofthechain.TheFilterChainpassedintothismethodallowstheFiltertopassontherequestandresponsetothenextentityinthechain.

Page 82: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Atypicalimplementationofthismethodwouldfollowthefollowingpattern:-1.Examinetherequest2.Optionallywraptherequestobjectwithacustomimplementationtofiltercontentorheadersforinputfiltering3.Optionallywraptheresponseobjectwithacustomimplementationtofiltercontentorheadersforoutputfiltering4.a)EitherinvokethenextentityinthechainusingtheFilterChainobject(chain.doFilter()),4.b)ornotpassontherequest/responsepairtothenextentityinthefilterchaintoblocktherequestprocessing5.Directlysetheadersontheresponseafterinvokationofthenextentityintherfilterchain.

destroy

publicvoiddestroy()

Calledbythewebcontainertoindicatetoafilterthatitisbeingtakenoutofservice.Thismethodisonlycalledonceallthreadswithinthefilter'sdoFiltermethodhaveexitedorafteratimeoutperiodhaspassed.Afterthewebcontainercallsthismethod,itwillnotcallthedoFiltermethodagainonthisinstanceofthefilter.

Thismethodgivesthefilteranopportunitytocleanupanyresourcesthatarebeingheld(forexample,memory,filehandles,threads)andmakesurethatanypersistentstateissynchronizedwiththefilter'scurrentstateinmemory.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 83: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 84: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceFilterChain

publicabstractinterfaceFilterChain

AFilterChainisanobjectprovidedbytheservletcontainertothedevelopergivingaviewintotheinvocationchainofafilteredrequestforaresource.FiltersusetheFilterChaintoinvokethenextfilterinthechain,orifthecallingfilteristhelastfilterinthechain,toinvoketherosourceattheendofthechain.

Since:Servlet2.3

SeeAlso:Filter

MethodSummary

void

doFilter(ServletRequestrequest,ServletResponseresponse)Causesthenextfilterinthechaintobeinvoked,orifthecallingfilteristhelastfilterinthechain,causestheresourceattheendofthechaintobeinvoked.

MethodDetail

doFilter

publicvoiddoFilter(ServletRequestrequest,

ServletResponseresponse)

throwsjava.io.IOException,

ServletException

Causesthenextfilterinthechaintobeinvoked,orifthecallingfilteristhelastfilterinthechain,causestheresourceattheendofthechaintobeinvoked.Parameters:

request-therequesttopassalongthechain.

Page 85: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

response-theresponsetopassalongthechain.Since:

2.3

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 86: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 87: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceFilterConfig

publicabstractinterfaceFilterConfig

Afilterconfigurationobjectusedbyaservletcontainerusedtopassinformationtoafilterduringinitialization.

Since:Servlet2.3

SeeAlso:Filter

MethodSummary

java.lang.String

getFilterName()Returnsthefilter-nameofthisfilterasdefinedinthedeploymentdescriptor.

java.lang.String

getInitParameter(java.lang.Stringname)ReturnsaStringcontainingthevalueofthenamedinitializationparameter,ornulliftheparameterdoesnotexist.

java.util.Enumeration

getInitParameterNames()Returnsthenamesoftheservlet'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationiftheservlethasnoinitializationparameters.

ServletContext

getServletContext()ReturnsareferencetotheServletContextinwhichthecallerisexecuting.

MethodDetail

getFilterName

Page 88: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicjava.lang.StringgetFilterName()

Returnsthefilter-nameofthisfilterasdefinedinthedeploymentdescriptor.

getServletContext

publicServletContextgetServletContext()

ReturnsareferencetotheServletContextinwhichthecallerisexecuting.Returns:

aServletContextobject,usedbythecallertointeractwithitsservletcontainer

SeeAlso:ServletContext

getInitParameter

publicjava.lang.StringgetInitParameter(java.lang.Stringname)

ReturnsaStringcontainingthevalueofthenamedinitializationparameter,ornulliftheparameterdoesnotexist.Parameters:

name-aStringspecifyingthenameoftheinitializationparameterReturns:

aStringcontainingthevalueoftheinitializationparameter

getInitParameterNames

publicjava.util.EnumerationgetInitParameterNames()

Returnsthenamesoftheservlet'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationiftheservlethasnoinitializationparameters.Returns:

anEnumerationofStringobjectscontainingthenamesoftheservlet'sinitializationparameters

Page 89: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 90: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 91: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletClassGenericServletjava.lang.Object

|

+--javax.servlet.GenericServlet

DirectKnownSubclasses:HttpServlet

publicabstractclassGenericServletextendsjava.lang.ObjectimplementsServlet,ServletConfig,java.io.Serializable

Definesageneric,protocol-independentservlet.TowriteanHTTPservletforuseontheWeb,extendHttpServletinstead.

GenericServletimplementstheServletandServletConfiginterfaces.GenericServletmaybedirectlyextendedbyaservlet,althoughit'smorecommontoextendaprotocol-specificsubclasssuchasHttpServlet.

GenericServletmakeswritingservletseasier.ItprovidessimpleversionsofthelifecyclemethodsinitanddestroyandofthemethodsintheServletConfiginterface.GenericServletalsoimplementsthelogmethod,declaredintheServletContextinterface.

Towriteagenericservlet,youneedonlyoverridetheabstractservicemethod.

SeeAlso:SerializedForm

ConstructorSummaryGenericServlet()Doesnothing.

MethodSummary

Page 92: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

void

destroy()Calledbytheservletcontainertoindicatetoaservletthattheservletisbeingtakenoutofservice.

java.lang.String

getInitParameter(java.lang.Stringname)ReturnsaStringcontainingthevalueofthenamedinitializationparameter,ornulliftheparameterdoesnotexist.

java.util.Enumeration

getInitParameterNames()Returnsthenamesoftheservlet'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationiftheservlethasnoinitializationparameters.

ServletConfiggetServletConfig()Returnsthisservlet'sServletConfigobject.

ServletContext

getServletContext()ReturnsareferencetotheServletContextinwhichthisservletisrunning.

java.lang.String

getServletInfo()Returnsinformationabouttheservlet,suchasauthor,version,andcopyright.

java.lang.StringgetServletName()Returnsthenameofthisservletinstance.

void

init()Aconveniencemethodwhichcanbeoverriddensothatthere'snoneedtocallsuper.init(config).

void

init(ServletConfigconfig)Calledbytheservletcontainertoindicatetoaservletthattheservletisbeingplacedintoservice.

void

log(java.lang.Stringmsg)Writesthespecifiedmessagetoaservletlogfile,prependedbytheservlet'sname.

void

log(java.lang.Stringmessage,

java.lang.Throwablet)WritesanexplanatorymessageandastacktraceforagivenThrowableexceptiontotheservletlogfile,prependedbytheservlet'sname.

Page 93: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

abstractvoid

service(ServletRequestreq,ServletResponseres)Calledbytheservletcontainertoallowtheservlettorespondtoarequest.

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

toString,wait,wait,wait

ConstructorDetail

GenericServlet

publicGenericServlet()

Doesnothing.Alloftheservletinitializationisdonebyoneoftheinitmethods.

MethodDetail

destroy

publicvoiddestroy()

Calledbytheservletcontainertoindicatetoaservletthattheservletisbeingtakenoutofservice.SeeServlet.destroy().Specifiedby:

destroyininterfaceServlet

getInitParameter

publicjava.lang.StringgetInitParameter(java.lang.Stringname)

ReturnsaStringcontainingthevalueofthenamedinitializationparameter,ornulliftheparameterdoesnotexist.SeeServletConfig.getInitParameter(java.lang.String).

Page 94: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Thismethodissuppliedforconvenience.Itgetsthevalueofthenamedparameterfromtheservlet'sServletConfigobject.

Specifiedby:getInitParameterininterfaceServletConfig

Parameters:name-aStringspecifyingthenameoftheinitializationparameter

Returns:StringaStringcontainingthevalueoftheinitalizationparameter

getInitParameterNames

publicjava.util.EnumerationgetInitParameterNames()

Returnsthenamesoftheservlet'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationiftheservlethasnoinitializationparameters.SeeServletConfig.getInitParameterNames().

Thismethodissuppliedforconvenience.Itgetstheparameternamesfromtheservlet'sServletConfigobject.

Specifiedby:getInitParameterNamesininterfaceServletConfig

Returns:EnumerationanenumerationofStringobjectscontainingthenamesoftheservlet'sinitializationparameters

getServletConfig

publicServletConfiggetServletConfig()

Returnsthisservlet'sServletConfigobject.Specifiedby:

getServletConfigininterfaceServletReturns:

ServletConfigtheServletConfigobjectthatinitializedthisservlet

Page 95: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getServletContext

publicServletContextgetServletContext()

ReturnsareferencetotheServletContextinwhichthisservletisrunning.SeeServletConfig.getServletContext().

Thismethodissuppliedforconvenience.Itgetsthecontextfromtheservlet'sServletConfigobject.

Specifiedby:getServletContextininterfaceServletConfig

Returns:ServletContexttheServletContextobjectpassedtothisservletbytheinitmethod

getServletInfo

publicjava.lang.StringgetServletInfo()

Returnsinformationabouttheservlet,suchasauthor,version,andcopyright.Bydefault,thismethodreturnsanemptystring.Overridethismethodtohaveitreturnameaningfulvalue.SeeServlet.getServletInfo().Specifiedby:

getServletInfoininterfaceServletReturns:

Stringinformationaboutthisservlet,bydefaultanemptystring

init

publicvoidinit(ServletConfigconfig)

throwsServletException

Calledbytheservletcontainertoindicatetoaservletthattheservletisbeingplacedintoservice.SeeServlet.init(javax.servlet.ServletConfig).

Page 96: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThisimplementationstorestheServletConfigobjectitreceivesfromtheservletcontainerforlateruse.Whenoverridingthisformofthemethod,callsuper.init(config).

Specifiedby:initininterfaceServlet

Parameters:config-theServletConfigobjectthatcontainsconfigutationinformationforthisservlet

Throws:ServletException-ifanexceptionoccursthatinterruptstheservlet'snormaloperation

SeeAlso:UnavailableException

init

publicvoidinit()

throwsServletException

Aconveniencemethodwhichcanbeoverriddensothatthere'snoneedtocallsuper.init(config).

Insteadofoverridinginit(ServletConfig),simplyoverridethismethodanditwillbecalledbyGenericServlet.init(ServletConfigconfig).TheServletConfigobjectcanstillberetrievedviagetServletConfig().

Throws:ServletException-ifanexceptionoccursthatinterruptstheservlet'snormaloperation

log

publicvoidlog(java.lang.Stringmsg)

Writesthespecifiedmessagetoaservletlogfile,prependedbytheservlet'sname.SeeServletContext.log(String).

Page 97: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Parameters:msg-aStringspecifyingthemessagetobewrittentothelogfile

log

publicvoidlog(java.lang.Stringmessage,

java.lang.Throwablet)

WritesanexplanatorymessageandastacktraceforagivenThrowableexceptiontotheservletlogfile,prependedbytheservlet'sname.SeeServletContext.log(String,Throwable).Parameters:

message-aStringthatdescribestheerrororexceptiont-thejava.lang.Throwableerrororexception

service

publicabstractvoidservice(ServletRequestreq,

ServletResponseres)

throwsServletException,

java.io.IOException

Calledbytheservletcontainertoallowtheservlettorespondtoarequest.SeeServlet.service(javax.servlet.ServletRequest,javax.servlet.ServletResponse).

Thismethodisdeclaredabstractsosubclasses,suchasHttpServlet,mustoverrideit.

Specifiedby:serviceininterfaceServlet

Parameters:req-theServletRequestobjectthatcontainstheclient'srequestres-theServletResponseobjectthatwillcontaintheservlet'sresponse

Throws:ServletException-ifanexceptionoccursthatinterfereswiththeservlet'snormaloperationoccurred

Page 98: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.io.IOException-ifaninputoroutputexceptionoccurs

getServletName

publicjava.lang.StringgetServletName()

Returnsthenameofthisservletinstance.SeeServletConfig.getServletName().Specifiedby:

getServletNameininterfaceServletConfigReturns:

thenameofthisservletinstance

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 99: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 100: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

HierarchyForPackagejavax.servlet.http

PackageHierarchies:AllPackages

Page 101: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ClassHierarchy

classjava.lang.Objectclassjavax.servlet.http.Cookie(implementsjava.lang.Cloneable)classjava.util.EventObject(implementsjava.io.Serializable)

classjavax.servlet.http.HttpSessionEventclassjavax.servlet.http.HttpSessionBindingEvent

classjavax.servlet.GenericServlet(implementsjava.io.Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig)

classjavax.servlet.http.HttpServlet(implementsjava.io.Serializable)

classjavax.servlet.http.HttpUtilsclassjavax.servlet.ServletRequestWrapper(implementsjavax.servlet.ServletRequest)

classjavax.servlet.http.HttpServletRequestWrapper(implementsjavax.servlet.http.HttpServletRequest)

classjavax.servlet.ServletResponseWrapper(implementsjavax.servlet.ServletResponse)

classjavax.servlet.http.HttpServletResponseWrapper(implementsjavax.servlet.http.HttpServletResponse)

Page 102: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

InterfaceHierarchy

interfacejava.util.EventListenerinterfacejavax.servlet.http.HttpSessionActivationListenerinterfacejavax.servlet.http.HttpSessionAttributeListenerinterfacejavax.servlet.http.HttpSessionBindingListenerinterfacejavax.servlet.http.HttpSessionListener

interfacejavax.servlet.http.HttpSessioninterfacejavax.servlet.http.HttpSessionContextinterfacejavax.servlet.ServletRequest

interfacejavax.servlet.http.HttpServletRequestinterfacejavax.servlet.ServletResponse

interfacejavax.servlet.http.HttpServletResponse

Overview Package Class Tree Deprecated IndexHelpPREVNEXT FRAMESNOFRAMES

Page 103: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVPACKAGENEXTPACKAGE FRAMESNOFRAMES

Page 104: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Packagejavax.servlet.http

InterfaceSummaryHttpServletRequest ExtendstheServletRequestinterfaceto

providerequestinformationforHTTPservlets.

HttpServletResponseExtendstheServletResponseinterfacetoprovideHTTP-specificfunctionalityinsendingaresponse.

HttpSessionProvidesawaytoidentifyauseracrossmorethanonepagerequestorvisittoaWebsiteandtostoreinformationaboutthatuser.

HttpSessionActivationListener

Objectsthatareboundtoasessionmaylistentocontainereventsnotifyingthemthatsessionswillbepassivatedandthatsessionwillbeactivated.

HttpSessionAttributeListener

Thislistenerinterfacecanbeimplementedinordertogetnotificationsofchangestotheattributelistsofsessionswithinthiswebapplication.

HttpSessionBindingListener Causesanobjecttobenotifiedwhenitisboundtoorunboundfromasession.

HttpSessionContext Deprecated.AsofJava(tm)ServletAPI2.1forsecurityreasons,withnoreplacement.

HttpSessionListenerImplementationsofthisinterfacemayarenotifiedofchangestothelistofactivesessionsinawebapplication.

ClassSummary

Cookie

Createsacookie,asmallamountofinformationsentbyaservlettoaWebbrowser,savedbythebrowser,andlatersentbacktotheserver.

Page 105: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

HttpServlet ProvidesanabstractclasstobesubclassedtocreateanHTTPservletsuitableforaWebsite.

HttpServletRequestWrapper

ProvidesaconvenientimplementationoftheHttpServletRequestinterfacethatcanbesubclassedbydeveloperswishingtoadapttherequesttoaServlet.

HttpServletResponseWrapper

ProvidesaconvenientimplementationoftheHttpServletResponseinterfacethatcanbesubclassedbydeveloperswishingtoadapttheresponsefromaServlet.

HttpSessionBindingEvent

EventsofthistypeareeithersenttoanobjectthatimplementsHttpSessionBindingListenerwhenitisboundorunboundfromasession,ortoaHttpSessionAttributeListenerthathasbeenconfiguredinthedeploymentdescriptorwhenanyattributeisbound,unboundorreplacedinasession.

HttpSessionEventThisistheclassrepresentingeventnotificationsforchangestosessionswithinawebapplication.

HttpUtils Deprecated.AsofJava(tm)ServletAPI2.3.

Overview Package Class Tree Deprecated IndexHelpPREVPACKAGENEXTPACKAGE FRAMESNOFRAMES

Page 106: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 107: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpClassCookiejava.lang.Object

|

+--javax.servlet.http.Cookie

publicclassCookieextendsjava.lang.Objectimplementsjava.lang.Cloneable

Createsacookie,asmallamountofinformationsentbyaservlettoaWebbrowser,savedbythebrowser,andlatersentbacktotheserver.Acookie'svaluecanuniquelyidentifyaclient,socookiesarecommonlyusedforsessionmanagement.

Acookiehasaname,asinglevalue,andoptionalattributessuchasacomment,pathanddomainqualifiers,amaximumage,andaversionnumber.SomeWebbrowsershavebugsinhowtheyhandletheoptionalattributes,sousethemsparinglytoimprovetheinteroperabilityofyourservlets.

TheservletsendscookiestothebrowserbyusingtheHttpServletResponse.addCookie(javax.servlet.http.Cookie)method,whichaddsfieldstoHTTPresponseheaderstosendcookiestothebrowser,oneatatime.Thebrowserisexpectedtosupport20cookiesforeachWebserver,300cookiestotal,andmaylimitcookiesizeto4KBeach.

ThebrowserreturnscookiestotheservletbyaddingfieldstoHTTPrequestheaders.CookiescanberetrievedfromarequestbyusingtheHttpServletRequest.getCookies()method.Severalcookiesmighthavethesamenamebutdifferentpathattributes.

CookiesaffectthecachingoftheWebpagesthatusethem.HTTP1.0doesnotcachepagesthatusecookiescreatedwiththisclass.ThisclassdoesnotsupportthecachecontroldefinedwithHTTP1.1.

ThisclasssupportsboththeVersion0(byNetscape)andVersion1(byRFC2109)cookiespecifications.Bydefault,cookiesarecreatedusingVersion0toensurethebestinteroperability.

Page 108: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ConstructorSummaryCookie(java.lang.Stringname,java.lang.Stringvalue)Constructsacookiewithaspecifiednameandvalue.

MethodSummary

java.lang.Object

clone()Overridesthestandardjava.lang.Object.clonemethodtoreturnacopyofthiscookie.

java.lang.String

getComment()Returnsthecommentdescribingthepurposeofthiscookie,ornullifthecookiehasnocomment.

java.lang.StringgetDomain()Returnsthedomainnamesetforthiscookie.

int

getMaxAge()Returnsthemaximumageofthecookie,specifiedinseconds,Bydefault,-1indicatingthecookiewillpersistuntilbrowsershutdown.

java.lang.StringgetName()Returnsthenameofthecookie.

java.lang.String

getPath()Returnsthepathontheservertowhichthebrowserreturnsthiscookie.

boolean

getSecure()Returnstrueifthebrowserissendingcookiesonlyoverasecureprotocol,orfalseifthebrowsercansendcookiesusinganyprotocol.

java.lang.StringgetValue()Returnsthevalueofthecookie.

int

getVersion()Returnstheversionoftheprotocolthiscookiecomplieswith.

voidsetComment(java.lang.Stringpurpose)Specifiesacommentthatdescribesacookie'spurpose.

Page 109: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

void

setDomain(java.lang.Stringpattern)Specifiesthedomainwithinwhichthiscookieshouldbepresented.

voidsetMaxAge(intexpiry)Setsthemaximumageofthecookieinseconds.

void

setPath(java.lang.Stringuri)Specifiesapathforthecookietowhichtheclientshouldreturnthecookie.

void

setSecure(booleanflag)Indicatestothebrowserwhetherthecookieshouldonlybesentusingasecureprotocol,suchasHTTPSorSSL.

void

setValue(java.lang.StringnewValue)Assignsanewvaluetoacookieafterthecookieiscreated.

void

setVersion(intv)Setstheversionofthecookieprotocolthiscookiecomplieswith.

Methodsinheritedfromclassjava.lang.Objectequals,finalize,getClass,hashCode,notify,notifyAll,toString,

wait,wait,wait

ConstructorDetail

Cookie

publicCookie(java.lang.Stringname,

java.lang.Stringvalue)

Constructsacookiewithaspecifiednameandvalue.

ThenamemustconformtoRFC2109.ThatmeansitcancontainonlyASCIIalphanumericcharactersandcannotcontaincommas,semicolons,orwhitespaceorbeginwitha$character.Thecookie'snamecannotbechangedaftercreation.

Page 110: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Thevaluecanbeanythingtheserverchoosestosend.Itsvalueisprobablyofinterestonlytotheserver.Thecookie'svaluecanbechangedaftercreationwiththesetValuemethod.

Bydefault,cookiesarecreatedaccordingtotheNetscapecookiespecification.TheversioncanbechangedwiththesetVersionmethod.

Parameters:name-aStringspecifyingthenameofthecookievalue-aStringspecifyingthevalueofthecookie

Throws:java.lang.IllegalArgumentException-ifthecookienamecontainsillegalcharacters(forexample,acomma,space,orsemicolon)oritisoneofthetokensreservedforusebythecookieprotocol

SeeAlso:setValue(java.lang.String),setVersion(int)

MethodDetail

setComment

publicvoidsetComment(java.lang.Stringpurpose)

Specifiesacommentthatdescribesacookie'spurpose.Thecommentisusefulifthebrowserpresentsthecookietotheuser.CommentsarenotsupportedbyNetscapeVersion0cookies.Parameters:

purpose-aStringspecifyingthecommenttodisplaytotheuserSeeAlso:

getComment()

getComment

publicjava.lang.StringgetComment()

Returnsthecommentdescribingthepurposeofthiscookie,ornullifthecookiehasnocomment.Returns:

Page 111: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

aStringcontainingthecomment,ornullifnoneSeeAlso:

setComment(java.lang.String)

setDomain

publicvoidsetDomain(java.lang.Stringpattern)

Specifiesthedomainwithinwhichthiscookieshouldbepresented.

TheformofthedomainnameisspecifiedbyRFC2109.Adomainnamebeginswithadot(.foo.com)andmeansthatthecookieisvisibletoserversinaspecifiedDomainNameSystem(DNS)zone(forexample,www.foo.com,butnota.b.foo.com).Bydefault,cookiesareonlyreturnedtotheserverthatsentthem.

Parameters:pattern-aStringcontainingthedomainnamewithinwhichthiscookieisvisible;formisaccordingtoRFC2109

SeeAlso:getDomain()

getDomain

publicjava.lang.StringgetDomain()

Returnsthedomainnamesetforthiscookie.TheformofthedomainnameissetbyRFC2109.Returns:

aStringcontainingthedomainnameSeeAlso:

setDomain(java.lang.String)

setMaxAge

publicvoidsetMaxAge(intexpiry)

Page 112: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Setsthemaximumageofthecookieinseconds.

Apositivevalueindicatesthatthecookiewillexpireafterthatmanysecondshavepassed.Notethatthevalueisthemaximumagewhenthecookiewillexpire,notthecookie'scurrentage.

AnegativevaluemeansthatthecookieisnotstoredpersistentlyandwillbedeletedwhentheWebbrowserexits.Azerovaluecausesthecookietobedeleted.

Parameters:expiry-anintegerspecifyingthemaximumageofthecookieinseconds;ifnegative,meansthecookieisnotstored;ifzero,deletesthecookie

SeeAlso:getMaxAge()

getMaxAge

publicintgetMaxAge()

Returnsthemaximumageofthecookie,specifiedinseconds,Bydefault,-1indicatingthecookiewillpersistuntilbrowsershutdown.Returns:

anintegerspecifyingthemaximumageofthecookieinseconds;ifnegative,meansthecookiepersistsuntilbrowsershutdown

SeeAlso:setMaxAge(int)

setPath

publicvoidsetPath(java.lang.Stringuri)

Specifiesapathforthecookietowhichtheclientshouldreturnthecookie.

Thecookieisvisibletoallthepagesinthedirectoryyouspecify,andallthepagesinthatdirectory'ssubdirectories.Acookie'spathmustincludetheservletthatsetthecookie,forexample,/catalog,whichmakesthecookie

Page 113: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

visibletoalldirectoriesontheserverunder/catalog.

ConsultRFC2109(availableontheInternet)formoreinformationonsettingpathnamesforcookies.

Parameters:uri-aStringspecifyingapath

SeeAlso:getPath()

getPath

publicjava.lang.StringgetPath()

Returnsthepathontheservertowhichthebrowserreturnsthiscookie.Thecookieisvisibletoallsubpathsontheserver.Returns:

aStringspecifyingapaththatcontainsaservletname,forexample,/catalog

SeeAlso:setPath(java.lang.String)

setSecure

publicvoidsetSecure(booleanflag)

Indicatestothebrowserwhetherthecookieshouldonlybesentusingasecureprotocol,suchasHTTPSorSSL.

Thedefaultvalueisfalse.

Parameters:flag-iftrue,sendsthecookiefromthebrowsertotheserverusingonlywhenusingasecureprotocol;iffalse,sentonanyprotocol

SeeAlso:getSecure()

Page 114: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getSecure

publicbooleangetSecure()

Returnstrueifthebrowserissendingcookiesonlyoverasecureprotocol,orfalseifthebrowsercansendcookiesusinganyprotocol.Returns:

trueifthebrowserusesasecureprotocol;otherwise,trueSeeAlso:

setSecure(boolean)

getName

publicjava.lang.StringgetName()

Returnsthenameofthecookie.Thenamecannotbechangedaftercreation.Returns:

aStringspecifyingthecookie'sname

setValue

publicvoidsetValue(java.lang.StringnewValue)

Assignsanewvaluetoacookieafterthecookieiscreated.Ifyouuseabinaryvalue,youmaywanttouseBASE64encoding.

WithVersion0cookies,valuesshouldnotcontainwhitespace,brackets,parentheses,equalssigns,commas,doublequotes,slashes,questionmarks,atsigns,colons,andsemicolons.Emptyvaluesmaynotbehavethesamewayonallbrowsers.

Parameters:newValue-aStringspecifyingthenewvalue

SeeAlso:getValue(),Cookie

Page 115: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getValue

publicjava.lang.StringgetValue()

Returnsthevalueofthecookie.Returns:

aStringcontainingthecookie'spresentvalueSeeAlso:

setValue(java.lang.String),Cookie

getVersion

publicintgetVersion()

Returnstheversionoftheprotocolthiscookiecomplieswith.Version1complieswithRFC2109,andversion0complieswiththeoriginalcookiespecificationdraftedbyNetscape.Cookiesprovidedbyabrowseruseandidentifythebrowser'scookieversion.Returns:

0ifthecookiecomplieswiththeoriginalNetscapespecification;1ifthecookiecomplieswithRFC2109

SeeAlso:setVersion(int)

setVersion

publicvoidsetVersion(intv)

Setstheversionofthecookieprotocolthiscookiecomplieswith.Version0complieswiththeoriginalNetscapecookiespecification.Version1complieswithRFC2109.

SinceRFC2109isstillsomewhatnew,considerversion1asexperimental;donotuseityetonproductionsites.

Parameters:v-0ifthecookieshouldcomplywiththeoriginalNetscapespecification;1ifthecookieshouldcomplywithRFC2109

Page 116: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SeeAlso:getVersion()

clone

publicjava.lang.Objectclone()

Overridesthestandardjava.lang.Object.clonemethodtoreturnacopyofthiscookie.Overrides:

cloneinclassjava.lang.Object

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 117: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 118: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpClassHttpServletjava.lang.Object

|

+--javax.servlet.GenericServlet

|

+--javax.servlet.http.HttpServlet

publicabstractclassHttpServletextendsGenericServletimplementsjava.io.Serializable

ProvidesanabstractclasstobesubclassedtocreateanHTTPservletsuitableforaWebsite.AsubclassofHttpServletmustoverrideatleastonemethod,usuallyoneofthese:

doGet,iftheservletsupportsHTTPGETrequestsdoPost,forHTTPPOSTrequestsdoPut,forHTTPPUTrequestsdoDelete,forHTTPDELETErequestsinitanddestroy,tomanageresourcesthatareheldforthelifeoftheservletgetServletInfo,whichtheservletusestoprovideinformationaboutitself

There'salmostnoreasontooverridetheservicemethod.servicehandlesstandardHTTPrequestsbydispatchingthemtothehandlermethodsforeachHTTPrequesttype(thedoXXXmethodslistedabove).

Likewise,there'salmostnoreasontooverridethedoOptionsanddoTracemethods.

Servletstypicallyrunonmultithreadedservers,sobeawarethataservletmusthandleconcurrentrequestsandbecarefultosynchronizeaccesstosharedresources.Sharedresourcesincludein-memorydatasuchasinstanceorclassvariablesandexternalobjectssuchasfiles,databaseconnections,andnetworkconnections.SeetheJavaTutorialonMultithreadedProgrammingformoreinformationonhandlingmultiplethreadsinaJavaprogram.

Page 119: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SeeAlso:SerializedForm

ConstructorSummaryHttpServlet()Doesnothing,becausethisisanabstractclass.

MethodSummaryprotected

void

doDelete(HttpServletRequestreq,HttpServletResponseresp)Calledbytheserver(viatheservicemethod)toallowaservlettohandleaDELETErequest.

protected

void

doGet(HttpServletRequestreq,HttpServletResponseresp)Calledbytheserver(viatheservicemethod)toallowaservlettohandleaGETrequest.

protected

void

doHead(HttpServletRequestreq,HttpServletResponseresp)ReceivesanHTTPHEADrequestfromtheprotectedservicemethodandhandlestherequest.

protected

void

doOptions(HttpServletRequestreq,HttpServletResponseresp)

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaOPTIONSrequest.

protected

void

doPost(HttpServletRequestreq,HttpServletResponseresp)Calledbytheserver(viatheservicemethod)toallowaservlettohandleaPOSTrequest.

protected

void

doPut(HttpServletRequestreq,HttpServletResponseresp)Calledbytheserver(viatheservicemethod)toallowaservlettohandleaPUTrequest.

protected

void

doTrace(HttpServletRequestreq,HttpServletResponseresp)Calledbytheserver(viatheservicemethod)toallowaservlettohandleaTRACErequest.

protected

long

getLastModified(HttpServletRequestreq)ReturnsthetimetheHttpServletRequestobjectwaslastmodified,inmillisecondssincemidnightJanuary1,1970GMT.

protected

service(HttpServletRequestreq,HttpServletResponseresp)ReceivesstandardHTTPrequestsfromthepublicservice

Page 120: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

void methodanddispatchesthemtothedoXXXmethodsdefinedinthisclass.

voidservice(ServletRequestreq,ServletResponseres)Dispatchesclientrequeststotheprotectedservicemethod.

Methodsinheritedfromclassjavax.servlet.GenericServletdestroy,getInitParameter,getInitParameterNames,

getServletConfig,getServletContext,getServletInfo,

getServletName,init,init,log,log

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

toString,wait,wait,wait

ConstructorDetail

HttpServlet

publicHttpServlet()

Doesnothing,becausethisisanabstractclass.

MethodDetail

doGet

protectedvoiddoGet(HttpServletRequestreq,

HttpServletResponseresp)

throwsServletException,

java.io.IOException

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaGETrequest.

OverridingthismethodtosupportaGETrequestalsoautomaticallysupportsanHTTPHEADrequest.AHEADrequestisaGETrequestthat

Page 121: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

returnsnobodyintheresponse,onlytherequestheaderfields.

Whenoverridingthismethod,readtherequestdata,writetheresponseheaders,gettheresponse'swriteroroutputstreamobject,andfinally,writetheresponsedata.It'sbesttoincludecontenttypeandencoding.WhenusingaPrintWriterobjecttoreturntheresponse,setthecontenttypebeforeaccessingthePrintWriterobject.

Theservletcontainermustwritetheheadersbeforecommittingtheresponse,becauseinHTTPtheheadersmustbesentbeforetheresponsebody.

Wherepossible,settheContent-Lengthheader(withtheServletResponse.setContentLength(int)method),toallowtheservletcontainertouseapersistentconnectiontoreturnitsresponsetotheclient,improvingperformance.Thecontentlengthisautomaticallysetiftheentireresponsefitsinsidetheresponsebuffer.

TheGETmethodshouldbesafe,thatis,withoutanysideeffectsforwhichusersareheldresponsible.Forexample,mostformquerieshavenosideeffects.Ifaclientrequestisintendedtochangestoreddata,therequestshouldusesomeotherHTTPmethod.

TheGETmethodshouldalsobeidempotent,meaningthatitcanbesafelyrepeated.Sometimesmakingamethodsafealsomakesitidempotent.Forexample,repeatingqueriesisbothsafeandidempotent,butbuyingaproductonlineormodifyingdataisneithersafenoridempotent.

Iftherequestisincorrectlyformatted,doGetreturnsanHTTP"BadRequest"message.

Parameters:req-anHttpServletRequestobjectthatcontainstherequesttheclienthasmadeoftheservletresp-anHttpServletResponseobjectthatcontainstheresponsetheservletsendstotheclient

Throws:java.io.IOException-ifaninputoroutputerrorisdetectedwhentheservlethandlestheGETrequestServletException-iftherequestfortheGETcouldnotbehandled

Page 122: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SeeAlso:ServletResponse.setContentType(java.lang.String)

getLastModified

protectedlonggetLastModified(HttpServletRequestreq)

ReturnsthetimetheHttpServletRequestobjectwaslastmodified,inmillisecondssincemidnightJanuary1,1970GMT.Ifthetimeisunknown,thismethodreturnsanegativenumber(thedefault).

ServletsthatsupportHTTPGETrequestsandcanquicklydeterminetheirlastmodificationtimeshouldoverridethismethod.Thismakesbrowserandproxycachesworkmoreeffectively,reducingtheloadonserverandnetworkresources.

Parameters:req-theHttpServletRequestobjectthatissenttotheservlet

Returns:alongintegerspecifyingthetimetheHttpServletRequestobjectwaslastmodified,inmillisecondssincemidnight,January1,1970GMT,or-1ifthetimeisnotknown

doHead

protectedvoiddoHead(HttpServletRequestreq,

HttpServletResponseresp)

throwsServletException,

java.io.IOException

ReceivesanHTTPHEADrequestfromtheprotectedservicemethodandhandlestherequest.TheclientsendsaHEADrequestwhenitwantstoseeonlytheheadersofaresponse,suchasContent-TypeorContent-Length.TheHTTPHEADmethodcountstheoutputbytesintheresponsetosettheContent-Lengthheaderaccurately.

Ifyouoverridethismethod,youcanavoidcomputingtheresponsebodyandjustsettheresponseheadersdirectlytoimproveperformance.Make

Page 123: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

surethatthedoHeadmethodyouwriteisbothsafeandidempotent(thatis,protectsitselffrombeingcalledmultipletimesforoneHTTPHEADrequest).

IftheHTTPHEADrequestisincorrectlyformatted,doHeadreturnsanHTTP"BadRequest"message.

Parameters:req-therequestobjectthatispassedtotheservletresp-theresponseobjectthattheservletusestoreturntheheaderstotheclien

Throws:java.io.IOException-ifaninputoroutputerroroccursServletException-iftherequestfortheHEADcouldnotbehandled

doPost

protectedvoiddoPost(HttpServletRequestreq,

HttpServletResponseresp)

throwsServletException,

java.io.IOException

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaPOSTrequest.TheHTTPPOSTmethodallowstheclienttosenddataofunlimitedlengthtotheWebserverasingletimeandisusefulwhenpostinginformationsuchascreditcardnumbers.

Whenoverridingthismethod,readtherequestdata,writetheresponseheaders,gettheresponse'swriteroroutputstreamobject,andfinally,writetheresponsedata.It'sbesttoincludecontenttypeandencoding.WhenusingaPrintWriterobjecttoreturntheresponse,setthecontenttypebeforeaccessingthePrintWriterobject.

Theservletcontainermustwritetheheadersbeforecommittingtheresponse,becauseinHTTPtheheadersmustbesentbeforetheresponsebody.

Wherepossible,settheContent-Lengthheader(withtheServletResponse.setContentLength(int)method),toallowtheservlet

Page 124: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

containertouseapersistentconnectiontoreturnitsresponsetotheclient,improvingperformance.Thecontentlengthisautomaticallysetiftheentireresponsefitsinsidetheresponsebuffer.

WhenusingHTTP1.1chunkedencoding(whichmeansthattheresponsehasaTransfer-Encodingheader),donotsettheContent-Lengthheader.

Thismethoddoesnotneedtobeeithersafeoridempotent.OperationsrequestedthroughPOSTcanhavesideeffectsforwhichtheusercanbeheldaccountable,forexample,updatingstoreddataorbuyingitemsonline.

IftheHTTPPOSTrequestisincorrectlyformatted,doPostreturnsanHTTP"BadRequest"message.

Parameters:req-anHttpServletRequestobjectthatcontainstherequesttheclienthasmadeoftheservletresp-anHttpServletResponseobjectthatcontainstheresponsetheservletsendstotheclient

Throws:java.io.IOException-ifaninputoroutputerrorisdetectedwhentheservlethandlestherequestServletException-iftherequestforthePOSTcouldnotbehandled

SeeAlso:ServletOutputStream,ServletResponse.setContentType(java.lang.String)

doPut

protectedvoiddoPut(HttpServletRequestreq,

HttpServletResponseresp)

throwsServletException,

java.io.IOException

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaPUTrequest.ThePUToperationallowsaclienttoplaceafileontheserverandissimilartosendingafilebyFTP.

Whenoverridingthismethod,leaveintactanycontentheaderssentwiththe

Page 125: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

request(includingContent-Length,Content-Type,Content-Transfer-Encoding,Content-Encoding,Content-Base,Content-Language,Content-Location,Content-MD5,andContent-Range).Ifyourmethodcannothandleacontentheader,itmustissueanerrormessage(HTTP501-NotImplemented)anddiscardtherequest.FormoreinformationonHTTP1.1,seeRFC2068.

Thismethoddoesnotneedtobeeithersafeoridempotent.OperationsthatdoPutperformscanhavesideeffectsforwhichtheusercanbeheldaccountable.Whenusingthismethod,itmaybeusefultosaveacopyoftheaffectedURLintemporarystorage.

IftheHTTPPUTrequestisincorrectlyformatted,doPutreturnsanHTTP"BadRequest"message.

Parameters:req-theHttpServletRequestobjectthatcontainstherequesttheclientmadeoftheservletresp-theHttpServletResponseobjectthatcontainstheresponsetheservletreturnstotheclient

Throws:java.io.IOException-ifaninputoroutputerroroccurswhiletheservletishandlingthePUTrequestServletException-iftherequestforthePUTcannotbehandled

doDelete

protectedvoiddoDelete(HttpServletRequestreq,

HttpServletResponseresp)

throwsServletException,

java.io.IOException

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaDELETErequest.TheDELETEoperationallowsaclienttoremoveadocumentorWebpagefromtheserver.

Thismethoddoesnotneedtobeeithersafeoridempotent.OperationsrequestedthroughDELETEcanhavesideeffectsforwhichuserscanbeheldaccountable.Whenusingthismethod,itmaybeusefultosaveacopy

Page 126: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

oftheaffectedURLintemporarystorage.

IftheHTTPDELETErequestisincorrectlyformatted,doDeletereturnsanHTTP"BadRequest"message.

Parameters:req-theHttpServletRequestobjectthatcontainstherequesttheclientmadeoftheservletresp-theHttpServletResponseobjectthatcontainstheresponsetheservletreturnstotheclient

Throws:java.io.IOException-ifaninputoroutputerroroccurswhiletheservletishandlingtheDELETErequestServletException-iftherequestfortheDELETEcannotbehandled

doOptions

protectedvoiddoOptions(HttpServletRequestreq,

HttpServletResponseresp)

throwsServletException,

java.io.IOException

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaOPTIONSrequest.TheOPTIONSrequestdetermineswhichHTTPmethodstheserversupportsandreturnsanappropriateheader.Forexample,ifaservletoverridesdoGet,thismethodreturnsthefollowingheader:

Allow:GET,HEAD,TRACE,OPTIONS

There'snoneedtooverridethismethodunlesstheservletimplementsnewHTTPmethods,beyondthoseimplementedbyHTTP1.1.

Parameters:req-theHttpServletRequestobjectthatcontainstherequesttheclientmadeoftheservletresp-theHttpServletResponseobjectthatcontainstheresponsetheservletreturnstotheclient

Throws:

Page 127: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.io.IOException-ifaninputoroutputerroroccurswhiletheservletishandlingtheOPTIONSrequestServletException-iftherequestfortheOPTIONScannotbehandled

doTrace

protectedvoiddoTrace(HttpServletRequestreq,

HttpServletResponseresp)

throwsServletException,

java.io.IOException

Calledbytheserver(viatheservicemethod)toallowaservlettohandleaTRACErequest.ATRACEreturnstheheaderssentwiththeTRACErequesttotheclient,sothattheycanbeusedindebugging.There'snoneedtooverridethismethod.Parameters:

req-theHttpServletRequestobjectthatcontainstherequesttheclientmadeoftheservletresp-theHttpServletResponseobjectthatcontainstheresponsetheservletreturnstotheclient

Throws:java.io.IOException-ifaninputoroutputerroroccurswhiletheservletishandlingtheTRACErequestServletException-iftherequestfortheTRACEcannotbehandled

service

protectedvoidservice(HttpServletRequestreq,

HttpServletResponseresp)

throwsServletException,

java.io.IOException

ReceivesstandardHTTPrequestsfromthepublicservicemethodanddispatchesthemtothedoXXXmethodsdefinedinthisclass.ThismethodisanHTTP-specificversionoftheServlet.service(javax.servlet.ServletRequest,

javax.servlet.ServletResponse)method.There'snoneedtooverridethismethod.Parameters:

Page 128: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

req-theHttpServletRequestobjectthatcontainstherequesttheclientmadeoftheservletresp-theHttpServletResponseobjectthatcontainstheresponsetheservletreturnstotheclient

Throws:java.io.IOException-ifaninputoroutputerroroccurswhiletheservletishandlingtheTRACErequestServletException-iftherequestfortheTRACEcannotbehandled

SeeAlso:Servlet.service(javax.servlet.ServletRequest,

javax.servlet.ServletResponse)

service

publicvoidservice(ServletRequestreq,

ServletResponseres)

throwsServletException,

java.io.IOException

Dispatchesclientrequeststotheprotectedservicemethod.There'snoneedtooverridethismethod.Parameters:

req-theHttpServletRequestobjectthatcontainstherequesttheclientmadeoftheservletresp-theHttpServletResponseobjectthatcontainstheresponsetheservletreturnstotheclient

Throws:java.io.IOException-ifaninputoroutputerroroccurswhiletheservletishandlingtheTRACErequestServletException-iftherequestfortheTRACEcannotbehandled

Overrides:serviceinclassGenericServlet

SeeAlso:Servlet.service(javax.servlet.ServletRequest,

javax.servlet.ServletResponse)

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 129: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 130: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpInterfaceHttpServletRequest

AllKnownImplementingClasses:HttpServletRequestWrapper

publicabstractinterfaceHttpServletRequestextendsServletRequest

ExtendstheServletRequestinterfacetoproviderequestinformationforHTTPservlets.

TheservletcontainercreatesanHttpServletRequestobjectandpassesitasanargumenttotheservlet'sservicemethods(doGet,doPost,etc).

FieldSummarystaticjava.lang.String

BASIC_AUTHStringidentifierforBasicauthentication.

staticjava.lang.StringCLIENT_CERT_AUTHStringidentifierforBasicauthentication.

staticjava.lang.StringDIGEST_AUTHStringidentifierforBasicauthentication.

staticjava.lang.StringFORM_AUTHStringidentifierforBasicauthentication.

MethodSummary

java.lang.String

getAuthType()Returnsthenameoftheauthenticationschemeusedtoprotecttheservlet.

java.lang.String

getContextPath()ReturnstheportionoftherequestURIthatindicatesthecontextoftherequest.getCookies()

Page 131: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Cookie[] ReturnsanarraycontainingalloftheCookieobjectstheclientsentwiththisrequest.

long

getDateHeader(java.lang.Stringname)ReturnsthevalueofthespecifiedrequestheaderasalongvaluethatrepresentsaDateobject.

java.lang.String

getHeader(java.lang.Stringname)ReturnsthevalueofthespecifiedrequestheaderasaString.

java.util.Enumeration

getHeaderNames()Returnsanenumerationofalltheheadernamesthisrequestcontains.

java.util.Enumeration

getHeaders(java.lang.Stringname)ReturnsallthevaluesofthespecifiedrequestheaderasanEnumerationofStringobjects.

int

getIntHeader(java.lang.Stringname)Returnsthevalueofthespecifiedrequestheaderasanint.

java.lang.String

getMethod()ReturnsthenameoftheHTTPmethodwithwhichthisrequestwasmade,forexample,GET,POST,orPUT.

java.lang.String

getPathInfo()ReturnsanyextrapathinformationassociatedwiththeURLtheclientsentwhenitmadethisrequest.

java.lang.String

getPathTranslated()Returnsanyextrapathinformationaftertheservletnamebutbeforethequerystring,andtranslatesittoarealpath.

java.lang.String

getQueryString()ReturnsthequerystringthatiscontainedintherequestURLafterthepath.

java.lang.String

getRemoteUser()Returnstheloginoftheusermakingthisrequest,iftheuserhasbeenauthenticated,ornulliftheuserhasnotbeenauthenticated.

java.lang.String

getRequestedSessionId()ReturnsthesessionIDspecifiedbytheclient.

Page 132: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.lang.String

getRequestURI()Returnsthepartofthisrequest'sURLfromtheprotocolnameuptothequerystringinthefirstlineoftheHTTPrequest.

java.lang.StringBuffer

getRequestURL()ReconstructstheURLtheclientusedtomaketherequest.

java.lang.String

getServletPath()Returnsthepartofthisrequest'sURLthatcallstheservlet.

HttpSession

getSession()Returnsthecurrentsessionassociatedwiththisrequest,oriftherequestdoesnothaveasession,createsone.

HttpSession

getSession(booleancreate)ReturnsthecurrentHttpSessionassociatedwiththisrequestor,ififthereisnocurrentsessionandcreateistrue,returnsanewsession.

java.security.Principal

getUserPrincipal()Returnsajava.security.Principalobjectcontainingthenameofthecurrentauthenticateduser.

boolean

isRequestedSessionIdFromCookie()CheckswhethertherequestedsessionIDcameinasacookie.

boolean

isRequestedSessionIdFromUrl()Deprecated.AsofVersion2.1oftheJavaServletAPI,useisRequestedSessionIdFromURL()instead.

boolean

isRequestedSessionIdFromURL()CheckswhethertherequestedsessionIDcameinaspartoftherequestURL.

boolean

isRequestedSessionIdValid()CheckswhethertherequestedsessionIDisstillvalid.

boolean

isUserInRole(java.lang.Stringrole)Returnsabooleanindicatingwhetherthe

Page 133: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

authenticateduserisincludedinthespecifiedlogical"role".

Methodsinheritedfrominterfacejavax.servlet.ServletRequestgetAttribute,getAttributeNames,getCharacterEncoding,

getContentLength,getContentType,getInputStream,getLocale,

getLocales,getParameter,getParameterMap,getParameterNames,

getParameterValues,getProtocol,getReader,getRealPath,

getRemoteAddr,getRemoteHost,getRequestDispatcher,getScheme,

getServerName,getServerPort,isSecure,removeAttribute,

setAttribute,setCharacterEncoding

FieldDetail

BASIC_AUTH

publicstaticfinaljava.lang.StringBASIC_AUTH

StringidentifierforBasicauthentication.Value"BASIC"

FORM_AUTH

publicstaticfinaljava.lang.StringFORM_AUTH

StringidentifierforBasicauthentication.Value"FORM"

CLIENT_CERT_AUTH

publicstaticfinaljava.lang.StringCLIENT_CERT_AUTH

StringidentifierforBasicauthentication.Value"CLIENT_CERT"

DIGEST_AUTH

publicstaticfinaljava.lang.StringDIGEST_AUTH

Page 134: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

StringidentifierforBasicauthentication.Value"DIGEST"

MethodDetail

getAuthType

publicjava.lang.StringgetAuthType()

Returnsthenameoftheauthenticationschemeusedtoprotecttheservlet.Allservletcontainerssupportbasic,formandclientcertificateauthentication,andmayadditionallysupportdigestauthentication.Iftheservletisnotauthenticatednullisreturned.

SameasthevalueoftheCGIvariableAUTH_TYPE.

Returns:oneofthestaticmembersBASIC_AUTH,FORM_AUTH,CLIENT_CERT_AUTH,DIGEST_AUTH(suitablefor==comparison)indicatingtheauthenticationscheme,ornulliftherequestwasnotauthenticated.

getCookies

publicCookie[]getCookies()

ReturnsanarraycontainingalloftheCookieobjectstheclientsentwiththisrequest.Thismethodreturnsnullifnocookiesweresent.Returns:

anarrayofalltheCookiesincludedwiththisrequest,ornulliftherequesthasnocookies

getDateHeader

publiclonggetDateHeader(java.lang.Stringname)

ReturnsthevalueofthespecifiedrequestheaderasalongvaluethatrepresentsaDateobject.Usethismethodwithheadersthatcontaindates,

Page 135: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

suchasIf-Modified-Since.

ThedateisreturnedasthenumberofmillisecondssinceJanuary1,1970GMT.Theheadernameiscaseinsensitive.

Iftherequestdidnothaveaheaderofthespecifiedname,thismethodreturns-1.Iftheheadercan'tbeconvertedtoadate,themethodthrowsanIllegalArgumentException.

Parameters:name-aStringspecifyingthenameoftheheader

Returns:alongvaluerepresentingthedatespecifiedintheheaderexpressedasthenumberofmillisecondssinceJanuary1,1970GMT,or-1ifthenamedheaderwasnotincludedwiththereqest

Throws:java.lang.IllegalArgumentException-Iftheheadervaluecan'tbeconvertedtoadate

getHeader

publicjava.lang.StringgetHeader(java.lang.Stringname)

ReturnsthevalueofthespecifiedrequestheaderasaString.Iftherequestdidnotincludeaheaderofthespecifiedname,thismethodreturnsnull.Theheadernameiscaseinsensitive.Youcanusethismethodwithanyrequestheader.Parameters:

name-aStringspecifyingtheheadernameReturns:

aStringcontainingthevalueoftherequestedheader,ornulliftherequestdoesnothaveaheaderofthatname

getHeaders

publicjava.util.EnumerationgetHeaders(java.lang.Stringname)

Page 136: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ReturnsallthevaluesofthespecifiedrequestheaderasanEnumerationofStringobjects.

Someheaders,suchasAccept-Languagecanbesentbyclientsasseveralheaderseachwithadifferentvalueratherthansendingtheheaderasacommaseparatedlist.

Iftherequestdidnotincludeanyheadersofthespecifiedname,thismethodreturnsanemptyEnumeration.Theheadernameiscaseinsensitive.Youcanusethismethodwithanyrequestheader.

Parameters:name-aStringspecifyingtheheadername

Returns:anEnumerationcontainingthevaluesoftherequestedheader.Iftherequestdoesnothaveanyheadersofthatnamereturnanemptyenumeration.Ifthecontainerdoesnotallowaccesstoheaderinformation,returnnull

getHeaderNames

publicjava.util.EnumerationgetHeaderNames()

Returnsanenumerationofalltheheadernamesthisrequestcontains.Iftherequesthasnoheaders,thismethodreturnsanemptyenumeration.

Someservletcontainersdonotallowdonotallowservletstoaccessheadersusingthismethod,inwhichcasethismethodreturnsnull

Returns:anenumerationofalltheheadernamessentwiththisrequest;iftherequesthasnoheaders,anemptyenumeration;iftheservletcontainerdoesnotallowservletstousethismethod,null

getIntHeader

publicintgetIntHeader(java.lang.Stringname)

Page 137: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Returnsthevalueofthespecifiedrequestheaderasanint.Iftherequestdoesnothaveaheaderofthespecifiedname,thismethodreturns-1.Iftheheadercannotbeconvertedtoaninteger,thismethodthrowsaNumberFormatException.

Theheadernameiscaseinsensitive.

Parameters:name-aStringspecifyingthenameofarequestheader

Returns:anintegerexpressingthevalueoftherequestheaderor-1iftherequestdoesn'thaveaheaderofthisname

Throws:java.lang.NumberFormatException-Iftheheadervaluecan'tbeconvertedtoanint

getMethod

publicjava.lang.StringgetMethod()

ReturnsthenameoftheHTTPmethodwithwhichthisrequestwasmade,forexample,GET,POST,orPUT.SameasthevalueoftheCGIvariableREQUEST_METHOD.Returns:

aStringspecifyingthenameofthemethodwithwhichthisrequestwasmade

getPathInfo

publicjava.lang.StringgetPathInfo()

ReturnsanyextrapathinformationassociatedwiththeURLtheclientsentwhenitmadethisrequest.Theextrapathinformationfollowstheservletpathbutprecedesthequerystring.Thismethodreturnsnulliftherewasnoextrapathinformation.

SameasthevalueoftheCGIvariablePATH_INFO.

Page 138: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Returns:aString,decodedbythewebcontainer,specifyingextrapathinformationthatcomesaftertheservletpathbutbeforethequerystringintherequestURL;ornulliftheURLdoesnothaveanyextrapathinformation

getPathTranslated

publicjava.lang.StringgetPathTranslated()

Returnsanyextrapathinformationaftertheservletnamebutbeforethequerystring,andtranslatesittoarealpath.SameasthevalueoftheCGIvariablePATH_TRANSLATED.

IftheURLdoesnothaveanyextrapathinformation,thismethodreturnsnull.Thewebcontainerdoesnotdecodethinsstring.

Returns:aStringspecifyingtherealpath,ornulliftheURLdoesnothaveanyextrapathinformation

getContextPath

publicjava.lang.StringgetContextPath()

ReturnstheportionoftherequestURIthatindicatesthecontextoftherequest.ThecontextpathalwayscomesfirstinarequestURI.Thepathstartswitha"/"characterbutdoesnotendwitha"/"character.Forservletsinthedefault(root)context,thismethodreturns"".Thecontainerdoesnotdecodethisstring.Returns:

aStringspecifyingtheportionoftherequestURIthatindicatesthecontextoftherequest

getQueryString

Page 139: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicjava.lang.StringgetQueryString()

ReturnsthequerystringthatiscontainedintherequestURLafterthepath.ThismethodreturnsnulliftheURLdoesnothaveaquerystring.SameasthevalueoftheCGIvariableQUERY_STRING.Returns:

aStringcontainingthequerystringornulliftheURLcontainsnoquerystring.Thevalueisnotdecodedbythecontainer.

getRemoteUser

publicjava.lang.StringgetRemoteUser()

Returnstheloginoftheusermakingthisrequest,iftheuserhasbeenauthenticated,ornulliftheuserhasnotbeenauthenticated.Whethertheusernameissentwitheachsubsequentrequestdependsonthebrowserandtypeofauthentication.SameasthevalueoftheCGIvariableREMOTE_USER.Returns:

aStringspecifyingtheloginoftheusermakingthisrequest,ornull

isUserInRole

publicbooleanisUserInRole(java.lang.Stringrole)

Returnsabooleanindicatingwhethertheauthenticateduserisincludedinthespecifiedlogical"role".Rolesandrolemembershipcanbedefinedusingdeploymentdescriptors.Iftheuserhasnotbeenauthenticated,themethodreturnsfalse.Parameters:

role-aStringspecifyingthenameoftheroleReturns:

abooleanindicatingwhethertheusermakingthisrequestbelongstoagivenrole;falseiftheuserhasnotbeenauthenticated

getUserPrincipal

Page 140: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicjava.security.PrincipalgetUserPrincipal()

Returnsajava.security.Principalobjectcontainingthenameofthecurrentauthenticateduser.Iftheuserhasnotbeenauthenticated,themethodreturnsnull.Returns:

ajava.security.Principalcontainingthenameoftheusermakingthisrequest;nulliftheuserhasnotbeenauthenticated

getRequestedSessionId

publicjava.lang.StringgetRequestedSessionId()

ReturnsthesessionIDspecifiedbytheclient.ThismaynotbethesameastheIDoftheactualsessioninuse.Forexample,iftherequestspecifiedanold(expired)sessionIDandtheserverhasstartedanewsession,thismethodgetsanewsessionwithanewID.IftherequestdidnotspecifyasessionID,thismethodreturnsnull.Returns:

aStringspecifyingthesessionID,ornulliftherequestdidnotspecifyasessionID

SeeAlso:isRequestedSessionIdValid()

getRequestURI

publicjava.lang.StringgetRequestURI()

Returnsthepartofthisrequest'sURLfromtheprotocolnameuptothequerystringinthefirstlineoftheHTTPrequest.ThewebcontainerdoesnotdecodethisString.Forexample:FirstlineofHTTPrequest ReturnedValuePOST/some/path.htmlHTTP/1.1 /some/path.htmlGEThttp://foo.bar/a.htmlHTTP/1.0 /a.htmlHEAD/xyz?a=bHTTP/1.1 /xyz

ToreconstructanURLwithaschemeandhost,useHttpUtils.getRequestURL(javax.servlet.http.HttpServletRequest)

Page 141: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Returns:aStringcontainingthepartoftheURLfromtheprotocolnameuptothequerystring

SeeAlso:HttpUtils.getRequestURL(javax.servlet.http.HttpServletRequest)

getRequestURL

publicjava.lang.StringBuffergetRequestURL()

ReconstructstheURLtheclientusedtomaketherequest.ThereturnedURLcontainsaprotocol,servername,portnumber,andserverpath,butitdoesnotincludequerystringparameters.

BecausethismethodreturnsaStringBuffer,notastring,youcanmodifytheURLeasily,forexample,toappendqueryparameters.

Thismethodisusefulforcreatingredirectmessagesandforreportingerrors.

Returns:aStringBufferobjectcontainingthereconstructedURL

getServletPath

publicjava.lang.StringgetServletPath()

Returnsthepartofthisrequest'sURLthatcallstheservlet.Thisincludeseithertheservletnameorapathtotheservlet,butdoesnotincludeanyextrapathinformationoraquerystring.SameasthevalueoftheCGIvariableSCRIPT_NAME.Returns:

aStringcontainingthenameorpathoftheservletbeingcalled,asspecifiedintherequestURL,decoded.

getSession

publicHttpSessiongetSession(booleancreate)

Page 142: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ReturnsthecurrentHttpSessionassociatedwiththisrequestor,ififthereisnocurrentsessionandcreateistrue,returnsanewsession.

IfcreateisfalseandtherequesthasnovalidHttpSession,thismethodreturnsnull.

Tomakesurethesessionisproperlymaintained,youmustcallthismethodbeforetheresponseiscommitted.Ifthecontainerisusingcookiestomaintainsessionintegrityandisaskedtocreateanewsessionwhentheresponseiscommitted,anIllegalStateExceptionisthrown.

Parameters:true-tocreateanewsessionforthisrequestifnecessary;falsetoreturnnullifthere'snocurrentsession

Returns:theHttpSessionassociatedwiththisrequestornullifcreateisfalseandtherequesthasnovalidsession

SeeAlso:getSession()

getSession

publicHttpSessiongetSession()

Returnsthecurrentsessionassociatedwiththisrequest,oriftherequestdoesnothaveasession,createsone.Returns:

theHttpSessionassociatedwiththisrequestSeeAlso:

getSession(boolean)

isRequestedSessionIdValid

publicbooleanisRequestedSessionIdValid()

CheckswhethertherequestedsessionIDisstillvalid.Returns:

trueifthisrequesthasanidforavalidsessioninthecurrent

Page 143: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

sessioncontext;falseotherwiseSeeAlso:

getRequestedSessionId(),getSession(boolean),HttpSessionContext

isRequestedSessionIdFromCookie

publicbooleanisRequestedSessionIdFromCookie()

CheckswhethertherequestedsessionIDcameinasacookie.Returns:

trueifthesessionIDcameinasacookie;otherwise,falseSeeAlso:

getSession(boolean)

isRequestedSessionIdFromURL

publicbooleanisRequestedSessionIdFromURL()

CheckswhethertherequestedsessionIDcameinaspartoftherequestURL.Returns:

trueifthesessionIDcameinaspartofaURL;otherwise,falseSeeAlso:

getSession(boolean)

isRequestedSessionIdFromUrl

publicbooleanisRequestedSessionIdFromUrl()

Deprecated.AsofVersion2.1oftheJavaServletAPI,useisRequestedSessionIdFromURL()instead.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 144: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 145: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpClassHttpServletRequestWrapperjava.lang.Object

|

+--javax.servlet.ServletRequestWrapper

|

+--javax.servlet.http.HttpServletRequestWrapper

publicclassHttpServletRequestWrapperextendsServletRequestWrapperimplementsHttpServletRequest

ProvidesaconvenientimplementationoftheHttpServletRequestinterfacethatcanbesubclassedbydeveloperswishingtoadapttherequesttoaServlet.ThisclassimplementstheWrapperorDecoratorpattern.Methodsdefaulttocallingthroughtothewrappedrequestobject.

Since:v2.3

SeeAlso:HttpServletRequest

ConstructorSummaryHttpServletRequestWrapper(HttpServletRequestrequest)Constructsarequestobjectwrappingthegivenrequest.

MethodSummary

java.lang.String

getAuthType()ThedefaultbehaviorofthismethodistoreturngetAuthType()onthewrappedrequestobject.

java.lang.String

getContextPath()ThedefaultbehaviorofthismethodistoreturngetContextPath()onthewrappedrequestobject.getCookies()

Page 146: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Cookie[] ThedefaultbehaviorofthismethodistoreturngetCookies()onthewrappedrequestobject.

long

getDateHeader(java.lang.Stringname)ThedefaultbehaviorofthismethodistoreturngetDateHeader(Stringname)onthewrappedrequestobject.

java.lang.String

getHeader(java.lang.Stringname)ThedefaultbehaviorofthismethodistoreturngetHeader(Stringname)onthewrappedrequestobject.

java.util.Enumeration

getHeaderNames()ThedefaultbehaviorofthismethodistoreturngetHeaderNames()onthewrappedrequestobject.

java.util.Enumeration

getHeaders(java.lang.Stringname)ThedefaultbehaviorofthismethodistoreturngetHeaders(Stringname)onthewrappedrequestobject.

int

getIntHeader(java.lang.Stringname)ThedefaultbehaviorofthismethodistoreturngetIntHeader(Stringname)onthewrappedrequestobject.

java.lang.String

getMethod()ThedefaultbehaviorofthismethodistoreturngetMethod()onthewrappedrequestobject.

java.lang.String

getPathInfo()ThedefaultbehaviorofthismethodistoreturngetPathInfo()onthewrappedrequestobject.

java.lang.String

getPathTranslated()ThedefaultbehaviorofthismethodistoreturngetPathTranslated()onthewrappedrequestobject.

java.lang.String

getQueryString()ThedefaultbehaviorofthismethodistoreturngetQueryString()onthewrappedrequestobject.

java.lang.String

getRemoteUser()ThedefaultbehaviorofthismethodistoreturngetRemoteUser()onthewrappedrequestobject.

java.lang.String

getRequestedSessionId()

Page 147: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThedefaultbehaviorofthismethodistoreturngetRequestedSessionId()onthewrappedrequestobject.

java.lang.String

getRequestURI()ThedefaultbehaviorofthismethodistoreturngetRequestURI()onthewrappedrequestobject.

java.lang.StringBuffer

getRequestURL()ThedefaultbehaviorofthismethodistoreturngetRequestURL()onthewrappedrequestobject.

java.lang.String

getServletPath()ThedefaultbehaviorofthismethodistoreturngetServletPath()onthewrappedrequestobject.

HttpSession

getSession()ThedefaultbehaviorofthismethodistoreturngetSession()onthewrappedrequestobject.

HttpSession

getSession(booleancreate)ThedefaultbehaviorofthismethodistoreturngetSession(booleancreate)onthewrappedrequestobject.

java.security.Principal

getUserPrincipal()ThedefaultbehaviorofthismethodistoreturngetUserPrincipal()onthewrappedrequestobject.

boolean

isRequestedSessionIdFromCookie()ThedefaultbehaviorofthismethodistoreturnisRequestedSessionIdFromCookie()onthewrappedrequestobject.

boolean

isRequestedSessionIdFromUrl()ThedefaultbehaviorofthismethodistoreturnisRequestedSessionIdFromUrl()onthewrappedrequestobject.

boolean

isRequestedSessionIdFromURL()ThedefaultbehaviorofthismethodistoreturnisRequestedSessionIdFromURL()onthewrappedrequestobject.

boolean

isRequestedSessionIdValid()ThedefaultbehaviorofthismethodistoreturnisRequestedSessionIdValid()onthewrappedrequest

Page 148: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

object.

boolean

isUserInRole(java.lang.Stringrole)ThedefaultbehaviorofthismethodistoreturnisUserInRole(Stringrole)onthewrappedrequestobject.

Methodsinheritedfromclassjavax.servlet.ServletRequestWrappergetAttribute,getAttributeNames,getCharacterEncoding,

getContentLength,getContentType,getInputStream,getLocale,

getLocales,getParameter,getParameterMap,getParameterNames,

getParameterValues,getProtocol,getReader,getRealPath,

getRemoteAddr,getRemoteHost,getRequest,getRequestDispatcher,

getScheme,getServerName,getServerPort,isSecure,

removeAttribute,setAttribute,setCharacterEncoding,setRequest

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

toString,wait,wait,wait

ConstructorDetail

HttpServletRequestWrapper

publicHttpServletRequestWrapper(HttpServletRequestrequest)

Constructsarequestobjectwrappingthegivenrequest.Throws:

java.lang.IllegalArgumentException-iftherequestisnull

MethodDetail

getAuthType

publicjava.lang.StringgetAuthType()

ThedefaultbehaviorofthismethodistoreturngetAuthType()onthewrappedrequestobject.

Page 149: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Specifiedby:getAuthTypeininterfaceHttpServletRequest

getCookies

publicCookie[]getCookies()

ThedefaultbehaviorofthismethodistoreturngetCookies()onthewrappedrequestobject.Specifiedby:

getCookiesininterfaceHttpServletRequest

getDateHeader

publiclonggetDateHeader(java.lang.Stringname)

ThedefaultbehaviorofthismethodistoreturngetDateHeader(Stringname)onthewrappedrequestobject.Specifiedby:

getDateHeaderininterfaceHttpServletRequest

getHeader

publicjava.lang.StringgetHeader(java.lang.Stringname)

ThedefaultbehaviorofthismethodistoreturngetHeader(Stringname)onthewrappedrequestobject.Specifiedby:

getHeaderininterfaceHttpServletRequest

getHeaders

publicjava.util.EnumerationgetHeaders(java.lang.Stringname)

ThedefaultbehaviorofthismethodistoreturngetHeaders(Stringname)on

Page 150: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

thewrappedrequestobject.Specifiedby:

getHeadersininterfaceHttpServletRequest

getHeaderNames

publicjava.util.EnumerationgetHeaderNames()

ThedefaultbehaviorofthismethodistoreturngetHeaderNames()onthewrappedrequestobject.Specifiedby:

getHeaderNamesininterfaceHttpServletRequest

getIntHeader

publicintgetIntHeader(java.lang.Stringname)

ThedefaultbehaviorofthismethodistoreturngetIntHeader(Stringname)onthewrappedrequestobject.Specifiedby:

getIntHeaderininterfaceHttpServletRequest

getMethod

publicjava.lang.StringgetMethod()

ThedefaultbehaviorofthismethodistoreturngetMethod()onthewrappedrequestobject.Specifiedby:

getMethodininterfaceHttpServletRequest

getPathInfo

publicjava.lang.StringgetPathInfo()

Page 151: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThedefaultbehaviorofthismethodistoreturngetPathInfo()onthewrappedrequestobject.Specifiedby:

getPathInfoininterfaceHttpServletRequest

getPathTranslated

publicjava.lang.StringgetPathTranslated()

ThedefaultbehaviorofthismethodistoreturngetPathTranslated()onthewrappedrequestobject.Specifiedby:

getPathTranslatedininterfaceHttpServletRequest

getContextPath

publicjava.lang.StringgetContextPath()

ThedefaultbehaviorofthismethodistoreturngetContextPath()onthewrappedrequestobject.Specifiedby:

getContextPathininterfaceHttpServletRequest

getQueryString

publicjava.lang.StringgetQueryString()

ThedefaultbehaviorofthismethodistoreturngetQueryString()onthewrappedrequestobject.Specifiedby:

getQueryStringininterfaceHttpServletRequest

getRemoteUser

publicjava.lang.StringgetRemoteUser()

Page 152: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThedefaultbehaviorofthismethodistoreturngetRemoteUser()onthewrappedrequestobject.Specifiedby:

getRemoteUserininterfaceHttpServletRequest

isUserInRole

publicbooleanisUserInRole(java.lang.Stringrole)

ThedefaultbehaviorofthismethodistoreturnisUserInRole(Stringrole)onthewrappedrequestobject.Specifiedby:

isUserInRoleininterfaceHttpServletRequest

getUserPrincipal

publicjava.security.PrincipalgetUserPrincipal()

ThedefaultbehaviorofthismethodistoreturngetUserPrincipal()onthewrappedrequestobject.Specifiedby:

getUserPrincipalininterfaceHttpServletRequest

getRequestedSessionId

publicjava.lang.StringgetRequestedSessionId()

ThedefaultbehaviorofthismethodistoreturngetRequestedSessionId()onthewrappedrequestobject.Specifiedby:

getRequestedSessionIdininterfaceHttpServletRequest

getRequestURI

publicjava.lang.StringgetRequestURI()

Page 153: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThedefaultbehaviorofthismethodistoreturngetRequestURI()onthewrappedrequestobject.Specifiedby:

getRequestURIininterfaceHttpServletRequest

getRequestURL

publicjava.lang.StringBuffergetRequestURL()

ThedefaultbehaviorofthismethodistoreturngetRequestURL()onthewrappedrequestobject.Specifiedby:

getRequestURLininterfaceHttpServletRequest

getServletPath

publicjava.lang.StringgetServletPath()

ThedefaultbehaviorofthismethodistoreturngetServletPath()onthewrappedrequestobject.Specifiedby:

getServletPathininterfaceHttpServletRequest

getSession

publicHttpSessiongetSession(booleancreate)

ThedefaultbehaviorofthismethodistoreturngetSession(booleancreate)onthewrappedrequestobject.Specifiedby:

getSessionininterfaceHttpServletRequest

getSession

publicHttpSessiongetSession()

Page 154: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThedefaultbehaviorofthismethodistoreturngetSession()onthewrappedrequestobject.Specifiedby:

getSessionininterfaceHttpServletRequest

isRequestedSessionIdValid

publicbooleanisRequestedSessionIdValid()

ThedefaultbehaviorofthismethodistoreturnisRequestedSessionIdValid()onthewrappedrequestobject.Specifiedby:

isRequestedSessionIdValidininterfaceHttpServletRequest

isRequestedSessionIdFromCookie

publicbooleanisRequestedSessionIdFromCookie()

ThedefaultbehaviorofthismethodistoreturnisRequestedSessionIdFromCookie()onthewrappedrequestobject.Specifiedby:

isRequestedSessionIdFromCookieininterfaceHttpServletRequest

isRequestedSessionIdFromURL

publicbooleanisRequestedSessionIdFromURL()

ThedefaultbehaviorofthismethodistoreturnisRequestedSessionIdFromURL()onthewrappedrequestobject.Specifiedby:

isRequestedSessionIdFromURLininterfaceHttpServletRequest

isRequestedSessionIdFromUrl

publicbooleanisRequestedSessionIdFromUrl()

Page 155: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThedefaultbehaviorofthismethodistoreturnisRequestedSessionIdFromUrl()onthewrappedrequestobject.Specifiedby:

isRequestedSessionIdFromUrlininterfaceHttpServletRequest

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 156: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 157: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpInterfaceHttpServletResponse

AllKnownImplementingClasses:HttpServletResponseWrapper

publicabstractinterfaceHttpServletResponseextendsServletResponse

ExtendstheServletResponseinterfacetoprovideHTTP-specificfunctionalityinsendingaresponse.Forexample,ithasmethodstoaccessHTTPheadersandcookies.

TheservletcontainercreatesanHttpServletRequestobjectandpassesitasanargumenttotheservlet'sservicemethods(doGet,doPost,etc).

SeeAlso:ServletResponse

FieldSummary

staticint

SC_ACCEPTEDStatuscode(202)indicatingthatarequestwasacceptedforprocessing,butwasnotcompleted.

staticint

SC_BAD_GATEWAYStatuscode(502)indicatingthattheHTTPserverreceivedaninvalidresponsefromaserveritconsultedwhenactingasaproxyorgateway.

staticint

SC_BAD_REQUESTStatuscode(400)indicatingtherequestsentbytheclientwassyntacticallyincorrect.

staticint

SC_CONFLICTStatuscode(409)indicatingthattherequestcouldnotbecompletedduetoaconflictwiththecurrentstateoftheresource.

staticintSC_CONTINUEStatuscode(100)indicatingtheclientcancontinue.

Page 158: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

staticint

SC_CREATEDStatuscode(201)indicatingtherequestsucceededandcreatedanewresourceontheserver.

staticint

SC_EXPECTATION_FAILEDStatuscode(417)indicatingthattheservercouldnotmeettheexpectationgivenintheExpectrequestheader.

staticint

SC_FORBIDDENStatuscode(403)indicatingtheserverunderstoodtherequestbutrefusedtofulfillit.

staticint

SC_GATEWAY_TIMEOUTStatuscode(504)indicatingthattheserverdidnotreceiveatimelyresponsefromtheupstreamserverwhileactingasagatewayorproxy.

staticint

SC_GONEStatuscode(410)indicatingthattheresourceisnolongeravailableattheserverandnoforwardingaddressisknown.

staticint

SC_HTTP_VERSION_NOT_SUPPORTEDStatuscode(505)indicatingthattheserverdoesnotsupportorrefusestosupporttheHTTPprotocolversionthatwasusedintherequestmessage.

staticint

SC_INTERNAL_SERVER_ERRORStatuscode(500)indicatinganerrorinsidetheHTTPserverwhichpreventeditfromfulfillingtherequest.

staticint

SC_LENGTH_REQUIREDStatuscode(411)indicatingthattherequestcannotbehandledwithoutadefinedContent-Length.

staticint

SC_METHOD_NOT_ALLOWEDStatuscode(405)indicatingthatthemethodspecifiedintheRequest-LineisnotallowedfortheresourceidentifiedbytheRequest-URI.

staticint

SC_MOVED_PERMANENTLYStatuscode(301)indicatingthattheresourcehaspermanentlymovedtoanewlocation,andthatfuturereferencesshoulduseanewURIwiththeirrequests.SC_MOVED_TEMPORARILYStatuscode(302)indicatingthattheresourcehastemporarily

Page 159: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

staticint movedtoanotherlocation,butthatfuturereferencesshouldstillusetheoriginalURItoaccesstheresource.

staticint

SC_MULTIPLE_CHOICESStatuscode(300)indicatingthattherequestedresourcecorrespondstoanyoneofasetofrepresentations,eachwithitsownspecificlocation.

staticint

SC_NO_CONTENTStatuscode(204)indicatingthattherequestsucceededbutthattherewasnonewinformationtoreturn.

staticint

SC_NON_AUTHORITATIVE_INFORMATIONStatuscode(203)indicatingthatthemetainformationpresentedbytheclientdidnotoriginatefromtheserver.

staticint

SC_NOT_ACCEPTABLEStatuscode(406)indicatingthattheresourceidentifiedbytherequestisonlycapableofgeneratingresponseentitieswhichhavecontentcharacteristicsnotacceptableaccordingtotheacceptheaderssentintherequest.

staticint

SC_NOT_FOUNDStatuscode(404)indicatingthattherequestedresourceisnotavailable.

staticint

SC_NOT_IMPLEMENTEDStatuscode(501)indicatingtheHTTPserverdoesnotsupportthefunctionalityneededtofulfilltherequest.

staticint

SC_NOT_MODIFIEDStatuscode(304)indicatingthataconditionalGEToperationfoundthattheresourcewasavailableandnotmodified.

staticintSC_OKStatuscode(200)indicatingtherequestsucceedednormally.

staticint

SC_PARTIAL_CONTENTStatuscode(206)indicatingthattheserverhasfulfilledthepartialGETrequestfortheresource.

staticintSC_PAYMENT_REQUIREDStatuscode(402)reservedforfutureuse.SC_PRECONDITION_FAILEDStatuscode(412)indicatingthatthepreconditiongiveninone

Page 160: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

staticint ormoreoftherequest-headerfieldsevaluatedtofalsewhenitwastestedontheserver.

staticint

SC_PROXY_AUTHENTICATION_REQUIREDStatuscode(407)indicatingthattheclientMUSTfirstauthenticateitselfwiththeproxy.

staticint

SC_REQUEST_ENTITY_TOO_LARGEStatuscode(413)indicatingthattheserverisrefusingtoprocesstherequestbecausetherequestentityislargerthantheserveriswillingorabletoprocess.

staticint

SC_REQUEST_TIMEOUTStatuscode(408)indicatingthattheclientdidnotproducearequestwithinthetimethattheserverwaspreparedtowait.

staticint

SC_REQUEST_URI_TOO_LONGStatuscode(414)indicatingthattheserverisrefusingtoservicetherequestbecausetheRequest-URIislongerthantheserveriswillingtointerpret.

staticint

SC_REQUESTED_RANGE_NOT_SATISFIABLEStatuscode(416)indicatingthattheservercannotservetherequestedbyterange.

staticint

SC_RESET_CONTENTStatuscode(205)indicatingthattheagentSHOULDresetthedocumentviewwhichcausedtherequesttobesent.

staticint

SC_SEE_OTHERStatuscode(303)indicatingthattheresponsetotherequestcanbefoundunderadifferentURI.

staticint

SC_SERVICE_UNAVAILABLEStatuscode(503)indicatingthattheHTTPserveristemporarilyoverloaded,andunabletohandletherequest.

staticint

SC_SWITCHING_PROTOCOLSStatuscode(101)indicatingtheserverisswitchingprotocolsaccordingtoUpgradeheader.

staticint

SC_TEMPORARY_REDIRECTStatuscode(307)indicatingthattherequestedresourceresidestemporarilyunderadifferentURI.SC_UNAUTHORIZED

Page 161: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

staticint Statuscode(401)indicatingthattherequestrequiresHTTPauthentication.

staticint

SC_UNSUPPORTED_MEDIA_TYPEStatuscode(415)indicatingthattheserverisrefusingtoservicetherequestbecausetheentityoftherequestisinaformatnotsupportedbytherequestedresourcefortherequestedmethod.

staticint

SC_USE_PROXYStatuscode(305)indicatingthattherequestedresourceMUSTbeaccessedthroughtheproxygivenbytheLocationfield.

MethodSummaryvoid

addCookie(Cookiecookie)Addsthespecifiedcookietotheresponse.

void

addDateHeader(java.lang.Stringname,longdate)Addsaresponseheaderwiththegivennameanddate-value.

void

addHeader(java.lang.Stringname,

java.lang.Stringvalue)Addsaresponseheaderwiththegivennameandvalue.

void

addIntHeader(java.lang.Stringname,intvalue)Addsaresponseheaderwiththegivennameandintegervalue.

boolean

containsHeader(java.lang.Stringname)Returnsabooleanindicatingwhetherthenamedresponseheaderhasalreadybeenset.

java.lang.String

encodeRedirectUrl(java.lang.Stringurl)Deprecated.Asofversion2.1,useencodeRedirectURL(Stringurl)instead

java.lang.String

encodeRedirectURL(java.lang.Stringurl)EncodesthespecifiedURLforuseinthesendRedirectmethodor,ifencodingisnotneeded,returnstheURLunchanged.

java.lang.String

encodeUrl(java.lang.Stringurl)Deprecated.Asofversion2.1,useencodeURL(String

Page 162: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

url)instead

java.lang.String

encodeURL(java.lang.Stringurl)EncodesthespecifiedURLbyincludingthesessionIDinit,or,ifencodingisnotneeded,returnstheURLunchanged.

void

sendError(intsc)Sendsanerrorresponsetotheclientusingthespecifiedstatuscodeandclearingthebuffer.

void

sendError(intsc,java.lang.Stringmsg)Sendsanerrorresponsetotheclientusingthespecifiedstatusclearingthebuffer.

void

sendRedirect(java.lang.Stringlocation)SendsatemporaryredirectresponsetotheclientusingthespecifiedredirectlocationURL.

void

setDateHeader(java.lang.Stringname,longdate)Setsaresponseheaderwiththegivennameanddate-value.

void

setHeader(java.lang.Stringname,

java.lang.Stringvalue)Setsaresponseheaderwiththegivennameandvalue.

void

setIntHeader(java.lang.Stringname,intvalue)Setsaresponseheaderwiththegivennameandintegervalue.

voidsetStatus(intsc)Setsthestatuscodeforthisresponse.

void

setStatus(intsc,java.lang.Stringsm)Deprecated.Asofversion2.1,duetoambiguousmeaningofthemessageparameter.TosetastatuscodeusesetStatus(int),tosendanerrorwithadescriptionusesendError(int,String).Setsthestatuscodeandmessageforthisresponse.

Methodsinheritedfrominterfacejavax.servlet.ServletResponseflushBuffer,getBufferSize,getCharacterEncoding,getLocale,

getOutputStream,getWriter,isCommitted,reset,resetBuffer,

setBufferSize,setContentLength,setContentType,setLocale

Page 163: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

FieldDetail

SC_CONTINUE

publicstaticfinalintSC_CONTINUE

Statuscode(100)indicatingtheclientcancontinue.

SC_SWITCHING_PROTOCOLS

publicstaticfinalintSC_SWITCHING_PROTOCOLS

Statuscode(101)indicatingtheserverisswitchingprotocolsaccordingtoUpgradeheader.

SC_OK

publicstaticfinalintSC_OK

Statuscode(200)indicatingtherequestsucceedednormally.

SC_CREATED

publicstaticfinalintSC_CREATED

Statuscode(201)indicatingtherequestsucceededandcreatedanewresourceontheserver.

SC_ACCEPTED

publicstaticfinalintSC_ACCEPTED

Statuscode(202)indicatingthatarequestwasacceptedforprocessing,butwasnotcompleted.

Page 164: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SC_NON_AUTHORITATIVE_INFORMATION

publicstaticfinalintSC_NON_AUTHORITATIVE_INFORMATION

Statuscode(203)indicatingthatthemetainformationpresentedbytheclientdidnotoriginatefromtheserver.

SC_NO_CONTENT

publicstaticfinalintSC_NO_CONTENT

Statuscode(204)indicatingthattherequestsucceededbutthattherewasnonewinformationtoreturn.

SC_RESET_CONTENT

publicstaticfinalintSC_RESET_CONTENT

Statuscode(205)indicatingthattheagentSHOULDresetthedocumentviewwhichcausedtherequesttobesent.

SC_PARTIAL_CONTENT

publicstaticfinalintSC_PARTIAL_CONTENT

Statuscode(206)indicatingthattheserverhasfulfilledthepartialGETrequestfortheresource.

SC_MULTIPLE_CHOICES

publicstaticfinalintSC_MULTIPLE_CHOICES

Statuscode(300)indicatingthattherequestedresourcecorrespondstoanyoneofasetofrepresentations,eachwithitsownspecificlocation.

Page 165: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SC_MOVED_PERMANENTLY

publicstaticfinalintSC_MOVED_PERMANENTLY

Statuscode(301)indicatingthattheresourcehaspermanentlymovedtoanewlocation,andthatfuturereferencesshoulduseanewURIwiththeirrequests.

SC_MOVED_TEMPORARILY

publicstaticfinalintSC_MOVED_TEMPORARILY

Statuscode(302)indicatingthattheresourcehastemporarilymovedtoanotherlocation,butthatfuturereferencesshouldstillusetheoriginalURItoaccesstheresource.

SC_SEE_OTHER

publicstaticfinalintSC_SEE_OTHER

Statuscode(303)indicatingthattheresponsetotherequestcanbefoundunderadifferentURI.

SC_NOT_MODIFIED

publicstaticfinalintSC_NOT_MODIFIED

Statuscode(304)indicatingthataconditionalGEToperationfoundthattheresourcewasavailableandnotmodified.

SC_USE_PROXY

publicstaticfinalintSC_USE_PROXY

Statuscode(305)indicatingthattherequestedresourceMUSTbeaccessedthroughtheproxygivenbytheLocationfield.

Page 166: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SC_TEMPORARY_REDIRECT

publicstaticfinalintSC_TEMPORARY_REDIRECT

Statuscode(307)indicatingthattherequestedresourceresidestemporarilyunderadifferentURI.ThetemporaryURISHOULDbegivenbytheLocationfieldintheresponse.

SC_BAD_REQUEST

publicstaticfinalintSC_BAD_REQUEST

Statuscode(400)indicatingtherequestsentbytheclientwassyntacticallyincorrect.

SC_UNAUTHORIZED

publicstaticfinalintSC_UNAUTHORIZED

Statuscode(401)indicatingthattherequestrequiresHTTPauthentication.

SC_PAYMENT_REQUIRED

publicstaticfinalintSC_PAYMENT_REQUIRED

Statuscode(402)reservedforfutureuse.

SC_FORBIDDEN

publicstaticfinalintSC_FORBIDDEN

Statuscode(403)indicatingtheserverunderstoodtherequestbutrefusedtofulfillit.

Page 167: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SC_NOT_FOUND

publicstaticfinalintSC_NOT_FOUND

Statuscode(404)indicatingthattherequestedresourceisnotavailable.

SC_METHOD_NOT_ALLOWED

publicstaticfinalintSC_METHOD_NOT_ALLOWED

Statuscode(405)indicatingthatthemethodspecifiedintheRequest-LineisnotallowedfortheresourceidentifiedbytheRequest-URI.

SC_NOT_ACCEPTABLE

publicstaticfinalintSC_NOT_ACCEPTABLE

Statuscode(406)indicatingthattheresourceidentifiedbytherequestisonlycapableofgeneratingresponseentitieswhichhavecontentcharacteristicsnotacceptableaccordingtotheacceptheaderssentintherequest.

SC_PROXY_AUTHENTICATION_REQUIRED

publicstaticfinalintSC_PROXY_AUTHENTICATION_REQUIRED

Statuscode(407)indicatingthattheclientMUSTfirstauthenticateitselfwiththeproxy.

SC_REQUEST_TIMEOUT

publicstaticfinalintSC_REQUEST_TIMEOUT

Statuscode(408)indicatingthattheclientdidnotproducearequestwithinthetimethattheserverwaspreparedtowait.

Page 168: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SC_CONFLICT

publicstaticfinalintSC_CONFLICT

Statuscode(409)indicatingthattherequestcouldnotbecompletedduetoaconflictwiththecurrentstateoftheresource.

SC_GONE

publicstaticfinalintSC_GONE

Statuscode(410)indicatingthattheresourceisnolongeravailableattheserverandnoforwardingaddressisknown.ThisconditionSHOULDbeconsideredpermanent.

SC_LENGTH_REQUIRED

publicstaticfinalintSC_LENGTH_REQUIRED

Statuscode(411)indicatingthattherequestcannotbehandledwithoutadefinedContent-Length.

SC_PRECONDITION_FAILED

publicstaticfinalintSC_PRECONDITION_FAILED

Statuscode(412)indicatingthatthepreconditiongiveninoneormoreoftherequest-headerfieldsevaluatedtofalsewhenitwastestedontheserver.

SC_REQUEST_ENTITY_TOO_LARGE

publicstaticfinalintSC_REQUEST_ENTITY_TOO_LARGE

Statuscode(413)indicatingthattheserverisrefusingtoprocesstherequestbecausetherequestentityislargerthantheserveriswillingorableto

Page 169: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

process.

SC_REQUEST_URI_TOO_LONG

publicstaticfinalintSC_REQUEST_URI_TOO_LONG

Statuscode(414)indicatingthattheserverisrefusingtoservicetherequestbecausetheRequest-URIislongerthantheserveriswillingtointerpret.

SC_UNSUPPORTED_MEDIA_TYPE

publicstaticfinalintSC_UNSUPPORTED_MEDIA_TYPE

Statuscode(415)indicatingthattheserverisrefusingtoservicetherequestbecausetheentityoftherequestisinaformatnotsupportedbytherequestedresourcefortherequestedmethod.

SC_REQUESTED_RANGE_NOT_SATISFIABLE

publicstaticfinalintSC_REQUESTED_RANGE_NOT_SATISFIABLE

Statuscode(416)indicatingthattheservercannotservetherequestedbyterange.

SC_EXPECTATION_FAILED

publicstaticfinalintSC_EXPECTATION_FAILED

Statuscode(417)indicatingthattheservercouldnotmeettheexpectationgivenintheExpectrequestheader.

SC_INTERNAL_SERVER_ERROR

publicstaticfinalintSC_INTERNAL_SERVER_ERROR

Page 170: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Statuscode(500)indicatinganerrorinsidetheHTTPserverwhichpreventeditfromfulfillingtherequest.

SC_NOT_IMPLEMENTED

publicstaticfinalintSC_NOT_IMPLEMENTED

Statuscode(501)indicatingtheHTTPserverdoesnotsupportthefunctionalityneededtofulfilltherequest.

SC_BAD_GATEWAY

publicstaticfinalintSC_BAD_GATEWAY

Statuscode(502)indicatingthattheHTTPserverreceivedaninvalidresponsefromaserveritconsultedwhenactingasaproxyorgateway.

SC_SERVICE_UNAVAILABLE

publicstaticfinalintSC_SERVICE_UNAVAILABLE

Statuscode(503)indicatingthattheHTTPserveristemporarilyoverloaded,andunabletohandletherequest.

SC_GATEWAY_TIMEOUT

publicstaticfinalintSC_GATEWAY_TIMEOUT

Statuscode(504)indicatingthattheserverdidnotreceiveatimelyresponsefromtheupstreamserverwhileactingasagatewayorproxy.

SC_HTTP_VERSION_NOT_SUPPORTED

publicstaticfinalintSC_HTTP_VERSION_NOT_SUPPORTED

Page 171: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Statuscode(505)indicatingthattheserverdoesnotsupportorrefusestosupporttheHTTPprotocolversionthatwasusedintherequestmessage.

MethodDetail

addCookie

publicvoidaddCookie(Cookiecookie)

Addsthespecifiedcookietotheresponse.Thismethodcanbecalledmultipletimestosetmorethanonecookie.Parameters:

cookie-theCookietoreturntotheclient

containsHeader

publicbooleancontainsHeader(java.lang.Stringname)

Returnsabooleanindicatingwhetherthenamedresponseheaderhasalreadybeenset.Parameters:

name-theheadernameReturns:

trueifthenamedresponseheaderhasalreadybeenset;falseotherwise

encodeURL

publicjava.lang.StringencodeURL(java.lang.Stringurl)

EncodesthespecifiedURLbyincludingthesessionIDinit,or,ifencodingisnotneeded,returnstheURLunchanged.TheimplementationofthismethodincludesthelogictodeterminewhetherthesessionIDneedstobeencodedintheURL.Forexample,ifthebrowsersupportscookies,orsessiontrackingisturnedoff,URLencodingisunnecessary.

Forrobustsessiontracking,allURLsemittedbyaservletshouldberun

Page 172: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

throughthismethod.Otherwise,URLrewritingcannotbeusedwithbrowserswhichdonotsupportcookies.

Parameters:url-theurltobeencoded.

Returns:theencodedURLifencodingisneeded;theunchangedURLotherwise.

encodeRedirectURL

publicjava.lang.StringencodeRedirectURL(java.lang.Stringurl)

EncodesthespecifiedURLforuseinthesendRedirectmethodor,ifencodingisnotneeded,returnstheURLunchanged.TheimplementationofthismethodincludesthelogictodeterminewhetherthesessionIDneedstobeencodedintheURL.Becausetherulesformakingthisdeterminationcandifferfromthoseusedtodecidewhethertoencodeanormallink,thismethodisseperatefromtheencodeURLmethod.

AllURLssenttotheHttpServletResponse.sendRedirectmethodshouldberunthroughthismethod.Otherwise,URLrewritingcannotbeusedwithbrowserswhichdonotsupportcookies.

Parameters:url-theurltobeencoded.

Returns:theencodedURLifencodingisneeded;theunchangedURLotherwise.

SeeAlso:sendRedirect(java.lang.String),encodeUrl(java.lang.String)

encodeUrl

publicjava.lang.StringencodeUrl(java.lang.Stringurl)

Deprecated.Asofversion2.1,useencodeURL(Stringurl)instead

Page 173: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Parameters:url-theurltobeencoded.

Returns:theencodedURLifencodingisneeded;theunchangedURLotherwise.

encodeRedirectUrl

publicjava.lang.StringencodeRedirectUrl(java.lang.Stringurl)

Deprecated.Asofversion2.1,useencodeRedirectURL(Stringurl)insteadParameters:

url-theurltobeencoded.Returns:

theencodedURLifencodingisneeded;theunchangedURLotherwise.

sendError

publicvoidsendError(intsc,

java.lang.Stringmsg)

throwsjava.io.IOException

Sendsanerrorresponsetotheclientusingthespecifiedstatusclearingthebuffer.TheserverdefaultstocreatingtheresponsetolooklikeanHTML-formattedservererrorpagecontainingthespecifiedmessage,settingthecontenttypeto"text/html",leavingcookiesandotherheadersunmodified.Ifanerror-pagedeclarationhasbeenmadeforthewebapplicationcorrespondingtothestatuscodepassedin,itwillbeservedbackinpreferencetothesuggestedmsgparameter.

Iftheresponsehasalreadybeencommitted,thismethodthrowsanIllegalStateException.Afterusingthismethod,theresponseshouldbeconsideredtobecommittedandshouldnotbewrittento.

Parameters:sc-theerrorstatuscodemsg-thedescriptivemessage

Page 174: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Throws:java.io.IOException-IfaninputoroutputexceptionoccursIllegalStateException-Iftheresponsewascommitted

sendError

publicvoidsendError(intsc)

throwsjava.io.IOException

Sendsanerrorresponsetotheclientusingthespecifiedstatuscodeandclearingthebuffer.

Iftheresponsehasalreadybeencommitted,thismethodthrowsanIllegalStateException.Afterusingthismethod,theresponseshouldbeconsideredtobecommittedandshouldnotbewrittento.

Parameters:sc-theerrorstatuscode

Throws:java.io.IOException-IfaninputoroutputexceptionoccursIllegalStateException-Iftheresponsewascommittedbeforethismethodcall

sendRedirect

publicvoidsendRedirect(java.lang.Stringlocation)

throwsjava.io.IOException

SendsatemporaryredirectresponsetotheclientusingthespecifiedredirectlocationURL.ThismethodcanacceptrelativeURLs;theservletcontainermustconverttherelativeURLtoanabsoluteURLbeforesendingtheresponsetotheclient.Ifthelocationisrelativewithoutaleading'/'thecontainerinterpretsitasrelativetothecurrentrequestURI.Ifthelocationisrelativewithaleading'/'thecontainerinterpretsitasrelativetotheservletcontainerroot.

Iftheresponsehasalreadybeencommitted,thismethodthrowsanIllegalStateException.Afterusingthismethod,theresponseshouldbe

Page 175: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

consideredtobecommittedandshouldnotbewrittento.

Parameters:location-theredirectlocationURL

Throws:java.io.IOException-IfaninputoroutputexceptionoccursIllegalStateException-Iftheresponsewascommitted

setDateHeader

publicvoidsetDateHeader(java.lang.Stringname,

longdate)

Setsaresponseheaderwiththegivennameanddate-value.Thedateisspecifiedintermsofmillisecondssincetheepoch.Iftheheaderhadalreadybeenset,thenewvalueoverwritesthepreviousone.ThecontainsHeadermethodcanbeusedtotestforthepresenceofaheaderbeforesettingitsvalue.Parameters:

name-thenameoftheheadertosetvalue-theassigneddatevalue

SeeAlso:containsHeader(java.lang.String),addDateHeader(java.lang.String,long)

addDateHeader

publicvoidaddDateHeader(java.lang.Stringname,

longdate)

Addsaresponseheaderwiththegivennameanddate-value.Thedateisspecifiedintermsofmillisecondssincetheepoch.Thismethodallowsresponseheaderstohavemultiplevalues.Parameters:

name-thenameoftheheadertosetvalue-theadditionaldatevalue

SeeAlso:setDateHeader(java.lang.String,long)

Page 176: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

setHeader

publicvoidsetHeader(java.lang.Stringname,

java.lang.Stringvalue)

Setsaresponseheaderwiththegivennameandvalue.Iftheheaderhadalreadybeenset,thenewvalueoverwritesthepreviousone.ThecontainsHeadermethodcanbeusedtotestforthepresenceofaheaderbeforesettingitsvalue.Parameters:

name-thenameoftheheadervalue-theheadervalue

SeeAlso:containsHeader(java.lang.String),addHeader(java.lang.String,java.lang.String)

addHeader

publicvoidaddHeader(java.lang.Stringname,

java.lang.Stringvalue)

Addsaresponseheaderwiththegivennameandvalue.Thismethodallowsresponseheaderstohavemultiplevalues.Parameters:

name-thenameoftheheadervalue-theadditionalheadervalue

SeeAlso:setHeader(java.lang.String,java.lang.String)

setIntHeader

publicvoidsetIntHeader(java.lang.Stringname,

intvalue)

Setsaresponseheaderwiththegivennameandintegervalue.Iftheheaderhadalreadybeenset,thenewvalueoverwritesthepreviousone.ThecontainsHeadermethodcanbeusedtotestforthepresenceofaheader

Page 177: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

beforesettingitsvalue.Parameters:

name-thenameoftheheadervalue-theassignedintegervalue

SeeAlso:containsHeader(java.lang.String),addIntHeader(java.lang.String,int)

addIntHeader

publicvoidaddIntHeader(java.lang.Stringname,

intvalue)

Addsaresponseheaderwiththegivennameandintegervalue.Thismethodallowsresponseheaderstohavemultiplevalues.Parameters:

name-thenameoftheheadervalue-theassignedintegervalue

SeeAlso:setIntHeader(java.lang.String,int)

setStatus

publicvoidsetStatus(intsc)

Setsthestatuscodeforthisresponse.Thismethodisusedtosetthereturnstatuscodewhenthereisnoerror(forexample,forthestatuscodesSC_OKorSC_MOVED_TEMPORARILY).Ifthereisanerror,andthecallerwishestoinvokeandefinedinthewebapplicaion,thesendErrormethodshouldbeusedinstead.

ThecontainerclearsthebufferandsetstheLocationheader,preservingcookiesandotherheaders.

Parameters:sc-thestatuscode

SeeAlso:sendError(int,java.lang.String)

Page 178: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

setStatus

publicvoidsetStatus(intsc,

java.lang.Stringsm)

Deprecated.Asofversion2.1,duetoambiguousmeaningofthemessageparameter.TosetastatuscodeusesetStatus(int),tosendanerrorwithadescriptionusesendError(int,String).Setsthestatuscodeandmessageforthisresponse.Parameters:

sc-thestatuscodesm-thestatusmessage

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 179: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 180: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpClassHttpServletResponseWrapperjava.lang.Object

|

+--javax.servlet.ServletResponseWrapper

|

+--javax.servlet.http.HttpServletResponseWrapper

publicclassHttpServletResponseWrapperextendsServletResponseWrapperimplementsHttpServletResponse

ProvidesaconvenientimplementationoftheHttpServletResponseinterfacethatcanbesubclassedbydeveloperswishingtoadapttheresponsefromaServlet.ThisclassimplementstheWrapperorDecoratorpattern.Methodsdefaulttocallingthroughtothewrappedresponseobject.

Since:v2.3

SeeAlso:HttpServletResponse

ConstructorSummaryHttpServletResponseWrapper(HttpServletResponseresponse)Constructsaresponseadaptorwrappingthegivenresponse.

MethodSummary

void

addCookie(Cookiecookie)ThedefaultbehaviorofthismethodistocalladdCookie(Cookiecookie)onthewrappedresponseobject.

void

addDateHeader(java.lang.Stringname,longdate)ThedefaultbehaviorofthismethodistocalladdDateHeader(Stringname,longdate)onthewrappedresponseobject.addHeader(java.lang.Stringname,

Page 181: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

void

java.lang.Stringvalue)ThedefaultbehaviorofthismethodistoreturnaddHeader(Stringname,Stringvalue)onthewrappedresponseobject.

void

addIntHeader(java.lang.Stringname,intvalue)ThedefaultbehaviorofthismethodistocalladdIntHeader(Stringname,intvalue)onthewrappedresponseobject.

boolean

containsHeader(java.lang.Stringname)ThedefaultbehaviorofthismethodistocallcontainsHeader(Stringname)onthewrappedresponseobject.

java.lang.String

encodeRedirectUrl(java.lang.Stringurl)ThedefaultbehaviorofthismethodistoreturnencodeRedirectUrl(Stringurl)onthewrappedresponseobject.

java.lang.String

encodeRedirectURL(java.lang.Stringurl)ThedefaultbehaviorofthismethodistoreturnencodeRedirectURL(Stringurl)onthewrappedresponseobject.

java.lang.String

encodeUrl(java.lang.Stringurl)ThedefaultbehaviorofthismethodistocallencodeUrl(Stringurl)onthewrappedresponseobject.

java.lang.String

encodeURL(java.lang.Stringurl)ThedefaultbehaviorofthismethodistocallencodeURL(Stringurl)onthewrappedresponseobject.

void

sendError(intsc)ThedefaultbehaviorofthismethodistocallsendError(intsc)onthewrappedresponseobject.

void

sendError(intsc,java.lang.Stringmsg)ThedefaultbehaviorofthismethodistocallsendError(intsc,Stringmsg)onthewrappedresponseobject.

void

sendRedirect(java.lang.Stringlocation)ThedefaultbehaviorofthismethodistoreturnsendRedirect(Stringlocation)onthewrappedresponseobject.

void

setDateHeader(java.lang.Stringname,longdate)ThedefaultbehaviorofthismethodistocallsetDateHeader(Stringname,longdate)onthewrapped

Page 182: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

responseobject.

void

setHeader(java.lang.Stringname,

java.lang.Stringvalue)ThedefaultbehaviorofthismethodistoreturnsetHeader(Stringname,Stringvalue)onthewrappedresponseobject.

void

setIntHeader(java.lang.Stringname,intvalue)ThedefaultbehaviorofthismethodistocallsetIntHeader(Stringname,intvalue)onthewrappedresponseobject.

void

setStatus(intsc)ThedefaultbehaviorofthismethodistocallsetStatus(intsc)onthewrappedresponseobject.

void

setStatus(intsc,java.lang.Stringsm)ThedefaultbehaviorofthismethodistocallsetStatus(intsc,Stringsm)onthewrappedresponseobject.

Methodsinheritedfromclassjavax.servlet.ServletResponseWrapperflushBuffer,getBufferSize,getCharacterEncoding,getLocale,

getOutputStream,getResponse,getWriter,isCommitted,reset,

resetBuffer,setBufferSize,setContentLength,setContentType,

setLocale,setResponse

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

toString,wait,wait,wait

ConstructorDetail

HttpServletResponseWrapper

publicHttpServletResponseWrapper(HttpServletResponseresponse)

Constructsaresponseadaptorwrappingthegivenresponse.Throws:

java.lang.IllegalArgumentException-iftheresponseisnull

Page 183: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

MethodDetail

addCookie

publicvoidaddCookie(Cookiecookie)

ThedefaultbehaviorofthismethodistocalladdCookie(Cookiecookie)onthewrappedresponseobject.Specifiedby:

addCookieininterfaceHttpServletResponse

containsHeader

publicbooleancontainsHeader(java.lang.Stringname)

ThedefaultbehaviorofthismethodistocallcontainsHeader(Stringname)onthewrappedresponseobject.Specifiedby:

containsHeaderininterfaceHttpServletResponse

encodeURL

publicjava.lang.StringencodeURL(java.lang.Stringurl)

ThedefaultbehaviorofthismethodistocallencodeURL(Stringurl)onthewrappedresponseobject.Specifiedby:

encodeURLininterfaceHttpServletResponse

encodeRedirectURL

publicjava.lang.StringencodeRedirectURL(java.lang.Stringurl)

ThedefaultbehaviorofthismethodistoreturnencodeRedirectURL(Stringurl)onthewrappedresponseobject.Specifiedby:

Page 184: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

encodeRedirectURLininterfaceHttpServletResponse

encodeUrl

publicjava.lang.StringencodeUrl(java.lang.Stringurl)

ThedefaultbehaviorofthismethodistocallencodeUrl(Stringurl)onthewrappedresponseobject.Specifiedby:

encodeUrlininterfaceHttpServletResponse

encodeRedirectUrl

publicjava.lang.StringencodeRedirectUrl(java.lang.Stringurl)

ThedefaultbehaviorofthismethodistoreturnencodeRedirectUrl(Stringurl)onthewrappedresponseobject.Specifiedby:

encodeRedirectUrlininterfaceHttpServletResponse

sendError

publicvoidsendError(intsc,

java.lang.Stringmsg)

throwsjava.io.IOException

ThedefaultbehaviorofthismethodistocallsendError(intsc,Stringmsg)onthewrappedresponseobject.Specifiedby:

sendErrorininterfaceHttpServletResponse

sendError

publicvoidsendError(intsc)

throwsjava.io.IOException

Page 185: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThedefaultbehaviorofthismethodistocallsendError(intsc)onthewrappedresponseobject.Specifiedby:

sendErrorininterfaceHttpServletResponse

sendRedirect

publicvoidsendRedirect(java.lang.Stringlocation)

throwsjava.io.IOException

ThedefaultbehaviorofthismethodistoreturnsendRedirect(Stringlocation)onthewrappedresponseobject.Specifiedby:

sendRedirectininterfaceHttpServletResponse

setDateHeader

publicvoidsetDateHeader(java.lang.Stringname,

longdate)

ThedefaultbehaviorofthismethodistocallsetDateHeader(Stringname,longdate)onthewrappedresponseobject.Specifiedby:

setDateHeaderininterfaceHttpServletResponse

addDateHeader

publicvoidaddDateHeader(java.lang.Stringname,

longdate)

ThedefaultbehaviorofthismethodistocalladdDateHeader(Stringname,longdate)onthewrappedresponseobject.Specifiedby:

addDateHeaderininterfaceHttpServletResponse

setHeader

Page 186: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicvoidsetHeader(java.lang.Stringname,

java.lang.Stringvalue)

ThedefaultbehaviorofthismethodistoreturnsetHeader(Stringname,Stringvalue)onthewrappedresponseobject.Specifiedby:

setHeaderininterfaceHttpServletResponse

addHeader

publicvoidaddHeader(java.lang.Stringname,

java.lang.Stringvalue)

ThedefaultbehaviorofthismethodistoreturnaddHeader(Stringname,Stringvalue)onthewrappedresponseobject.Specifiedby:

addHeaderininterfaceHttpServletResponse

setIntHeader

publicvoidsetIntHeader(java.lang.Stringname,

intvalue)

ThedefaultbehaviorofthismethodistocallsetIntHeader(Stringname,intvalue)onthewrappedresponseobject.Specifiedby:

setIntHeaderininterfaceHttpServletResponse

addIntHeader

publicvoidaddIntHeader(java.lang.Stringname,

intvalue)

ThedefaultbehaviorofthismethodistocalladdIntHeader(Stringname,intvalue)onthewrappedresponseobject.Specifiedby:

addIntHeaderininterfaceHttpServletResponse

Page 187: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

setStatus

publicvoidsetStatus(intsc)

ThedefaultbehaviorofthismethodistocallsetStatus(intsc)onthewrappedresponseobject.Specifiedby:

setStatusininterfaceHttpServletResponse

setStatus

publicvoidsetStatus(intsc,

java.lang.Stringsm)

ThedefaultbehaviorofthismethodistocallsetStatus(intsc,Stringsm)onthewrappedresponseobject.Specifiedby:

setStatusininterfaceHttpServletResponse

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 188: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 189: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpInterfaceHttpSession

publicabstractinterfaceHttpSession

ProvidesawaytoidentifyauseracrossmorethanonepagerequestorvisittoaWebsiteandtostoreinformationaboutthatuser.

TheservletcontainerusesthisinterfacetocreateasessionbetweenanHTTPclientandanHTTPserver.Thesessionpersistsforaspecifiedtimeperiod,acrossmorethanoneconnectionorpagerequestfromtheuser.Asessionusuallycorrespondstooneuser,whomayvisitasitemanytimes.TheservercanmaintainasessioninmanywayssuchasusingcookiesorrewritingURLs.

Thisinterfaceallowsservletsto

Viewandmanipulateinformationaboutasession,suchasthesessionidentifier,creationtime,andlastaccessedtimeBindobjectstosessions,allowinguserinformationtopersistacrossmultipleuserconnections

Whenanapplicationstoresanobjectinorremovesanobjectfromasession,thesessioncheckswhethertheobjectimplementsHttpSessionBindingListener.Ifitdoes,theservletnotifiestheobjectthatithasbeenboundtoorunboundfromthesession.Notificationsaresentafterthebindingmethodscomplete.Forsessionthatareinvalidatedorexpire,notificationsaresentafterthesessionhasbeeninvalidatdorexpired.

WhencontainermigratesasessionbetweenVMsinadistributedcontainersetting,allsessionatributesimplementingtheHttpSessionActivationListenerinterfacearenotified.

Aservletshouldbeabletohandlecasesinwhichtheclientdoesnotchoosetojoinasession,suchaswhencookiesareintentionallyturnedoff.Untiltheclientjoinsthesession,isNewreturnstrue.Iftheclientchoosesnottojointhesession,getSessionwillreturnadifferentsessiononeachrequest,andisNewwillalwaysreturntrue.

Page 190: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Sessioninformationisscopedonlytothecurrentwebapplication(ServletContext),soinformationstoredinonecontextwillnotbedirectlyvisibleinanother.

SeeAlso:HttpSessionBindingListener,HttpSessionContext

MethodSummary

java.lang.Object

getAttribute(java.lang.Stringname)Returnstheobjectboundwiththespecifiednameinthissession,ornullifnoobjectisboundunderthename.

java.util.Enumeration

getAttributeNames()ReturnsanEnumerationofStringobjectscontainingthenamesofalltheobjectsboundtothissession.

long

getCreationTime()Returnsthetimewhenthissessionwascreated,measuredinmillisecondssincemidnightJanuary1,1970GMT.

java.lang.String

getId()Returnsastringcontainingtheuniqueidentifierassignedtothissession.

long

getLastAccessedTime()Returnsthelasttimetheclientsentarequestassociatedwiththissession,asthenumberofmillisecondssincemidnightJanuary1,1970GMT,andmarkedbythetimethecontainerrecievedtherequest.

int

getMaxInactiveInterval()Returnsthemaximumtimeinterval,inseconds,thattheservletcontainerwillkeepthissessionopenbetweenclientaccesses.

ServletContext

getServletContext()ReturnstheServletContexttowhichthissessionbelongs.getSessionContext()

Page 191: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

HttpSessionContext Deprecated.AsofVersion2.1,thismethodisdeprecatedandhasnoreplacement.ItwillberemovedinafutureversionoftheJavaServletAPI.

java.lang.Object

getValue(java.lang.Stringname)Deprecated.AsofVersion2.2,thismethodisreplacedbygetAttribute(java.lang.String).

java.lang.String[]

getValueNames()Deprecated.AsofVersion2.2,thismethodisreplacedbygetAttributeNames()

void

invalidate()Invalidatesthissessionthenunbindsanyobjectsboundtoit.

boolean

isNew()Returnstrueiftheclientdoesnotyetknowaboutthesessionoriftheclientchoosesnottojointhesession.

void

putValue(java.lang.Stringname,

java.lang.Objectvalue)Deprecated.AsofVersion2.2,thismethodisreplacedbysetAttribute(java.lang.String,java.lang.Object)

void

removeAttribute(java.lang.Stringname)Removestheobjectboundwiththespecifiednamefromthissession.

void

removeValue(java.lang.Stringname)Deprecated.AsofVersion2.2,thismethodisreplacedbyremoveAttribute(java.lang.String)

void

setAttribute(java.lang.Stringname,

java.lang.Objectvalue)Bindsanobjecttothissession,usingthenamespecified.

void

setMaxInactiveInterval(intinterval)Specifiesthetime,inseconds,betweenclientrequestsbeforetheservletcontainerwillinvalidatethissession.

Page 192: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

MethodDetail

getCreationTime

publiclonggetCreationTime()

Returnsthetimewhenthissessionwascreated,measuredinmillisecondssincemidnightJanuary1,1970GMT.Returns:

alongspecifyingwhenthissessionwascreated,expressedinmillisecondssince1/1/1970GMT

Throws:IllegalStateException-ifthismethodiscalledonaninvalidatedsession

getId

publicjava.lang.StringgetId()

Returnsastringcontainingtheuniqueidentifierassignedtothissession.Theidentifierisassignedbytheservletcontainerandisimplementationdependent.Returns:

astringspecifyingtheidentifierassignedtothissession

getLastAccessedTime

publiclonggetLastAccessedTime()

Returnsthelasttimetheclientsentarequestassociatedwiththissession,asthenumberofmillisecondssincemidnightJanuary1,1970GMT,andmarkedbythetimethecontainerrecievedtherequest.

Actionsthatyourapplicationtakes,suchasgettingorsettingavalueassociatedwiththesession,donotaffecttheaccesstime.

Returns:

Page 193: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

alongrepresentingthelasttimetheclientsentarequestassociatedwiththissession,expressedinmillisecondssince1/1/1970GMT

getServletContext

publicServletContextgetServletContext()

ReturnstheServletContexttowhichthissessionbelongs.Returns:

TheServletContextobjectforthewebapplicationSince:

2.3

setMaxInactiveInterval

publicvoidsetMaxInactiveInterval(intinterval)

Specifiesthetime,inseconds,betweenclientrequestsbeforetheservletcontainerwillinvalidatethissession.Anegativetimeindicatesthesessionshouldnevertimeout.Parameters:

interval-Anintegerspecifyingthenumberofseconds

getMaxInactiveInterval

publicintgetMaxInactiveInterval()

Returnsthemaximumtimeinterval,inseconds,thattheservletcontainerwillkeepthissessionopenbetweenclientaccesses.Afterthisinterval,theservletcontainerwillinvalidatethesession.ThemaximumtimeintervalcanbesetwiththesetMaxInactiveIntervalmethod.Anegativetimeindicatesthesessionshouldnevertimeout.Returns:

anintegerspecifyingthenumberofsecondsthissessionremainsopenbetweenclientrequests

SeeAlso:

Page 194: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

setMaxInactiveInterval(int)

getSessionContext

publicHttpSessionContextgetSessionContext()

Deprecated.AsofVersion2.1,thismethodisdeprecatedandhasnoreplacement.ItwillberemovedinafutureversionoftheJavaServletAPI.

getAttribute

publicjava.lang.ObjectgetAttribute(java.lang.Stringname)

Returnstheobjectboundwiththespecifiednameinthissession,ornullifnoobjectisboundunderthename.Parameters:

name-astringspecifyingthenameoftheobjectReturns:

theobjectwiththespecifiednameThrows:

IllegalStateException-ifthismethodiscalledonaninvalidatedsession

getValue

publicjava.lang.ObjectgetValue(java.lang.Stringname)

Deprecated.AsofVersion2.2,thismethodisreplacedbygetAttribute(java.lang.String).Parameters:

name-astringspecifyingthenameoftheobjectReturns:

theobjectwiththespecifiednameThrows:

IllegalStateException-ifthismethodiscalledonaninvalidatedsession

Page 195: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getAttributeNames

publicjava.util.EnumerationgetAttributeNames()

ReturnsanEnumerationofStringobjectscontainingthenamesofalltheobjectsboundtothissession.Returns:

anEnumerationofStringobjectsspecifyingthenamesofalltheobjectsboundtothissession

Throws:IllegalStateException-ifthismethodiscalledonaninvalidatedsession

getValueNames

publicjava.lang.String[]getValueNames()

Deprecated.AsofVersion2.2,thismethodisreplacedbygetAttributeNames()

Returns:anarrayofStringobjectsspecifyingthenamesofalltheobjectsboundtothissession

Throws:IllegalStateException-ifthismethodiscalledonaninvalidatedsession

setAttribute

publicvoidsetAttribute(java.lang.Stringname,

java.lang.Objectvalue)

Bindsanobjecttothissession,usingthenamespecified.Ifanobjectofthesamenameisalreadyboundtothesession,theobjectisreplaced.

Afterthismethodexecutes,andifthenewobjectimplementsHttpSessionBindingListener,thecontainercallsHttpSessionBindingListener.valueBound.Thecontainerthennotifies

Page 196: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

anyHttpSessionAttributeListenersinthewebapplication.

IfanobjectwasalreadyboundtothissessionofthisnamethatimplementsHttpSessionBindingListener,itsHttpSessionBindingListener.valueUnboundmethodiscalled.

Ifthevaluepassedinisnull,thishasthesameeffectascallingremoveAttribute().

Parameters:name-thenametowhichtheobjectisbound;cannotbenullvalue-theobjecttobebound

Throws:IllegalStateException-ifthismethodiscalledonaninvalidatedsession

putValue

publicvoidputValue(java.lang.Stringname,

java.lang.Objectvalue)

Deprecated.AsofVersion2.2,thismethodisreplacedbysetAttribute(java.lang.String,java.lang.Object)

Parameters:name-thenametowhichtheobjectisbound;cannotbenullvalue-theobjecttobebound;cannotbenull

Throws:IllegalStateException-ifthismethodiscalledonaninvalidatedsession

removeAttribute

publicvoidremoveAttribute(java.lang.Stringname)

Removestheobjectboundwiththespecifiednamefromthissession.Ifthesessiondoesnothaveanobjectboundwiththespecifiedname,thismethoddoesnothing.

Page 197: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Afterthismethodexecutes,andiftheobjectimplementsHttpSessionBindingListener,thecontainercallsHttpSessionBindingListener.valueUnbound.ThecontainerthennotifiesanyHttpSessionAttributeListenersinthewebapplication.

Parameters:name-thenameoftheobjecttoremovefromthissession

Throws:IllegalStateException-ifthismethodiscalledonaninvalidatedsession

removeValue

publicvoidremoveValue(java.lang.Stringname)

Deprecated.AsofVersion2.2,thismethodisreplacedbyremoveAttribute(java.lang.String)

Parameters:name-thenameoftheobjecttoremovefromthissession

Throws:IllegalStateException-ifthismethodiscalledonaninvalidatedsession

invalidate

publicvoidinvalidate()

Invalidatesthissessionthenunbindsanyobjectsboundtoit.Throws:

IllegalStateException-ifthismethodiscalledonanalreadyinvalidatedsession

isNew

publicbooleanisNew()

Returnstrueiftheclientdoesnotyetknowaboutthesessionorifthe

Page 198: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

clientchoosesnottojointhesession.Forexample,iftheserverusedonlycookie-basedsessions,andtheclienthaddisabledtheuseofcookies,thenasessionwouldbenewoneachrequest.Returns:

trueiftheserverhascreatedasession,buttheclienthasnotyetjoined

Throws:IllegalStateException-ifthismethodiscalledonanalreadyinvalidatedsession

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 199: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 200: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpInterfaceHttpSessionActivationListener

publicabstractinterfaceHttpSessionActivationListenerextendsjava.util.EventListener

Objectsthatareboundtoasessionmaylistentocontainereventsnotifyingthemthatsessionswillbepassivatedandthatsessionwillbeactivated.AcontainerthatmigratessessionbetweenVMsorpersistssessionsisrequiredtonotifyallattributesboundtosessionsimplementingHttpSessionActivationListener.

Since:2.3

MethodSummaryvoid

sessionDidActivate(HttpSessionEventse)Notificationthatthesessionhasjustbeenactivated.

voidsessionWillPassivate(HttpSessionEventse)Notificationthatthesessionisabouttobepassivated.

MethodDetail

sessionWillPassivate

publicvoidsessionWillPassivate(HttpSessionEventse)

Notificationthatthesessionisabouttobepassivated.

sessionDidActivate

publicvoidsessionDidActivate(HttpSessionEventse)

Notificationthatthesessionhasjustbeenactivated.

Page 201: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 202: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 203: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpInterfaceHttpSessionAttributeListener

publicabstractinterfaceHttpSessionAttributeListenerextendsjava.util.EventListener

Thislistenerinterfacecanbeimplementedinordertogetnotificationsofchangestotheattributelistsofsessionswithinthiswebapplication.

Since:v2.3

MethodSummaryvoid

attributeAdded(HttpSessionBindingEventse)Notificationthatanattributehasbeenaddedtoasession.

voidattributeRemoved(HttpSessionBindingEventse)Notificationthatanattributehasbeenremovedfromasession.

voidattributeReplaced(HttpSessionBindingEventse)Notificationthatanattributehasbeenreplacedinasession.

MethodDetail

attributeAdded

publicvoidattributeAdded(HttpSessionBindingEventse)

Notificationthatanattributehasbeenaddedtoasession.Calledaftertheattributeisadded.

attributeRemoved

publicvoidattributeRemoved(HttpSessionBindingEventse)

Page 204: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Notificationthatanattributehasbeenremovedfromasession.Calledaftertheattributeisremoved.

attributeReplaced

publicvoidattributeReplaced(HttpSessionBindingEventse)

Notificationthatanattributehasbeenreplacedinasession.Calledaftertheattributeisreplaced.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 205: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 206: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpClassHttpSessionBindingEventjava.lang.Object

|

+--java.util.EventObject

|

+--javax.servlet.http.HttpSessionEvent

|

+--javax.servlet.http.HttpSessionBindingEvent

publicclassHttpSessionBindingEventextendsHttpSessionEvent

EventsofthistypeareeithersenttoanobjectthatimplementsHttpSessionBindingListenerwhenitisboundorunboundfromasession,ortoaHttpSessionAttributeListenerthathasbeenconfiguredinthedeploymentdescriptorwhenanyattributeisbound,unboundorreplacedinasession.

ThesessionbindstheobjectbyacalltoHttpSession.setAttributeandunbindstheobjectbyacalltoHttpSession.removeAttribute.

SeeAlso:HttpSession,HttpSessionBindingListener,HttpSessionAttributeListener,SerializedForm

Fieldsinheritedfromclassjava.util.EventObjectsource

ConstructorSummaryHttpSessionBindingEvent(HttpSessionsession,

java.lang.Stringname)Constructsaneventthatnotifiesanobjectthatithasbeenboundtoorunboundfromasession.HttpSessionBindingEvent(HttpSessionsession,

java.lang.Stringname,java.lang.Objectvalue)

Page 207: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Constructsaneventthatnotifiesanobjectthatithasbeenboundtoorunboundfromasession.

MethodSummary

java.lang.String

getName()Returnsthenamewithwhichtheattributeisboundtoorunboundfromthesession.

HttpSessiongetSession()Returnthesessionthatchanged.

java.lang.Object

getValue()Returnsthevalueoftheattributethathasbeenadded,removedorreplaced.

Methodsinheritedfromclassjava.util.EventObjectgetSource,toString

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

wait,wait,wait

ConstructorDetail

HttpSessionBindingEvent

publicHttpSessionBindingEvent(HttpSessionsession,

java.lang.Stringname)

Constructsaneventthatnotifiesanobjectthatithasbeenboundtoorunboundfromasession.Toreceivetheevent,theobjectmustimplementHttpSessionBindingListener.Parameters:

session-thesessiontowhichtheobjectisboundorunboundname-thenamewithwhichtheobjectisboundorunbound

SeeAlso:getName(),getSession()

Page 208: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

HttpSessionBindingEvent

publicHttpSessionBindingEvent(HttpSessionsession,

java.lang.Stringname,

java.lang.Objectvalue)

Constructsaneventthatnotifiesanobjectthatithasbeenboundtoorunboundfromasession.Toreceivetheevent,theobjectmustimplementHttpSessionBindingListener.Parameters:

session-thesessiontowhichtheobjectisboundorunboundname-thenamewithwhichtheobjectisboundorunbound

SeeAlso:getName(),getSession()

MethodDetail

getSession

publicHttpSessiongetSession()

Returnthesessionthatchanged.Overrides:

getSessioninclassHttpSessionEvent

getName

publicjava.lang.StringgetName()

Returnsthenamewithwhichtheattributeisboundtoorunboundfromthesession.Returns:

astringspecifyingthenamewithwhichtheobjectisboundtoorunboundfromthesession

getValue

Page 209: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicjava.lang.ObjectgetValue()

Returnsthevalueoftheattributethathasbeenadded,removedorreplaced.Iftheattributewasadded(orbound),thisisthevalueoftheattribute.Iftheattrubutewasremoved(orunbound),thisisthevalueoftheremovedattribute.Iftheattributewasreplaced,thisistheoldvalueoftheattribute.Since:

2.3

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 210: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 211: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpInterfaceHttpSessionBindingListener

publicabstractinterfaceHttpSessionBindingListenerextendsjava.util.EventListener

Causesanobjecttobenotifiedwhenitisboundtoorunboundfromasession.TheobjectisnotifiedbyanHttpSessionBindingEventobject.Thismaybeasaresultofaservletprogrammerexplicitlyunbindinganattributefromasession,duetoasessionbeinginvalidated,orduetoasessiontimingout.

SeeAlso:HttpSession,HttpSessionBindingEvent

MethodSummary

void

valueBound(HttpSessionBindingEventevent)Notifiestheobjectthatitisbeingboundtoasessionandidentifiesthesession.

void

valueUnbound(HttpSessionBindingEventevent)Notifiestheobjectthatitisbeingunboundfromasessionandidentifiesthesession.

MethodDetail

valueBound

publicvoidvalueBound(HttpSessionBindingEventevent)

Notifiestheobjectthatitisbeingboundtoasessionandidentifiesthesession.Parameters:

event-theeventthatidentifiesthesessionSeeAlso:

valueUnbound(javax.servlet.http.HttpSessionBindingEvent)

Page 212: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

valueUnbound

publicvoidvalueUnbound(HttpSessionBindingEventevent)

Notifiestheobjectthatitisbeingunboundfromasessionandidentifiesthesession.Parameters:

event-theeventthatidentifiesthesessionSeeAlso:

valueBound(javax.servlet.http.HttpSessionBindingEvent)

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 213: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 214: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpInterfaceHttpSessionContext

Deprecated.AsofJava(tm)ServletAPI2.1forsecurityreasons,withnoreplacement.ThisinterfacewillberemovedinafutureversionofthisAPI.

publicabstractinterfaceHttpSessionContext

SeeAlso:HttpSession,HttpSessionBindingEvent,HttpSessionBindingListener

MethodSummary

java.util.Enumeration

getIds()Deprecated.AsofJavaServletAPI2.1withnoreplacement.ThismethodmustreturnanemptyEnumerationandwillberemovedinafutureversionofthisAPI.

HttpSession

getSession(java.lang.StringsessionId)Deprecated.AsofJavaServletAPI2.1withnoreplacement.ThismethodmustreturnnullandwillberemovedinafutureversionofthisAPI.

MethodDetail

getSession

publicHttpSessiongetSession(java.lang.StringsessionId)

Deprecated.AsofJavaServletAPI2.1withnoreplacement.ThismethodmustreturnnullandwillberemovedinafutureversionofthisAPI.

getIds

Page 215: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicjava.util.EnumerationgetIds()

Deprecated.AsofJavaServletAPI2.1withnoreplacement.ThismethodmustreturnanemptyEnumerationandwillberemovedinafutureversionofthisAPI.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 216: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 217: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpClassHttpSessionEventjava.lang.Object

|

+--java.util.EventObject

|

+--javax.servlet.http.HttpSessionEvent

DirectKnownSubclasses:HttpSessionBindingEvent

publicclassHttpSessionEventextendsjava.util.EventObject

Thisistheclassrepresentingeventnotificationsforchangestosessionswithinawebapplication.

Since:v2.3

SeeAlso:SerializedForm

Fieldsinheritedfromclassjava.util.EventObjectsource

ConstructorSummaryHttpSessionEvent(HttpSessionsource)Constructasessioneventfromthegivensource.

MethodSummaryHttpSession

getSession()Returnthesessionthatchanged.

Methodsinheritedfromclassjava.util.EventObject

Page 218: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getSource,toString

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

wait,wait,wait

ConstructorDetail

HttpSessionEvent

publicHttpSessionEvent(HttpSessionsource)

Constructasessioneventfromthegivensource.

MethodDetail

getSession

publicHttpSessiongetSession()

Returnthesessionthatchanged.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 219: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 220: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpInterfaceHttpSessionListener

publicabstractinterfaceHttpSessionListenerextendsjava.util.EventListener

Implementationsofthisinterfacemayarenotifiedofchangestothelistofactivesessionsinawebapplication.Torecievenotificationevents,theimplementationclassmustbeconfiguredinthedeploymentdescriptorforthewebapplication.

Since:v2.3

SeeAlso:HttpSessionEvent

MethodSummaryvoid

sessionCreated(HttpSessionEventse)Notificationthatasessionwascreated.

voidsessionDestroyed(HttpSessionEventse)Notificationthatasessionwasinvalidated.

MethodDetail

sessionCreated

publicvoidsessionCreated(HttpSessionEventse)

Notificationthatasessionwascreated.Parameters:

se-thenotificationevent

sessionDestroyed

Page 221: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicvoidsessionDestroyed(HttpSessionEventse)

Notificationthatasessionwasinvalidated.Parameters:

se-thenotificationevent

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 222: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 223: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servlet.httpClassHttpUtilsjava.lang.Object

|

+--javax.servlet.http.HttpUtils

Deprecated.AsofJava(tm)ServletAPI2.3.Thesemethodswereonlyusefulwiththedefaultencodingandhavebeenmovedtotherequestinterfaces.

publicclassHttpUtilsextendsjava.lang.Object

ConstructorSummaryHttpUtils()Deprecated.ConstructsanemptyHttpUtilsobject.

MethodSummary

staticjava.lang.StringBuffer

getRequestURL(HttpServletRequestreq)Deprecated.ReconstructstheURLtheclientusedtomaketherequest,usinginformationintheHttpServletRequestobject.

staticjava.util.Hashtable

parsePostData(intlen,

ServletInputStreamin)Deprecated.ParsesdatafromanHTMLformthattheclientsendstotheserverusingtheHTTPPOSTmethodandtheapplication/x-www-form-urlencodedMIMEtype.

staticjava.util.Hashtable

parseQueryString(java.lang.Strings)Deprecated.ParsesaquerystringpassedfromtheclienttotheserverandbuildsaHashTableobjectwithkey-valuepairs.

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

Page 224: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

toString,wait,wait,wait

ConstructorDetail

HttpUtils

publicHttpUtils()

Deprecated.ConstructsanemptyHttpUtilsobject.

MethodDetail

parseQueryString

publicstaticjava.util.HashtableparseQueryString(java.lang.Strings)

Deprecated.ParsesaquerystringpassedfromtheclienttotheserverandbuildsaHashTableobjectwithkey-valuepairs.ThequerystringshouldbeintheformofastringpackagedbytheGETorPOSTmethod,thatis,itshouldhavekey-valuepairsintheformkey=value,witheachpairseparatedfromthenextbya&character.

Akeycanappearmorethanonceinthequerystringwithdifferentvalues.However,thekeyappearsonlyonceinthehashtable,withitsvaluebeinganarrayofstringscontainingthemultiplevaluessentbythequerystring.

Thekeysandvaluesinthehashtablearestoredintheirdecodedform,soany+charactersareconvertedtospaces,andcharacterssentinhexadecimalnotation(like%xx)areconvertedtoASCIIcharacters.

Parameters:s-astringcontainingthequerytobeparsed

Returns:aHashTableobjectbuiltfromtheparsedkey-valuepairs

Throws:

Page 225: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.lang.IllegalArgumentException-ifthequerystringisinvalid

parsePostData

publicstaticjava.util.HashtableparsePostData(intlen,

ServletInputStreamin)

Deprecated.ParsesdatafromanHTMLformthattheclientsendstotheserverusingtheHTTPPOSTmethodandtheapplication/x-www-form-urlencodedMIMEtype.

ThedatasentbythePOSTmethodcontainskey-valuepairs.AkeycanappearmorethanonceinthePOSTdatawithdifferentvalues.However,thekeyappearsonlyonceinthehashtable,withitsvaluebeinganarrayofstringscontainingthemultiplevaluessentbythePOSTmethod.

Thekeysandvaluesinthehashtablearestoredintheirdecodedform,soany+charactersareconvertedtospaces,andcharacterssentinhexadecimalnotation(like%xx)areconvertedtoASCIIcharacters.

Parameters:len-anintegerspecifyingthelength,incharacters,oftheServletInputStreamobjectthatisalsopassedtothismethodin-theServletInputStreamobjectthatcontainsthedatasentfromtheclient

Returns:aHashTableobjectbuiltfromtheparsedkey-valuepairs

Throws:java.lang.IllegalArgumentException-ifthedatasentbythePOSTmethodisinvalid

getRequestURL

publicstaticjava.lang.StringBuffergetRequestURL(HttpServletRequest

Deprecated.ReconstructstheURLtheclientusedtomaketherequest,using

Page 226: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

informationintheHttpServletRequestobject.ThereturnedURLcontainsaprotocol,servername,portnumber,andserverpath,butitdoesnotincludequerystringparameters.

BecausethismethodreturnsaStringBuffer,notastring,youcanmodifytheURLeasily,forexample,toappendqueryparameters.

Thismethodisusefulforcreatingredirectmessagesandforreportingerrors.

Parameters:req-aHttpServletRequestobjectcontainingtheclient'srequest

Returns:aStringBufferobjectcontainingthereconstructedURL

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 227: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 228: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceRequestDispatcher

publicabstractinterfaceRequestDispatcher

Definesanobjectthatreceivesrequestsfromtheclientandsendsthemtoanyresource(suchasaservlet,HTMLfile,orJSPfile)ontheserver.TheservletcontainercreatestheRequestDispatcherobject,whichisusedasawrapperaroundaserverresourcelocatedataparticularpathorgivenbyaparticularname.

Thisinterfaceisintendedtowrapservlets,butaservletcontainercancreateRequestDispatcherobjectstowrapanytypeofresource.

SeeAlso:ServletContext.getRequestDispatcher(java.lang.String),ServletContext.getNamedDispatcher(java.lang.String),ServletRequest.getRequestDispatcher(java.lang.String)

MethodSummary

void

forward(ServletRequestrequest,ServletResponseresponse)Forwardsarequestfromaservlettoanotherresource(servlet,JSPfile,orHTMLfile)ontheserver.

void

include(ServletRequestrequest,ServletResponseresponse)Includesthecontentofaresource(servlet,JSPpage,HTMLfile)intheresponse.

MethodDetail

forward

publicvoidforward(ServletRequestrequest,

ServletResponseresponse)

throwsServletException,

Page 229: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.io.IOException

Forwardsarequestfromaservlettoanotherresource(servlet,JSPfile,orHTMLfile)ontheserver.Thismethodallowsoneservlettodopreliminaryprocessingofarequestandanotherresourcetogeneratetheresponse.

ForaRequestDispatcherobtainedviagetRequestDispatcher(),theServletRequestobjecthasitspathelementsandparametersadjustedtomatchthepathofthetargetresource.

forwardshouldbecalledbeforetheresponsehasbeencommittedtotheclient(beforeresponsebodyoutputhasbeenflushed).Iftheresponsealreadyhasbeencommitted,thismethodthrowsanIllegalStateException.Uncommittedoutputintheresponsebufferisautomaticallyclearedbeforetheforward.

Therequestandresponseparametersmustbeeitherthesameobjectsaswerepassedtothecallingservlet'sservicemethodorbesubclassesoftheServletRequestWrapperorServletResponseWrapperclassesthatwrapthem.

Parameters:request-aServletRequestobjectthatrepresentstherequesttheclientmakesoftheservletresponse-aServletResponseobjectthatrepresentstheresponsetheservletreturnstotheclient

Throws:ServletException-ifthetargetresourcethrowsthisexceptionjava.io.IOException-ifthetargetresourcethrowsthisexceptionIllegalStateException-iftheresponsewasalreadycommitted

include

publicvoidinclude(ServletRequestrequest,

ServletResponseresponse)

throwsServletException,

java.io.IOException

Includesthecontentofaresource(servlet,JSPpage,HTMLfile)inthe

Page 230: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

response.Inessence,thismethodenablesprogrammaticserver-sideincludes.

TheServletResponseobjecthasitspathelementsandparametersremainunchangedfromthecaller's.Theincludedservletcannotchangetheresponsestatuscodeorsetheaders;anyattempttomakeachangeisignored.

Therequestandresponseparametersmustbeeitherthesameobjectsaswerepassedtothecallingservlet'sservicemethodorbesubclassesoftheServletRequestWrapperorServletResponseWrapperclassesthatwrapthem.

Parameters:request-aServletRequestobjectthatcontainstheclient'srequestresponse-aServletResponseobjectthatcontainstheservlet'sresponse

Throws:ServletException-iftheincludedresourcethrowsthisexceptionjava.io.IOException-iftheincludedresourcethrowsthisexception

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 231: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 232: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceServlet

AllKnownImplementingClasses:GenericServlet

publicabstractinterfaceServlet

Definesmethodsthatallservletsmustimplement.

AservletisasmallJavaprogramthatrunswithinaWebserver.ServletsreceiveandrespondtorequestsfromWebclients,usuallyacrossHTTP,theHyperTextTransferProtocol.

Toimplementthisinterface,youcanwriteagenericservletthatextendsjavax.servlet.GenericServletoranHTTPservletthatextendsjavax.servlet.http.HttpServlet.

Thisinterfacedefinesmethodstoinitializeaservlet,toservicerequests,andtoremoveaservletfromtheserver.Theseareknownaslife-cyclemethodsandarecalledinthefollowingsequence:

1. Theservletisconstructed,theninitializedwiththeinitmethod.2. Anycallsfromclientstotheservicemethodarehandled.3. Theservletistakenoutofservice,thendestroyedwiththedestroymethod,

thengarbagecollectedandfinalized.

Inadditiontothelife-cyclemethods,thisinterfaceprovidesthegetServletConfigmethod,whichtheservletcanusetogetanystartupinformation,andthegetServletInfomethod,whichallowstheservlettoreturnbasicinformationaboutitself,suchasauthor,version,andcopyright.

SeeAlso:GenericServlet,HttpServlet

MethodSummary

Page 233: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

voiddestroy()Calledbytheservletcontainertoindicatetoaservletthattheservletisbeingtakenoutofservice.

ServletConfig

getServletConfig()ReturnsaServletConfigobject,whichcontainsinitializationandstartupparametersforthisservlet.

java.lang.String

getServletInfo()Returnsinformationabouttheservlet,suchasauthor,version,andcopyright.

void

init(ServletConfigconfig)Calledbytheservletcontainertoindicatetoaservletthattheservletisbeingplacedintoservice.

void

service(ServletRequestreq,ServletResponseres)Calledbytheservletcontainertoallowtheservlettorespondtoarequest.

MethodDetail

init

publicvoidinit(ServletConfigconfig)

throwsServletException

Calledbytheservletcontainertoindicatetoaservletthattheservletisbeingplacedintoservice.

Theservletcontainercallstheinitmethodexactlyonceafterinstantiatingtheservlet.Theinitmethodmustcompletesuccessfullybeforetheservletcanreceiveanyrequests.

Theservletcontainercannotplacetheservletintoserviceiftheinitmethod

1. ThrowsaServletException2. DoesnotreturnwithinatimeperioddefinedbytheWebserver

Parameters:

Page 234: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

config-aServletConfigobjectcontainingtheservlet'sconfigurationandinitializationparameters

Throws:ServletException-ifanexceptionhasoccurredthatinterfereswiththeservlet'snormaloperation

SeeAlso:UnavailableException,getServletConfig()

getServletConfig

publicServletConfiggetServletConfig()

ReturnsaServletConfigobject,whichcontainsinitializationandstartupparametersforthisservlet.TheServletConfigobjectreturnedistheonepassedtotheinitmethod.

ImplementationsofthisinterfaceareresponsibleforstoringtheServletConfigobjectsothatthismethodcanreturnit.TheGenericServletclass,whichimplementsthisinterface,alreadydoesthis.

Returns:theServletConfigobjectthatinitializesthisservlet

SeeAlso:init(javax.servlet.ServletConfig)

service

publicvoidservice(ServletRequestreq,

ServletResponseres)

throwsServletException,

java.io.IOException

Calledbytheservletcontainertoallowtheservlettorespondtoarequest.

Thismethodisonlycalledaftertheservlet'sinit()methodhascompletedsuccessfully.

Thestatuscodeoftheresponsealwaysshouldbesetforaservletthat

Page 235: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

throwsorsendsanerror.

Servletstypicallyruninsidemultithreadedservletcontainersthatcanhandlemultiplerequestsconcurrently.Developersmustbeawaretosynchronizeaccesstoanysharedresourcessuchasfiles,networkconnections,andaswellastheservlet'sclassandinstancevariables.MoreinformationonmultithreadedprogramminginJavaisavailableintheJavatutorialonmulti-threadedprogramming.

Parameters:req-theServletRequestobjectthatcontainstheclient'srequestres-theServletResponseobjectthatcontainstheservlet'sresponse

Throws:ServletException-ifanexceptionoccursthatinterfereswiththeservlet'snormaloperationjava.io.IOException-ifaninputoroutputexceptionoccurs

getServletInfo

publicjava.lang.StringgetServletInfo()

Returnsinformationabouttheservlet,suchasauthor,version,andcopyright.

Thestringthatthismethodreturnsshouldbeplaintextandnotmarkupofanykind(suchasHTML,XML,etc.).

Returns:aStringcontainingservletinformation

destroy

publicvoiddestroy()

Calledbytheservletcontainertoindicatetoaservletthattheservletisbeingtakenoutofservice.Thismethodisonlycalledonceallthreadswithintheservlet'sservicemethodhaveexitedorafteratimeoutperiodhaspassed.Aftertheservletcontainercallsthismethod,itwillnotcallthe

Page 236: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

servicemethodagainonthisservlet.

Thismethodgivestheservletanopportunitytocleanupanyresourcesthatarebeingheld(forexample,memory,filehandles,threads)andmakesurethatanypersistentstateissynchronizedwiththeservlet'scurrentstateinmemory.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 237: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 238: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceServletConfig

AllKnownImplementingClasses:GenericServlet

publicabstractinterfaceServletConfig

Aservletconfigurationobjectusedbyaservletcontainerusedtopassinformationtoaservletduringinitialization.

MethodSummary

java.lang.String

getInitParameter(java.lang.Stringname)ReturnsaStringcontainingthevalueofthenamedinitializationparameter,ornulliftheparameterdoesnotexist.

java.util.Enumeration

getInitParameterNames()Returnsthenamesoftheservlet'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationiftheservlethasnoinitializationparameters.

ServletContext

getServletContext()ReturnsareferencetotheServletContextinwhichthecallerisexecuting.

java.lang.StringgetServletName()Returnsthenameofthisservletinstance.

MethodDetail

getServletName

publicjava.lang.StringgetServletName()

Page 239: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Returnsthenameofthisservletinstance.Thenamemaybeprovidedviaserveradministration,assignedinthewebapplicationdeploymentdescriptor,orforanunregistered(andthusunnamed)servletinstanceitwillbetheservlet'sclassname.Returns:

thenameoftheservletinstance

getServletContext

publicServletContextgetServletContext()

ReturnsareferencetotheServletContextinwhichthecallerisexecuting.Returns:

aServletContextobject,usedbythecallertointeractwithitsservletcontainer

SeeAlso:ServletContext

getInitParameter

publicjava.lang.StringgetInitParameter(java.lang.Stringname)

ReturnsaStringcontainingthevalueofthenamedinitializationparameter,ornulliftheparameterdoesnotexist.Parameters:

name-aStringspecifyingthenameoftheinitializationparameterReturns:

aStringcontainingthevalueoftheinitializationparameter

getInitParameterNames

publicjava.util.EnumerationgetInitParameterNames()

Returnsthenamesoftheservlet'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationiftheservlethasnoinitializationparameters.

Page 240: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Returns:anEnumerationofStringobjectscontainingthenamesoftheservlet'sinitializationparameters

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 241: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 242: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceServletContext

publicabstractinterfaceServletContext

Definesasetofmethodsthataservletusestocommunicatewithitsservletcontainer,forexample,togettheMIMEtypeofafile,dispatchrequests,orwritetoalogfile.

Thereisonecontextper"webapplication"perJavaVirtualMachine.(A"webapplication"isacollectionofservletsandcontentinstalledunderaspecificsubsetoftheserver'sURLnamespacesuchas/catalogandpossiblyinstalledviaa.warfile.)

Inthecaseofawebapplicationmarked"distributed"initsdeploymentdescriptor,therewillbeonecontextinstanceforeachvirtualmachine.Inthissituation,thecontextcannotbeusedasalocationtoshareglobalinformation(becausetheinformationwon'tbetrulyglobal).Useanexternalresourcelikeadatabaseinstead.

TheServletContextobjectiscontainedwithintheServletConfigobject,whichtheWebserverprovidestheservletwhentheservletisinitialized.

SeeAlso:Servlet.getServletConfig(),ServletConfig.getServletContext()

MethodSummary

java.lang.Object

getAttribute(java.lang.Stringname)Returnstheservletcontainerattributewiththegivenname,ornullifthereisnoattributebythatname.

java.util.Enumeration

getAttributeNames()ReturnsanEnumerationcontainingtheattributenamesavailablewithinthisservletcontext.

ServletContext

getContext(java.lang.Stringuripath)ReturnsaServletContextobjectthatcorresponds

Page 243: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

toaspecifiedURLontheserver.

java.lang.String

getInitParameter(java.lang.Stringname)ReturnsaStringcontainingthevalueofthenamedcontext-wideinitializationparameter,ornulliftheparameterdoesnotexist.

java.util.Enumeration

getInitParameterNames()Returnsthenamesofthecontext'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationifthecontexthasnoinitializationparameters.

int

getMajorVersion()ReturnsthemajorversionoftheJavaServletAPIthatthisservletcontainersupports.

java.lang.String

getMimeType(java.lang.Stringfile)ReturnstheMIMEtypeofthespecifiedfile,ornulliftheMIMEtypeisnotknown.

int

getMinorVersion()ReturnstheminorversionoftheServletAPIthatthisservletcontainersupports.

RequestDispatcher

getNamedDispatcher(java.lang.Stringname)ReturnsaRequestDispatcherobjectthatactsasawrapperforthenamedservlet.

java.lang.String

getRealPath(java.lang.Stringpath)ReturnsaStringcontainingtherealpathforagivenvirtualpath.

RequestDispatcher

getRequestDispatcher(java.lang.Stringpath)ReturnsaRequestDispatcherobjectthatactsasawrapperfortheresourcelocatedatthegivenpath.

java.net.URL

getResource(java.lang.Stringpath)ReturnsaURLtotheresourcethatismappedtoaspecifiedpath.

java.io.InputStream

getResourceAsStream(java.lang.Stringpath)ReturnstheresourcelocatedatthenamedpathasanInputStreamobject.getResourcePaths(java.lang.Stringpath)Returnsadirectory-likelistingofallthepathsto

Page 244: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.util.Set resourceswithinthewebapplicationwhoselongestsub-pathmatchesthesuppliedpathargument.

java.lang.String

getServerInfo()Returnsthenameandversionoftheservletcontaineronwhichtheservletisrunning.

Servlet

getServlet(java.lang.Stringname)Deprecated.AsofJavaServletAPI2.1,withnodirectreplacement.

ThismethodwasoriginallydefinedtoretrieveaservletfromaServletContext.Inthisversion,thismethodalwaysreturnsnullandremainsonlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

Inlieuofthismethod,servletscanshareinformationusingtheServletContextclassandcanperformsharedbusinesslogicbyinvokingmethodsoncommonnon-servletclasses.

java.lang.String

getServletContextName()ReturnsthenameofthiswebapplicationcorrepondingtothisServletContextasspecifiedinthedeploymentdescriptorforthiswebapplicationbythedisplay-nameelement.

java.util.Enumeration

getServletNames()Deprecated.AsofJavaServletAPI2.1,withnoreplacement.

ThismethodwasoriginallydefinedtoreturnanEnumerationofalltheservletnamesknowntothiscontext.Inthisversion,thismethodalwaysreturnsanemptyEnumerationandremainsonlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

getServlets()Deprecated.AsofJavaServletAPI2.0,withnoreplacement.

Page 245: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.util.Enumeration

ThismethodwasoriginallydefinedtoreturnanEnumerationofalltheservletsknowntothisservletcontext.Inthisversion,thismethodalwaysreturnsanemptyenumerationandremainsonlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

void

log(java.lang.Exceptionexception,

java.lang.Stringmsg)Deprecated.AsofJavaServletAPI2.1,uselog(Stringmessage,Throwablethrowable)instead.

Thismethodwasoriginallydefinedtowriteanexception'sstacktraceandanexplanatoryerrormessagetotheservletlogfile.

void

log(java.lang.Stringmsg)Writesthespecifiedmessagetoaservletlogfile,usuallyaneventlog.

void

log(java.lang.Stringmessage,

java.lang.Throwablethrowable)WritesanexplanatorymessageandastacktraceforagivenThrowableexceptiontotheservletlogfile.

void

removeAttribute(java.lang.Stringname)Removestheattributewiththegivennamefromtheservletcontext.

void

setAttribute(java.lang.Stringname,

java.lang.Objectobject)Bindsanobjecttoagivenattributenameinthisservletcontext.

MethodDetail

getContext

publicServletContextgetContext(java.lang.Stringuripath)

Page 246: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ReturnsaServletContextobjectthatcorrespondstoaspecifiedURLontheserver.

Thismethodallowsservletstogainaccesstothecontextforvariouspartsoftheserver,andasneededobtainRequestDispatcherobjectsfromthecontext.Thegivenpathmustbebeginwith"/",isinterpretedrelativetotheserver'sdocumentrootandismatchedagainstthecontextrootsofotherwebapplicationshostedonthiscontainer.

Inasecurityconsciousenvironment,theservletcontainermayreturnnullforagivenURL.

Parameters:uripath-aStringspecifyingthecontextpathofanotherwebapplicationinthecontainer.

Returns:theServletContextobjectthatcorrespondstothenamedURL,ornullifeithernoneexistsorthecontainerwishestorestrictthisaccess.

SeeAlso:RequestDispatcher

getMajorVersion

publicintgetMajorVersion()

ReturnsthemajorversionoftheJavaServletAPIthatthisservletcontainersupports.AllimplementationsthatcomplywithVersion2.3musthavethismethodreturntheinteger2.Returns:

2

getMinorVersion

publicintgetMinorVersion()

ReturnstheminorversionoftheServletAPIthatthisservletcontainersupports.AllimplementationsthatcomplywithVersion2.3musthavethismethodreturntheinteger3.

Page 247: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Returns:3

getMimeType

publicjava.lang.StringgetMimeType(java.lang.Stringfile)

ReturnstheMIMEtypeofthespecifiedfile,ornulliftheMIMEtypeisnotknown.TheMIMEtypeisdeterminedbytheconfigurationoftheservletcontainer,andmaybespecifiedinawebapplicationdeploymentdescriptor.CommonMIMEtypesare"text/html"and"image/gif".Parameters:

file-aStringspecifyingthenameofafileReturns:

aStringspecifyingthefile'sMIMEtype

getResourcePaths

publicjava.util.SetgetResourcePaths(java.lang.Stringpath)

Returnsadirectory-likelistingofallthepathstoresourceswithinthewebapplicationwhoselongestsub-pathmatchesthesuppliedpathargument.Pathsindicatingsubdirectorypathsendwitha'/'.Thereturnedpathsareallrelativetotherootofthewebapplicationandhavealeading'/'.Forexample,forawebapplicationcontaining

/welcome.html/catalog/index.html/catalog/products.html/catalog/offers/books.html/catalog/offers/music.html/customer/login.jsp/WEB-INF/web.xml/WEB-INF/classes/com.acme.OrderServlet.class,

getResourcePaths("/")returns{"/welcome.html","/catalog/","/customer/","/WEB-INF/"}

Page 248: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getResourcePaths("/catalog/")returns{"/catalog/index.html","/catalog/products.html","/catalog/offers/"}.Parameters:

the-partialpathusedtomatchtheresources,whichmuststartwitha/Returns:

aSetcontainingthedirectorylisting,ornulliftherearenoresourcesinthewebapplicationwhosepathbeginswiththesuppliedpath.

Since:Servlet2.3

getResource

publicjava.net.URLgetResource(java.lang.Stringpath)

throwsjava.net.MalformedURLException

ReturnsaURLtotheresourcethatismappedtoaspecifiedpath.Thepathmustbeginwitha"/"andisinterpretedasrelativetothecurrentcontextroot.

Thismethodallowstheservletcontainertomakearesourceavailabletoservletsfromanysource.Resourcescanbelocatedonalocalorremotefilesystem,inadatabase,orina.warfile.

TheservletcontainermustimplementtheURLhandlersandURLConnectionobjectsthatarenecessarytoaccesstheresource.

Thismethodreturnsnullifnoresourceismappedtothepathname.

SomecontainersmayallowwritingtotheURLreturnedbythismethodusingthemethodsoftheURLclass.

Theresourcecontentisreturneddirectly,sobeawarethatrequestinga.jsppagereturnstheJSPsourcecode.UseaRequestDispatcherinsteadtoincluderesultsofanexecution.

Thismethodhasadifferentpurposethanjava.lang.Class.getResource,whichlooksupresourcesbasedonaclassloader.Thismethoddoesnotuseclassloaders.

Page 249: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Parameters:path-aStringspecifyingthepathtotheresource

Returns:theresourcelocatedatthenamedpath,ornullifthereisnoresourceatthatpath

Throws:java.net.MalformedURLException-ifthepathnameisnotgiveninthecorrectform

getResourceAsStream

publicjava.io.InputStreamgetResourceAsStream(java.lang.Stringpath)

ReturnstheresourcelocatedatthenamedpathasanInputStreamobject.

ThedataintheInputStreamcanbeofanytypeorlength.ThepathmustbespecifiedaccordingtotherulesgiveningetResource.Thismethodreturnsnullifnoresourceexistsatthespecifiedpath.

Meta-informationsuchascontentlengthandcontenttypethatisavailableviagetResourcemethodislostwhenusingthismethod.

TheservletcontainermustimplementtheURLhandlersandURLConnectionobjectsnecessarytoaccesstheresource.

Thismethodisdifferentfromjava.lang.Class.getResourceAsStream,whichusesaclassloader.Thismethodallowsservletcontainerstomakearesourceavailabletoaservletfromanylocation,withoutusingaclassloader.

Parameters:name-aStringspecifyingthepathtotheresource

Returns:theInputStreamreturnedtotheservlet,ornullifnoresourceexistsatthespecifiedpath

getRequestDispatcher

Page 250: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicRequestDispatchergetRequestDispatcher(java.lang.Stringpath)

ReturnsaRequestDispatcherobjectthatactsasawrapperfortheresourcelocatedatthegivenpath.ARequestDispatcherobjectcanbeusedtoforwardarequesttotheresourceortoincludetheresourceinaresponse.Theresourcecanbedynamicorstatic.

Thepathnamemustbeginwitha"/"andisinterpretedasrelativetothecurrentcontextroot.UsegetContexttoobtainaRequestDispatcherforresourcesinforeigncontexts.ThismethodreturnsnulliftheServletContextcannotreturnaRequestDispatcher.

Parameters:path-aStringspecifyingthepathnametotheresource

Returns:aRequestDispatcherobjectthatactsasawrapperfortheresourceatthespecifiedpath

SeeAlso:RequestDispatcher,getContext(java.lang.String)

getNamedDispatcher

publicRequestDispatchergetNamedDispatcher(java.lang.Stringname)

ReturnsaRequestDispatcherobjectthatactsasawrapperforthenamedservlet.

Servlets(andJSPpagesalso)maybegivennamesviaserveradministrationorviaawebapplicationdeploymentdescriptor.AservletinstancecandetermineitsnameusingServletConfig.getServletName().

ThismethodreturnsnulliftheServletContextcannotreturnaRequestDispatcherforanyreason.

Parameters:name-aStringspecifyingthenameofaservlettowrap

Returns:aRequestDispatcherobjectthatactsasawrapperforthenamedservlet

Page 251: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

SeeAlso:RequestDispatcher,getContext(java.lang.String),ServletConfig.getServletName()

getServlet

publicServletgetServlet(java.lang.Stringname)

throwsServletException

Deprecated.AsofJavaServletAPI2.1,withnodirectreplacement.

ThismethodwasoriginallydefinedtoretrieveaservletfromaServletContext.Inthisversion,thismethodalwaysreturnsnullandremainsonlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

Inlieuofthismethod,servletscanshareinformationusingtheServletContextclassandcanperformsharedbusinesslogicbyinvokingmethodsoncommonnon-servletclasses.

getServlets

publicjava.util.EnumerationgetServlets()

Deprecated.AsofJavaServletAPI2.0,withnoreplacement.

ThismethodwasoriginallydefinedtoreturnanEnumerationofalltheservletsknowntothisservletcontext.Inthisversion,thismethodalwaysreturnsanemptyenumerationandremainsonlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

getServletNames

publicjava.util.EnumerationgetServletNames()

Deprecated.AsofJavaServletAPI2.1,withnoreplacement.

Page 252: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThismethodwasoriginallydefinedtoreturnanEnumerationofalltheservletnamesknowntothiscontext.Inthisversion,thismethodalwaysreturnsanemptyEnumerationandremainsonlytopreservebinarycompatibility.ThismethodwillbepermanentlyremovedinafutureversionoftheJavaServletAPI.

log

publicvoidlog(java.lang.Stringmsg)

Writesthespecifiedmessagetoaservletlogfile,usuallyaneventlog.Thenameandtypeoftheservletlogfileisspecifictotheservletcontainer.Parameters:

msg-aStringspecifyingthemessagetobewrittentothelogfile

log

publicvoidlog(java.lang.Exceptionexception,

java.lang.Stringmsg)

Deprecated.AsofJavaServletAPI2.1,uselog(Stringmessage,Throwablethrowable)instead.

Thismethodwasoriginallydefinedtowriteanexception'sstacktraceandanexplanatoryerrormessagetotheservletlogfile.

log

publicvoidlog(java.lang.Stringmessage,

java.lang.Throwablethrowable)

WritesanexplanatorymessageandastacktraceforagivenThrowableexceptiontotheservletlogfile.Thenameandtypeoftheservletlogfileisspecifictotheservletcontainer,usuallyaneventlog.Parameters:

message-aStringthatdescribestheerrororexceptionthrowable-theThrowableerrororexception

Page 253: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getRealPath

publicjava.lang.StringgetRealPath(java.lang.Stringpath)

ReturnsaStringcontainingtherealpathforagivenvirtualpath.Forexample,thepath"/index.html"returnstheabsolutefilepathontheserver'sfilesystemwouldbeservedbyarequestfor"http://host/contextPath/index.html",wherecontextPathisthecontextpathofthisServletContext..

Therealpathreturnedwillbeinaformappropriatetothecomputerandoperatingsystemonwhichtheservletcontainerisrunning,includingtheproperpathseparators.Thismethodreturnsnulliftheservletcontainercannottranslatethevirtualpathtoarealpathforanyreason(suchaswhenthecontentisbeingmadeavailablefroma.wararchive).

Parameters:path-aStringspecifyingavirtualpath

Returns:aStringspecifyingtherealpath,ornullifthetranslationcannotbeperformed

getServerInfo

publicjava.lang.StringgetServerInfo()

Returnsthenameandversionoftheservletcontaineronwhichtheservletisrunning.

Theformofthereturnedstringisservername/versionnumber.Forexample,theJavaServerWebDevelopmentKitmayreturnthestringJavaServerWebDevKit/1.0.

Theservletcontainermayreturnotheroptionalinformationaftertheprimarystringinparentheses,forexample,JavaServerWebDevKit/1.0(JDK1.1.6;WindowsNT4.0x86).

Returns:

Page 254: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

aStringcontainingatleasttheservletcontainernameandversionnumber

getInitParameter

publicjava.lang.StringgetInitParameter(java.lang.Stringname)

ReturnsaStringcontainingthevalueofthenamedcontext-wideinitializationparameter,ornulliftheparameterdoesnotexist.

Thismethodcanmakeavailableconfigurationinformationusefultoanentire"webapplication".Forexample,itcanprovideawebmaster'semailaddressorthenameofasystemthatholdscriticaldata.

Parameters:name-aStringcontainingthenameoftheparameterwhosevalueisrequested

Returns:aStringcontainingatleasttheservletcontainernameandversionnumber

SeeAlso:ServletConfig.getInitParameter(java.lang.String)

getInitParameterNames

publicjava.util.EnumerationgetInitParameterNames()

Returnsthenamesofthecontext'sinitializationparametersasanEnumerationofStringobjects,oranemptyEnumerationifthecontexthasnoinitializationparameters.Returns:

anEnumerationofStringobjectscontainingthenamesofthecontext'sinitializationparameters

SeeAlso:ServletConfig.getInitParameter(java.lang.String)

Page 255: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getAttribute

publicjava.lang.ObjectgetAttribute(java.lang.Stringname)

Returnstheservletcontainerattributewiththegivenname,ornullifthereisnoattributebythatname.Anattributeallowsaservletcontainertogivetheservletadditionalinformationnotalreadyprovidedbythisinterface.Seeyourserverdocumentationforinformationaboutitsattributes.AlistofsupportedattributescanberetrievedusinggetAttributeNames.

Theattributeisreturnedasajava.lang.Objectorsomesubclass.Attributenamesshouldfollowthesameconventionaspackagenames.TheJavaServletAPIspecificationreservesnamesmatchingjava.*,javax.*,andsun.*.

Parameters:name-aStringspecifyingthenameoftheattribute

Returns:anObjectcontainingthevalueoftheattribute,ornullifnoattributeexistsmatchingthegivenname

SeeAlso:getAttributeNames()

getAttributeNames

publicjava.util.EnumerationgetAttributeNames()

ReturnsanEnumerationcontainingtheattributenamesavailablewithinthisservletcontext.UsethegetAttribute(java.lang.String)methodwithanattributenametogetthevalueofanattribute.Returns:

anEnumerationofattributenamesSeeAlso:

getAttribute(java.lang.String)

setAttribute

publicvoidsetAttribute(java.lang.Stringname,

Page 256: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.lang.Objectobject)

Bindsanobjecttoagivenattributenameinthisservletcontext.Ifthenamespecifiedisalreadyusedforanattribute,thismethodwillreplacetheattributewiththenewtothenewattribute.

IflistenersareconfiguredontheServletContextthecontainernotifiesthemaccordingly.

Ifanullvalueispassed,theeffectisthesameascallingremoveAttribute().

Attributenamesshouldfollowthesameconventionaspackagenames.TheJavaServletAPIspecificationreservesnamesmatchingjava.*,javax.*,andsun.*.

Parameters:name-aStringspecifyingthenameoftheattributeobject-anObjectrepresentingtheattributetobebound

removeAttribute

publicvoidremoveAttribute(java.lang.Stringname)

Removestheattributewiththegivennamefromtheservletcontext.Afterremoval,subsequentcallstogetAttribute(java.lang.String)toretrievetheattribute'svaluewillreturnnull.

IflistenersareconfiguredontheServletContextthecontainernotifiesthemaccordingly.

Parameters:name-aStringspecifyingthenameoftheattributetoberemoved

getServletContextName

publicjava.lang.StringgetServletContextName()

Page 257: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ReturnsthenameofthiswebapplicationcorrepondingtothisServletContextasspecifiedinthedeploymentdescriptorforthiswebapplicationbythedisplay-nameelement.Returns:

Thenameofthewebapplicationornullifnonamehasbeendeclaredinthedeploymentdescriptor.

Since:Servlet2.3

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 258: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 259: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletClassServletContextAttributeEventjava.lang.Object

|

+--java.util.EventObject

|

+--javax.servlet.ServletContextEvent

|

+--javax.servlet.ServletContextAttributeEvent

publicclassServletContextAttributeEventextendsServletContextEvent

Thisistheeventclassfornotificationsaboutchangestotheattributesoftheservletcontextofawebapplication.

Since:v2.3

SeeAlso:ServletContextAttributeListener,SerializedForm

Fieldsinheritedfromclassjava.util.EventObjectsource

ConstructorSummaryServletContextAttributeEvent(ServletContextsource,

java.lang.Stringname,java.lang.Objectvalue)ConstructaServletContextAttributeEventfromthegivencontextforthegivenattributenameandattributevalue.

MethodSummary

java.lang.String

getName()ReturnthenameoftheattributethatchangedontheServletContext.getValue()

Page 260: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.lang.Object Returnsthevalueoftheattributethathasbeenaddedremovedorreplaced.

Methodsinheritedfromclassjavax.servlet.ServletContextEventgetServletContext

Methodsinheritedfromclassjava.util.EventObjectgetSource,toString

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

wait,wait,wait

ConstructorDetail

ServletContextAttributeEvent

publicServletContextAttributeEvent(ServletContextsource,

java.lang.Stringname,

java.lang.Objectvalue)

ConstructaServletContextAttributeEventfromthegivencontextforthegivenattributenameandattributevalue.

MethodDetail

getName

publicjava.lang.StringgetName()

ReturnthenameoftheattributethatchangedontheServletContext.

getValue

publicjava.lang.ObjectgetValue()

Page 261: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Returnsthevalueoftheattributethathasbeenaddedremovedorreplaced.Iftheattributewasadded,thisisthevalueoftheattribute.Iftheattrubutewasremoved,thisisthevalueoftheremovedattribute.Iftheattributewasreplaced,thisistheoldvalueoftheattribute.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 262: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 263: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceServletContextAttributeListener

publicabstractinterfaceServletContextAttributeListenerextendsjava.util.EventListener

Implementationsofthisinterfacerecievenotificationsofchangestotheattributelistontheservletcontextofawebapplication.Torecievenotificationevents,theimplementationclassmustbeconfiguredinthedeploymentdescriptorforthewebapplication.

Since:v2.3

SeeAlso:ServletContextAttributeEvent

MethodSummaryvoid

attributeAdded(ServletContextAttributeEventscab)Notificationthatanewattributewasaddedtotheservletcontext.

void

attributeRemoved(ServletContextAttributeEventscab)Notificationthatanexistingattributehasbeenremvedfromtheservletcontext.

void

attributeReplaced(ServletContextAttributeEventscab)Notificationthatanattributeontheservletcontexthasbeenreplaced.

MethodDetail

attributeAdded

publicvoidattributeAdded(ServletContextAttributeEventscab)

Notificationthatanewattributewasaddedtotheservletcontext.Called

Page 264: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

aftertheattributeisadded.

attributeRemoved

publicvoidattributeRemoved(ServletContextAttributeEventscab)

Notificationthatanexistingattributehasbeenremvedfromtheservletcontext.Calledaftertheattributeisremoved.

attributeReplaced

publicvoidattributeReplaced(ServletContextAttributeEventscab)

Notificationthatanattributeontheservletcontexthasbeenreplaced.Calledaftertheattributeisreplaced.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 265: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 266: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletClassServletContextEventjava.lang.Object

|

+--java.util.EventObject

|

+--javax.servlet.ServletContextEvent

DirectKnownSubclasses:ServletContextAttributeEvent

publicclassServletContextEventextendsjava.util.EventObject

Thisistheeventclassfornotificationsaboutchangestotheservletcontextofawebapplication.

Since:v2.3

SeeAlso:ServletContextListener,SerializedForm

Fieldsinheritedfromclassjava.util.EventObjectsource

ConstructorSummaryServletContextEvent(ServletContextsource)ConstructaServletContextEventfromthegivencontext.

MethodSummaryServletContext

getServletContext()ReturntheServletContextthatchanged.

Methodsinheritedfromclassjava.util.EventObject

Page 267: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getSource,toString

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

wait,wait,wait

ConstructorDetail

ServletContextEvent

publicServletContextEvent(ServletContextsource)

ConstructaServletContextEventfromthegivencontext.Parameters:

source--theServletContextthatissendingtheevent.

MethodDetail

getServletContext

publicServletContextgetServletContext()

ReturntheServletContextthatchanged.Returns:

theServletContextthatsenttheevent.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 268: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 269: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceServletContextListener

publicabstractinterfaceServletContextListenerextendsjava.util.EventListener

Implementationsofthisinterfacerecievenotificationsaboutchangestotheservletcontextofthewebapplicationtheyarepartof.Torecievenotificationevents,theimplementationclassmustbeconfiguredinthedeploymentdescriptorforthewebapplication.

Since:v2.3

SeeAlso:ServletContextEvent

MethodSummaryvoid

contextDestroyed(ServletContextEventsce)Notificationthattheservletcontextisabouttobeshutdown.

voidcontextInitialized(ServletContextEventsce)Notificationthatthewebapplicationisreadytoprocessrequests.

MethodDetail

contextInitialized

publicvoidcontextInitialized(ServletContextEventsce)

Notificationthatthewebapplicationisreadytoprocessrequests.

contextDestroyed

publicvoidcontextDestroyed(ServletContextEventsce)

Page 270: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Notificationthattheservletcontextisabouttobeshutdown.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 271: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 272: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletClassServletExceptionjava.lang.Object

|

+--java.lang.Throwable

|

+--java.lang.Exception

|

+--javax.servlet.ServletException

DirectKnownSubclasses:UnavailableException

publicclassServletExceptionextendsjava.lang.Exception

Definesageneralexceptionaservletcanthrowwhenitencountersdifficulty.

SeeAlso:SerializedForm

ConstructorSummaryServletException()Constructsanewservletexception.ServletException(java.lang.Stringmessage)Constructsanewservletexceptionwiththespecifiedmessage.ServletException(java.lang.Stringmessage,

java.lang.ThrowablerootCause)Constructsanewservletexceptionwhentheservletneedstothrowanexceptionandincludeamessageaboutthe"rootcause"exceptionthatinterferedwithitsnormaloperation,includingadescriptionmessage.ServletException(java.lang.ThrowablerootCause)Constructsanewservletexceptionwhentheservletneedstothrowanexceptionandincludeamessageaboutthe"rootcause"exceptionthatinterferedwithitsnormaloperation.

Page 273: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

MethodSummary

java.lang.Throwable

getRootCause()Returnstheexceptionthatcausedthisservletexception.

Methodsinheritedfromclassjava.lang.ThrowablefillInStackTrace,getLocalizedMessage,getMessage,

printStackTrace,printStackTrace,printStackTrace,toString

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

wait,wait,wait

ConstructorDetail

ServletException

publicServletException()

Constructsanewservletexception.

ServletException

publicServletException(java.lang.Stringmessage)

Constructsanewservletexceptionwiththespecifiedmessage.Themessagecanbewrittentotheserverlogand/ordisplayedfortheuser.Parameters:

message-aStringspecifyingthetextoftheexceptionmessage

ServletException

publicServletException(java.lang.Stringmessage,

java.lang.ThrowablerootCause)

Page 274: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Constructsanewservletexceptionwhentheservletneedstothrowanexceptionandincludeamessageaboutthe"rootcause"exceptionthatinterferedwithitsnormaloperation,includingadescriptionmessage.Parameters:

message-aStringcontainingthetextoftheexceptionmessagerootCause-theThrowableexceptionthatinterferedwiththeservlet'snormaloperation,makingthisservletexceptionnecessary

ServletException

publicServletException(java.lang.ThrowablerootCause)

Constructsanewservletexceptionwhentheservletneedstothrowanexceptionandincludeamessageaboutthe"rootcause"exceptionthatinterferedwithitsnormaloperation.Theexception'smessageisbasedonthelocalizedmessageoftheunderlyingexception.

ThismethodcallsthegetLocalizedMessagemethodontheThrowableexceptiontogetalocalizedexceptionmessage.WhensubclassingServletException,thismethodcanbeoverriddentocreateanexceptionmessagedesignedforaspecificlocale.

Parameters:rootCause-theThrowableexceptionthatinterferedwiththeservlet'snormaloperation,makingtheservletexceptionnecessary

MethodDetail

getRootCause

publicjava.lang.ThrowablegetRootCause()

Returnstheexceptionthatcausedthisservletexception.Returns:

theThrowablethatcausedthisservletexception

Overview Package Class Tree Deprecated IndexHelp

Page 275: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

PREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 276: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 277: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletClassServletInputStreamjava.lang.Object

|

+--java.io.InputStream

|

+--javax.servlet.ServletInputStream

publicabstractclassServletInputStreamextendsjava.io.InputStream

Providesaninputstreamforreadingbinarydatafromaclientrequest,includinganefficientreadLinemethodforreadingdataonelineatatime.Withsomeprotocols,suchasHTTPPOSTandPUT,aServletInputStreamobjectcanbeusedtoreaddatasentfromtheclient.

AServletInputStreamobjectisnormallyretrievedviatheServletRequest.getInputStream()method.

Thisisanabstractclassthataservletcontainerimplements.Subclassesofthisclassmustimplementthejava.io.InputStream.read()method.

SeeAlso:ServletRequest

ConstructorSummaryprotected

ServletInputStream()Doesnothing,becausethisisanabstractclass.

MethodSummaryint

readLine(byte[]b,intoff,intlen)Readstheinputstream,onelineatatime.

Methodsinheritedfromclassjava.io.InputStreamavailable,close,mark,markSupported,read,read,read,reset,

Page 278: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

skip

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

toString,wait,wait,wait

ConstructorDetail

ServletInputStream

protectedServletInputStream()

Doesnothing,becausethisisanabstractclass.

MethodDetail

readLine

publicintreadLine(byte[]b,

intoff,

intlen)

throwsjava.io.IOException

Readstheinputstream,onelineatatime.Startingatanoffset,readsbytesintoanarray,untilitreadsacertainnumberofbytesorreachesanewlinecharacter,whichitreadsintothearrayaswell.

Thismethodreturns-1ifitreachestheendoftheinputstreambeforereadingthemaximumnumberofbytes.

Parameters:b-anarrayofbytesintowhichdataisreadoff-anintegerspecifyingthecharacteratwhichthismethodbeginsreadinglen-anintegerspecifyingthemaximumnumberofbytestoread

Returns:anintegerspecifyingtheactualnumberofbytesread,or-1iftheend

Page 279: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ofthestreamisreachedThrows:

java.io.IOException-ifaninputoroutputexceptionhasoccurred

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 280: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 281: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletClassServletOutputStreamjava.lang.Object

|

+--java.io.OutputStream

|

+--javax.servlet.ServletOutputStream

publicabstractclassServletOutputStreamextendsjava.io.OutputStream

Providesanoutputstreamforsendingbinarydatatotheclient.AServletOutputStreamobjectisnormallyretrievedviatheServletResponse.getOutputStream()method.

Thisisanabstractclassthattheservletcontainerimplements.Subclassesofthisclassmustimplementthejava.io.OutputStream.write(int)method.

SeeAlso:ServletResponse

ConstructorSummaryprotected

ServletOutputStream()Doesnothing,becausethisisanabstractclass.

MethodSummary

void

print(booleanb)Writesabooleanvaluetotheclient,withnocarriagereturn-linefeed(CRLF)characterattheend.

void

print(charc)Writesacharactertotheclient,withnocarriagereturn-linefeed(CRLF)attheend.

void

print(doubled)Writesadoublevaluetotheclient,withnocarriagereturn-linefeed(CRLF)attheend.

Page 282: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

void

print(floatf)Writesafloatvaluetotheclient,withnocarriagereturn-linefeed(CRLF)attheend.

void

print(inti)Writesaninttotheclient,withnocarriagereturn-linefeed(CRLF)attheend.

void

print(longl)Writesalongvaluetotheclient,withnocarriagereturn-linefeed(CRLF)attheend.

void

print(java.lang.Strings)WritesaStringtotheclient,withoutacarriagereturn-linefeed(CRLF)characterattheend.

voidprintln()Writesacarriagereturn-linefeed(CRLF)totheclient.

void

println(booleanb)Writesabooleanvaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).

void

println(charc)Writesacharactertotheclient,followedbyacarriagereturn-linefeed(CRLF).

void

println(doubled)Writesadoublevaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).

void

println(floatf)Writesafloatvaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).

void

println(inti)Writesaninttotheclient,followedbyacarriagereturn-linefeed(CRLF)character.

void

println(longl)Writesalongvaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).

void

println(java.lang.Strings)WritesaStringtotheclient,followedbyacarriagereturn-linefeed(CRLF).

Page 283: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Methodsinheritedfromclassjava.io.OutputStreamclose,flush,write,write,write

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

toString,wait,wait,wait

ConstructorDetail

ServletOutputStream

protectedServletOutputStream()

Doesnothing,becausethisisanabstractclass.

MethodDetail

print

publicvoidprint(java.lang.Strings)

throwsjava.io.IOException

WritesaStringtotheclient,withoutacarriagereturn-linefeed(CRLF)characterattheend.Parameters:

s-theStringThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

print

publicvoidprint(booleanb)

throwsjava.io.IOException

Page 284: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Writesabooleanvaluetotheclient,withnocarriagereturn-linefeed(CRLF)characterattheend.Parameters:

b-thebooleanvaluetosendtotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

print

publicvoidprint(charc)

throwsjava.io.IOException

Writesacharactertotheclient,withnocarriagereturn-linefeed(CRLF)attheend.Parameters:

c-thecharactertosendtotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

print

publicvoidprint(inti)

throwsjava.io.IOException

Writesaninttotheclient,withnocarriagereturn-linefeed(CRLF)attheend.Parameters:

i-theinttosendtotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

print

publicvoidprint(longl)

throwsjava.io.IOException

Writesalongvaluetotheclient,withnocarriagereturn-linefeed(CRLF)

Page 285: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

attheend.Parameters:

l-thelongvaluetosendtotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

print

publicvoidprint(floatf)

throwsjava.io.IOException

Writesafloatvaluetotheclient,withnocarriagereturn-linefeed(CRLF)attheend.Parameters:

f-thefloatvaluetosendtotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

print

publicvoidprint(doubled)

throwsjava.io.IOException

Writesadoublevaluetotheclient,withnocarriagereturn-linefeed(CRLF)attheend.Parameters:

d-thedoublevaluetosendtotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

println

publicvoidprintln()

throwsjava.io.IOException

Writesacarriagereturn-linefeed(CRLF)totheclient.Throws:

Page 286: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.io.IOException-ifaninputoroutputexceptionoccurred

println

publicvoidprintln(java.lang.Strings)

throwsjava.io.IOException

WritesaStringtotheclient,followedbyacarriagereturn-linefeed(CRLF).Parameters:

s-theStringtowritetotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

println

publicvoidprintln(booleanb)

throwsjava.io.IOException

Writesabooleanvaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).Parameters:

b-thebooleanvaluetowritetotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

println

publicvoidprintln(charc)

throwsjava.io.IOException

Writesacharactertotheclient,followedbyacarriagereturn-linefeed(CRLF).Parameters:

c-thecharactertowritetotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

Page 287: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

println

publicvoidprintln(inti)

throwsjava.io.IOException

Writesaninttotheclient,followedbyacarriagereturn-linefeed(CRLF)character.Parameters:

i-theinttowritetotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

println

publicvoidprintln(longl)

throwsjava.io.IOException

Writesalongvaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).Parameters:

l-thelongvaluetowritetotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

println

publicvoidprintln(floatf)

throwsjava.io.IOException

Writesafloatvaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).Parameters:

f-thefloatvaluetowritetotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

Page 288: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

println

publicvoidprintln(doubled)

throwsjava.io.IOException

Writesadoublevaluetotheclient,followedbyacarriagereturn-linefeed(CRLF).Parameters:

d-thedoublevaluetowritetotheclientThrows:

java.io.IOException-ifaninputoroutputexceptionoccurred

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 289: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 290: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceServletRequest

AllKnownSubinterfaces:HttpServletRequest

AllKnownImplementingClasses:ServletRequestWrapper

publicabstractinterfaceServletRequest

Definesanobjecttoprovideclientrequestinformationtoaservlet.TheservletcontainercreatesaServletRequestobjectandpassesitasanargumenttotheservlet'sservicemethod.

AServletRequestobjectprovidesdataincludingparameternameandvalues,attributes,andaninputstream.InterfacesthatextendServletRequestcanprovideadditionalprotocol-specificdata(forexample,HTTPdataisprovidedbyHttpServletRequest.

SeeAlso:HttpServletRequest

MethodSummary

java.lang.Object

getAttribute(java.lang.Stringname)ReturnsthevalueofthenamedattributeasanObject,ornullifnoattributeofthegivennameexists.

java.util.Enumeration

getAttributeNames()ReturnsanEnumerationcontainingthenamesoftheattributesavailabletothisrequest.

java.lang.String

getCharacterEncoding()Returnsthenameofthecharacterencodingusedinthebodyofthisrequest.

int

getContentLength()Returnsthelength,inbytes,oftherequestbodyand

Page 291: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

madeavailablebytheinputstream,or-1ifthelengthisnotknown.

java.lang.String

getContentType()ReturnstheMIMEtypeofthebodyoftherequest,ornullifthetypeisnotknown.

ServletInputStream

getInputStream()RetrievesthebodyoftherequestasbinarydatausingaServletInputStream.

java.util.Locale

getLocale()ReturnsthepreferredLocalethattheclientwillacceptcontentin,basedontheAccept-Languageheader.

java.util.Enumeration

getLocales()ReturnsanEnumerationofLocaleobjectsindicating,indecreasingorderstartingwiththepreferredlocale,thelocalesthatareacceptabletotheclientbasedontheAccept-Languageheader.

java.lang.String

getParameter(java.lang.Stringname)ReturnsthevalueofarequestparameterasaString,ornulliftheparameterdoesnotexist.

java.util.Map

getParameterMap()Returnsajava.util.Mapoftheparametersofthisrequest.

java.util.Enumeration

getParameterNames()ReturnsanEnumerationofStringobjectscontainingthenamesoftheparameterscontainedinthisrequest.

java.lang.String[]

getParameterValues(java.lang.Stringname)ReturnsanarrayofStringobjectscontainingallofthevaluesthegivenrequestparameterhas,ornulliftheparameterdoesnotexist.

java.lang.String

getProtocol()Returnsthenameandversionoftheprotocoltherequestusesintheformprotocol/majorVersion.minorVersion,forexample,HTTP/1.1.getReader()

Page 292: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.io.BufferedReader RetrievesthebodyoftherequestascharacterdatausingaBufferedReader.

java.lang.String

getRealPath(java.lang.Stringpath)Deprecated.AsofVersion2.1oftheJavaServletAPI,useServletContext.getRealPath(java.lang.String)

instead.

java.lang.String

getRemoteAddr()ReturnstheInternetProtocol(IP)addressoftheclientthatsenttherequest.

java.lang.String

getRemoteHost()Returnsthefullyqualifiednameoftheclientthatsenttherequest.

RequestDispatcher

getRequestDispatcher(java.lang.Stringpath)ReturnsaRequestDispatcherobjectthatactsasawrapperfortheresourcelocatedatthegivenpath.

java.lang.String

getScheme()Returnsthenameoftheschemeusedtomakethisrequest,forexample,http,https,orftp.

java.lang.String

getServerName()Returnsthehostnameoftheserverthatreceivedtherequest.

int

getServerPort()Returnstheportnumberonwhichthisrequestwasreceived.

boolean

isSecure()Returnsabooleanindicatingwhetherthisrequestwasmadeusingasecurechannel,suchasHTTPS.

voidremoveAttribute(java.lang.Stringname)Removesanattributefromthisrequest.

void

setAttribute(java.lang.Stringname,

java.lang.Objecto)Storesanattributeinthisrequest.

void

setCharacterEncoding(java.lang.Stringenv)Overridesthenameofthecharacterencodingusedinthebodyofthisrequest.

Page 293: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

MethodDetail

getAttribute

publicjava.lang.ObjectgetAttribute(java.lang.Stringname)

ReturnsthevalueofthenamedattributeasanObject,ornullifnoattributeofthegivennameexists.

Attributescanbesettwoways.Theservletcontainermaysetattributestomakeavailablecustominformationaboutarequest.Forexample,forrequestsmadeusingHTTPS,theattributejavax.servlet.request.X509Certificatecanbeusedtoretrieveinformationonthecertificateoftheclient.AttributescanalsobesetprogramaticallyusingsetAttribute(java.lang.String,java.lang.Object).ThisallowsinformationtobeembeddedintoarequestbeforeaRequestDispatchercall.

Attributenamesshouldfollowthesameconventionsaspackagenames.Thisspecificationreservesnamesmatchingjava.*,javax.*,andsun.*.

Parameters:name-aStringspecifyingthenameoftheattribute

Returns:anObjectcontainingthevalueoftheattribute,ornulliftheattributedoesnotexist

getAttributeNames

publicjava.util.EnumerationgetAttributeNames()

ReturnsanEnumerationcontainingthenamesoftheattributesavailabletothisrequest.ThismethodreturnsanemptyEnumerationiftherequesthasnoattributesavailabletoit.Returns:

anEnumerationofstringscontainingthenamesoftherequest's

Page 294: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

attributes

getCharacterEncoding

publicjava.lang.StringgetCharacterEncoding()

Returnsthenameofthecharacterencodingusedinthebodyofthisrequest.ThismethodreturnsnulliftherequestdoesnotspecifyacharacterencodingReturns:

aStringcontainingthenameofthechararacterencoding,ornulliftherequestdoesnotspecifyacharacterencoding

setCharacterEncoding

publicvoidsetCharacterEncoding(java.lang.Stringenv)

throwsjava.io.UnsupportedEncodingException

Overridesthenameofthecharacterencodingusedinthebodyofthisrequest.ThismethodmustbecalledpriortoreadingrequestparametersorreadinginputusinggetReader().Parameters:

a-Stringcontainingthenameofthechararacterencoding.Throws:

java.io.UnsupportedEncodingException-ifthisisnotavalidencoding

getContentLength

publicintgetContentLength()

Returnsthelength,inbytes,oftherequestbodyandmadeavailablebytheinputstream,or-1ifthelengthisnotknown.ForHTTPservlets,sameasthevalueoftheCGIvariableCONTENT_LENGTH.Returns:

anintegercontainingthelengthoftherequestbodyor-1ifthelengthisnotknown

Page 295: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getContentType

publicjava.lang.StringgetContentType()

ReturnstheMIMEtypeofthebodyoftherequest,ornullifthetypeisnotknown.ForHTTPservlets,sameasthevalueoftheCGIvariableCONTENT_TYPE.Returns:

aStringcontainingthenameoftheMIMEtypeoftherequest,ornullifthetypeisnotknown

getInputStream

publicServletInputStreamgetInputStream()

throwsjava.io.IOException

RetrievesthebodyoftherequestasbinarydatausingaServletInputStream.EitherthismethodorgetReader()maybecalledtoreadthebody,notboth.Returns:

aServletInputStreamobjectcontainingthebodyoftherequestThrows:

IllegalStateException-ifthegetReader()methodhasalreadybeencalledforthisrequestjava.io.IOException-ifaninputoroutputexceptionoccurred

getParameter

publicjava.lang.StringgetParameter(java.lang.Stringname)

ReturnsthevalueofarequestparameterasaString,ornulliftheparameterdoesnotexist.Requestparametersareextrainformationsentwiththerequest.ForHTTPservlets,parametersarecontainedinthequerystringorpostedformdata.

Youshouldonlyusethismethodwhenyouaresuretheparameterhasonly

Page 296: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

onevalue.Iftheparametermighthavemorethanonevalue,usegetParameterValues(java.lang.String).

Ifyouusethismethodwithamultivaluedparameter,thevaluereturnedisequaltothefirstvalueinthearrayreturnedbygetParameterValues.

Iftheparameterdatawassentintherequestbody,suchasoccurswithanHTTPPOSTrequest,thenreadingthebodydirectlyviagetInputStream()orgetReader()caninterferewiththeexecutionofthismethod.

Parameters:name-aStringspecifyingthenameoftheparameter

Returns:aStringrepresentingthesinglevalueoftheparameter

SeeAlso:getParameterValues(java.lang.String)

getParameterNames

publicjava.util.EnumerationgetParameterNames()

ReturnsanEnumerationofStringobjectscontainingthenamesoftheparameterscontainedinthisrequest.Iftherequesthasnoparameters,themethodreturnsanemptyEnumeration.Returns:

anEnumerationofStringobjects,eachStringcontainingthenameofarequestparameter;oranemptyEnumerationiftherequesthasnoparameters

getParameterValues

publicjava.lang.String[]getParameterValues(java.lang.Stringname)

ReturnsanarrayofStringobjectscontainingallofthevaluesthegivenrequestparameterhas,ornulliftheparameterdoesnotexist.

Iftheparameterhasasinglevalue,thearrayhasalengthof1.

Page 297: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Parameters:name-aStringcontainingthenameoftheparameterwhosevalueisrequested

Returns:anarrayofStringobjectscontainingtheparameter'svalues

SeeAlso:getParameter(java.lang.String)

getParameterMap

publicjava.util.MapgetParameterMap()

Returnsajava.util.Mapoftheparametersofthisrequest.Requestparametersareextrainformationsentwiththerequest.ForHTTPservlets,parametersarecontainedinthequerystringorpostedformdata.Returns:

animmutablejava.util.Mapcontainingparameternamesaskeysandparametervaluesasmapvalues.ThekeysintheparametermapareoftypeString.ThevaluesintheparametermapareoftypeStringarray.

getProtocol

publicjava.lang.StringgetProtocol()

Returnsthenameandversionoftheprotocoltherequestusesintheformprotocol/majorVersion.minorVersion,forexample,HTTP/1.1.ForHTTPservlets,thevaluereturnedisthesameasthevalueoftheCGIvariableSERVER_PROTOCOL.Returns:

aStringcontainingtheprotocolnameandversionnumber

getScheme

publicjava.lang.StringgetScheme()

Returnsthenameoftheschemeusedtomakethisrequest,forexample,

Page 298: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

http,https,orftp.DifferentschemeshavedifferentrulesforconstructingURLs,asnotedinRFC1738.Returns:

aStringcontainingthenameoftheschemeusedtomakethisrequest

getServerName

publicjava.lang.StringgetServerName()

Returnsthehostnameoftheserverthatreceivedtherequest.ForHTTPservlets,sameasthevalueoftheCGIvariableSERVER_NAME.Returns:

aStringcontainingthenameoftheservertowhichtherequestwassent

getServerPort

publicintgetServerPort()

Returnstheportnumberonwhichthisrequestwasreceived.ForHTTPservlets,sameasthevalueoftheCGIvariableSERVER_PORT.Returns:

anintegerspecifyingtheportnumber

getReader

publicjava.io.BufferedReadergetReader()

throwsjava.io.IOException

RetrievesthebodyoftherequestascharacterdatausingaBufferedReader.Thereadertranslatesthecharacterdataaccordingtothecharacterencodingusedonthebody.EitherthismethodorgetInputStream()maybecalledtoreadthebody,notboth.Returns:

aBufferedReadercontainingthebodyoftherequestThrows:

Page 299: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.io.UnsupportedEncodingException-ifthecharactersetencodingusedisnotsupportedandthetextcannotbedecodedIllegalStateException-ifgetInputStream()methodhasbeencalledonthisrequestjava.io.IOException-ifaninputoroutputexceptionoccurred

SeeAlso:getInputStream()

getRemoteAddr

publicjava.lang.StringgetRemoteAddr()

ReturnstheInternetProtocol(IP)addressoftheclientthatsenttherequest.ForHTTPservlets,sameasthevalueoftheCGIvariableREMOTE_ADDR.Returns:

aStringcontainingtheIPaddressoftheclientthatsenttherequest

getRemoteHost

publicjava.lang.StringgetRemoteHost()

Returnsthefullyqualifiednameoftheclientthatsenttherequest.Iftheenginecannotorchoosesnottoresolvethehostname(toimproveperformance),thismethodreturnsthedotted-stringformoftheIPaddress.ForHTTPservlets,sameasthevalueoftheCGIvariableREMOTE_HOST.Returns:

aStringcontainingthefullyqualifiednameoftheclient

setAttribute

publicvoidsetAttribute(java.lang.Stringname,

java.lang.Objecto)

Storesanattributeinthisrequest.Attributesareresetbetweenrequests.ThismethodismostoftenusedinconjunctionwithRequestDispatcher.

Attributenamesshouldfollowthesameconventionsaspackagenames.

Page 300: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Namesbeginningwithjava.*,javax.*,andcom.sun.*,arereservedforusebySunMicrosystems.Ifthevaluepassedinisnull,theeffectisthesameascallingremoveAttribute(java.lang.String).

Parameters:name-aStringspecifyingthenameoftheattributeo-theObjecttobestored

removeAttribute

publicvoidremoveAttribute(java.lang.Stringname)

Removesanattributefromthisrequest.Thismethodisnotgenerallyneededasattributesonlypersistaslongastherequestisbeinghandled.

Attributenamesshouldfollowthesameconventionsaspackagenames.Namesbeginningwithjava.*,javax.*,andcom.sun.*,arereservedforusebySunMicrosystems.

Parameters:name-aStringspecifyingthenameoftheattributetoremove

getLocale

publicjava.util.LocalegetLocale()

ReturnsthepreferredLocalethattheclientwillacceptcontentin,basedontheAccept-Languageheader.Iftheclientrequestdoesn'tprovideanAccept-Languageheader,thismethodreturnsthedefaultlocalefortheserver.Returns:

thepreferredLocalefortheclient

getLocales

Page 301: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicjava.util.EnumerationgetLocales()

ReturnsanEnumerationofLocaleobjectsindicating,indecreasingorderstartingwiththepreferredlocale,thelocalesthatareacceptabletotheclientbasedontheAccept-Languageheader.Iftheclientrequestdoesn'tprovideanAccept-Languageheader,thismethodreturnsanEnumerationcontainingoneLocale,thedefaultlocalefortheserver.Returns:

anEnumerationofpreferredLocaleobjectsfortheclient

isSecure

publicbooleanisSecure()

Returnsabooleanindicatingwhetherthisrequestwasmadeusingasecurechannel,suchasHTTPS.Returns:

abooleanindicatingiftherequestwasmadeusingasecurechannel

getRequestDispatcher

publicRequestDispatchergetRequestDispatcher(java.lang.Stringpath)

ReturnsaRequestDispatcherobjectthatactsasawrapperfortheresourcelocatedatthegivenpath.ARequestDispatcherobjectcanbeusedtoforwardarequesttotheresourceortoincludetheresourceinaresponse.Theresourcecanbedynamicorstatic.

Thepathnamespecifiedmayberelative,althoughitcannotextendoutsidethecurrentservletcontext.Ifthepathbeginswitha"/"itisinterpretedasrelativetothecurrentcontextroot.ThismethodreturnsnulliftheservletcontainercannotreturnaRequestDispatcher.

ThedifferencebetweenthismethodandServletContext.getRequestDispatcher(java.lang.String)isthatthismethodcantakearelativepath.

Parameters:

Page 302: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

path-aStringspecifyingthepathnametotheresourceReturns:

aRequestDispatcherobjectthatactsasawrapperfortheresourceatthespecifiedpath

SeeAlso:RequestDispatcher,ServletContext.getRequestDispatcher(java.lang.String)

getRealPath

publicjava.lang.StringgetRealPath(java.lang.Stringpath)

Deprecated.AsofVersion2.1oftheJavaServletAPI,useServletContext.getRealPath(java.lang.String)instead.

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 303: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 304: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletClassServletRequestWrapperjava.lang.Object

|

+--javax.servlet.ServletRequestWrapper

DirectKnownSubclasses:HttpServletRequestWrapper

publicclassServletRequestWrapperextendsjava.lang.ObjectimplementsServletRequest

ProvidesaconvenientimplementationoftheServletRequestinterfacethatcanbesubclassedbydeveloperswishingtoadapttherequesttoaServlet.ThisclassimplementstheWrapperorDecoratorpattern.Methodsdefaulttocallingthroughtothewrappedrequestobject.

Since:v2.3

SeeAlso:ServletRequest

ConstructorSummaryServletRequestWrapper(ServletRequestrequest)CreatesaServletRequestadaptorwrappingthegivenrequestobject.

MethodSummary

java.lang.Object

getAttribute(java.lang.Stringname)ThedefaultbehaviorofthismethodistocallgetAttribute(Stringname)onthewrappedrequestobject.

java.util.Enumeration

getAttributeNames()ThedefaultbehaviorofthismethodistoreturngetAttributeNames()onthewrappedrequestobject.

Page 305: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.lang.String

getCharacterEncoding()ThedefaultbehaviorofthismethodistoreturngetCharacterEncoding()onthewrappedrequestobject.

int

getContentLength()ThedefaultbehaviorofthismethodistoreturngetContentLength()onthewrappedrequestobject.

java.lang.String

getContentType()ThedefaultbehaviorofthismethodistoreturngetContentType()onthewrappedrequestobject.

ServletInputStream

getInputStream()ThedefaultbehaviorofthismethodistoreturngetInputStream()onthewrappedrequestobject.

java.util.Locale

getLocale()ThedefaultbehaviorofthismethodistoreturngetLocale()onthewrappedrequestobject.

java.util.Enumeration

getLocales()ThedefaultbehaviorofthismethodistoreturngetLocales()onthewrappedrequestobject.

java.lang.String

getParameter(java.lang.Stringname)ThedefaultbehaviorofthismethodistoreturngetParameter(Stringname)onthewrappedrequestobject.

java.util.Map

getParameterMap()ThedefaultbehaviorofthismethodistoreturngetParameterMap()onthewrappedrequestobject.

java.util.Enumeration

getParameterNames()ThedefaultbehaviorofthismethodistoreturngetParameterNames()onthewrappedrequestobject.

java.lang.String[]

getParameterValues(java.lang.Stringname)ThedefaultbehaviorofthismethodistoreturngetParameterValues(Stringname)onthewrappedrequestobject.

java.lang.String

getProtocol()ThedefaultbehaviorofthismethodistoreturngetProtocol()onthewrappedrequestobject.getReader()

Page 306: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.io.BufferedReader ThedefaultbehaviorofthismethodistoreturngetReader()onthewrappedrequestobject.

java.lang.String

getRealPath(java.lang.Stringpath)ThedefaultbehaviorofthismethodistoreturngetRealPath(Stringpath)onthewrappedrequestobject.

java.lang.String

getRemoteAddr()ThedefaultbehaviorofthismethodistoreturngetRemoteAddr()onthewrappedrequestobject.

java.lang.String

getRemoteHost()ThedefaultbehaviorofthismethodistoreturngetRemoteHost()onthewrappedrequestobject.

ServletRequestgetRequest()Returnthewrappedrequestobject.

RequestDispatcher

getRequestDispatcher(java.lang.Stringpath)ThedefaultbehaviorofthismethodistoreturngetRequestDispatcher(Stringpath)onthewrappedrequestobject.

java.lang.String

getScheme()ThedefaultbehaviorofthismethodistoreturngetScheme()onthewrappedrequestobject.

java.lang.String

getServerName()ThedefaultbehaviorofthismethodistoreturngetServerName()onthewrappedrequestobject.

int

getServerPort()ThedefaultbehaviorofthismethodistoreturngetServerPort()onthewrappedrequestobject.

boolean

isSecure()ThedefaultbehaviorofthismethodistoreturnisSecure()onthewrappedrequestobject.

void

removeAttribute(java.lang.Stringname)ThedefaultbehaviorofthismethodistocallremoveAttribute(Stringname)onthewrappedrequestobject.

void

setAttribute(java.lang.Stringname,

java.lang.Objecto)Thedefaultbehaviorofthismethodistoreturn

Page 307: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

setAttribute(Stringname,Objecto)onthewrappedrequestobject.

void

setCharacterEncoding(java.lang.Stringenc)Thedefaultbehaviorofthismethodistosetthecharacterencodingonthewrappedrequestobject.

voidsetRequest(ServletRequestrequest)Setstherequestobjectbeingwrapped.

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

toString,wait,wait,wait

ConstructorDetail

ServletRequestWrapper

publicServletRequestWrapper(ServletRequestrequest)

CreatesaServletRequestadaptorwrappingthegivenrequestobject.Throws:

java.lang.IllegalArgumentException-iftherequestisnull

MethodDetail

getRequest

publicServletRequestgetRequest()

Returnthewrappedrequestobject.

setRequest

publicvoidsetRequest(ServletRequestrequest)

Setstherequestobjectbeingwrapped.

Page 308: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Throws:java.lang.IllegalArgumentException-iftherequestisnull.

getAttribute

publicjava.lang.ObjectgetAttribute(java.lang.Stringname)

ThedefaultbehaviorofthismethodistocallgetAttribute(Stringname)onthewrappedrequestobject.Specifiedby:

getAttributeininterfaceServletRequest

getAttributeNames

publicjava.util.EnumerationgetAttributeNames()

ThedefaultbehaviorofthismethodistoreturngetAttributeNames()onthewrappedrequestobject.Specifiedby:

getAttributeNamesininterfaceServletRequest

getCharacterEncoding

publicjava.lang.StringgetCharacterEncoding()

ThedefaultbehaviorofthismethodistoreturngetCharacterEncoding()onthewrappedrequestobject.Specifiedby:

getCharacterEncodingininterfaceServletRequest

setCharacterEncoding

publicvoidsetCharacterEncoding(java.lang.Stringenc)

throwsjava.io.UnsupportedEncodingException

Thedefaultbehaviorofthismethodistosetthecharacterencodingonthe

Page 309: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

wrappedrequestobject.Specifiedby:

setCharacterEncodingininterfaceServletRequest

getContentLength

publicintgetContentLength()

ThedefaultbehaviorofthismethodistoreturngetContentLength()onthewrappedrequestobject.Specifiedby:

getContentLengthininterfaceServletRequest

getContentType

publicjava.lang.StringgetContentType()

ThedefaultbehaviorofthismethodistoreturngetContentType()onthewrappedrequestobject.Specifiedby:

getContentTypeininterfaceServletRequest

getInputStream

publicServletInputStreamgetInputStream()

throwsjava.io.IOException

ThedefaultbehaviorofthismethodistoreturngetInputStream()onthewrappedrequestobject.Specifiedby:

getInputStreamininterfaceServletRequest

getParameter

publicjava.lang.StringgetParameter(java.lang.Stringname)

Page 310: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThedefaultbehaviorofthismethodistoreturngetParameter(Stringname)onthewrappedrequestobject.Specifiedby:

getParameterininterfaceServletRequest

getParameterMap

publicjava.util.MapgetParameterMap()

ThedefaultbehaviorofthismethodistoreturngetParameterMap()onthewrappedrequestobject.Specifiedby:

getParameterMapininterfaceServletRequest

getParameterNames

publicjava.util.EnumerationgetParameterNames()

ThedefaultbehaviorofthismethodistoreturngetParameterNames()onthewrappedrequestobject.Specifiedby:

getParameterNamesininterfaceServletRequest

getParameterValues

publicjava.lang.String[]getParameterValues(java.lang.Stringname)

ThedefaultbehaviorofthismethodistoreturngetParameterValues(Stringname)onthewrappedrequestobject.Specifiedby:

getParameterValuesininterfaceServletRequest

getProtocol

publicjava.lang.StringgetProtocol()

Page 311: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ThedefaultbehaviorofthismethodistoreturngetProtocol()onthewrappedrequestobject.Specifiedby:

getProtocolininterfaceServletRequest

getScheme

publicjava.lang.StringgetScheme()

ThedefaultbehaviorofthismethodistoreturngetScheme()onthewrappedrequestobject.Specifiedby:

getSchemeininterfaceServletRequest

getServerName

publicjava.lang.StringgetServerName()

ThedefaultbehaviorofthismethodistoreturngetServerName()onthewrappedrequestobject.Specifiedby:

getServerNameininterfaceServletRequest

getServerPort

publicintgetServerPort()

ThedefaultbehaviorofthismethodistoreturngetServerPort()onthewrappedrequestobject.Specifiedby:

getServerPortininterfaceServletRequest

getReader

publicjava.io.BufferedReadergetReader()

Page 312: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

throwsjava.io.IOException

ThedefaultbehaviorofthismethodistoreturngetReader()onthewrappedrequestobject.Specifiedby:

getReaderininterfaceServletRequest

getRemoteAddr

publicjava.lang.StringgetRemoteAddr()

ThedefaultbehaviorofthismethodistoreturngetRemoteAddr()onthewrappedrequestobject.Specifiedby:

getRemoteAddrininterfaceServletRequest

getRemoteHost

publicjava.lang.StringgetRemoteHost()

ThedefaultbehaviorofthismethodistoreturngetRemoteHost()onthewrappedrequestobject.Specifiedby:

getRemoteHostininterfaceServletRequest

setAttribute

publicvoidsetAttribute(java.lang.Stringname,

java.lang.Objecto)

ThedefaultbehaviorofthismethodistoreturnsetAttribute(Stringname,Objecto)onthewrappedrequestobject.Specifiedby:

setAttributeininterfaceServletRequest

removeAttribute

Page 313: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicvoidremoveAttribute(java.lang.Stringname)

ThedefaultbehaviorofthismethodistocallremoveAttribute(Stringname)onthewrappedrequestobject.Specifiedby:

removeAttributeininterfaceServletRequest

getLocale

publicjava.util.LocalegetLocale()

ThedefaultbehaviorofthismethodistoreturngetLocale()onthewrappedrequestobject.Specifiedby:

getLocaleininterfaceServletRequest

getLocales

publicjava.util.EnumerationgetLocales()

ThedefaultbehaviorofthismethodistoreturngetLocales()onthewrappedrequestobject.Specifiedby:

getLocalesininterfaceServletRequest

isSecure

publicbooleanisSecure()

ThedefaultbehaviorofthismethodistoreturnisSecure()onthewrappedrequestobject.Specifiedby:

isSecureininterfaceServletRequest

getRequestDispatcher

Page 314: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicRequestDispatchergetRequestDispatcher(java.lang.Stringpath)

ThedefaultbehaviorofthismethodistoreturngetRequestDispatcher(Stringpath)onthewrappedrequestobject.Specifiedby:

getRequestDispatcherininterfaceServletRequest

getRealPath

publicjava.lang.StringgetRealPath(java.lang.Stringpath)

ThedefaultbehaviorofthismethodistoreturngetRealPath(Stringpath)onthewrappedrequestobject.Specifiedby:

getRealPathininterfaceServletRequest

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 315: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 316: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletInterfaceServletResponse

AllKnownSubinterfaces:HttpServletResponse

AllKnownImplementingClasses:ServletResponseWrapper

publicabstractinterfaceServletResponse

Definesanobjecttoassistaservletinsendingaresponsetotheclient.TheservletcontainercreatesaServletResponseobjectandpassesitasanargumenttotheservlet'sservicemethod.

TosendbinarydatainaMIMEbodyresponse,usetheServletOutputStreamreturnedbygetOutputStream().Tosendcharacterdata,usethePrintWriterobjectreturnedbygetWriter().Tomixbinaryandtextdata,forexample,tocreateamultipartresponse,useaServletOutputStreamandmanagethecharactersectionsmanually.

ThecharsetfortheMIMEbodyresponsecanbespecifiedwithsetContentType(java.lang.String).Forexample,"text/html;charset=Shift_JIS".ThecharsetcanalternatelybesetusingsetLocale(java.util.Locale).Ifnocharsetisspecified,ISO-8859-1willbeused.ThesetContentTypeorsetLocalemethodmustbecalledbeforegetWriterforthecharsettoaffecttheconstructionofthewriter.

SeetheInternetRFCssuchasRFC2045formoreinformationonMIME.ProtocolssuchasSMTPandHTTPdefineprofilesofMIME,andthosestandardsarestillevolving.

SeeAlso:ServletOutputStream

MethodSummary

Page 317: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

voidflushBuffer()Forcesanycontentinthebuffertobewrittentotheclient.

intgetBufferSize()Returnstheactualbuffersizeusedfortheresponse.

java.lang.String

getCharacterEncoding()ReturnsthenameofthecharsetusedfortheMIMEbodysentinthisresponse.

java.util.LocalegetLocale()Returnsthelocaleassignedtotheresponse.

ServletOutputStream

getOutputStream()ReturnsaServletOutputStreamsuitableforwritingbinarydataintheresponse.

java.io.PrintWriter

getWriter()ReturnsaPrintWriterobjectthatcansendcharactertexttotheclient.

boolean

isCommitted()Returnsabooleanindicatingiftheresponsehasbeencommitted.

void

reset()Clearsanydatathatexistsinthebufferaswellasthestatuscodeandheaders.

void

resetBuffer()Clearsthecontentoftheunderlyingbufferintheresponsewithoutclearingheadersorstatuscode.

void

setBufferSize(intsize)Setsthepreferredbuffersizeforthebodyoftheresponse.

void

setContentLength(intlen)SetsthelengthofthecontentbodyintheresponseInHTTPservlets,thismethodsetstheHTTPContent-Lengthheader.

void

setContentType(java.lang.Stringtype)Setsthecontenttypeoftheresponsebeingsenttotheclient.

Page 318: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

voidsetLocale(java.util.Localeloc)Setsthelocaleoftheresponse,settingtheheaders(includingtheContent-Type'scharset)asappropriate.

MethodDetail

getCharacterEncoding

publicjava.lang.StringgetCharacterEncoding()

ReturnsthenameofthecharsetusedfortheMIMEbodysentinthisresponse.

Ifnocharsethasbeenassigned,itisimplicitlysettoISO-8859-1(Latin-1).

SeeRFC2047(http://ds.internic.net/rfc/rfc2045.txt)formoreinformationaboutcharacterencodingandMIME.

Returns:aStringspecifyingthenameofthecharset,forexample,ISO-8859-1

getOutputStream

publicServletOutputStreamgetOutputStream()

throwsjava.io.IOException

ReturnsaServletOutputStreamsuitableforwritingbinarydataintheresponse.Theservletcontainerdoesnotencodethebinarydata.

Callingflush()ontheServletOutputStreamcommitstheresponse.EitherthismethodorgetWriter()maybecalledtowritethebody,notboth.

Returns:aServletOutputStreamforwritingbinarydata

Throws:IllegalStateException-ifthegetWritermethodhasbeencalledonthisresponse

Page 319: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.io.IOException-ifaninputoroutputexceptionoccurredSeeAlso:

getWriter()

getWriter

publicjava.io.PrintWritergetWriter()

throwsjava.io.IOException

ReturnsaPrintWriterobjectthatcansendcharactertexttotheclient.Thecharacterencodingusedistheonespecifiedinthecharset=propertyofthesetContentType(java.lang.String)method,whichmustbecalledbeforecallingthismethodforthecharsettotakeeffect.

Ifnecessary,theMIMEtypeoftheresponseismodifiedtoreflectthecharacterencodingused.

Callingflush()onthePrintWritercommitstheresponse.

EitherthismethodorgetOutputStream()maybecalledtowritethebody,notboth.

Returns:aPrintWriterobjectthatcanreturncharacterdatatotheclient

Throws:java.io.UnsupportedEncodingException-ifthecharsetspecifiedinsetContentTypecannotbeusedIllegalStateException-ifthegetOutputStreammethodhasalreadybeencalledforthisresponseobjectjava.io.IOException-ifaninputoroutputexceptionoccurred

SeeAlso:getOutputStream(),setContentType(java.lang.String)

setContentLength

publicvoidsetContentLength(intlen)

SetsthelengthofthecontentbodyintheresponseInHTTPservlets,this

Page 320: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

methodsetstheHTTPContent-Lengthheader.Parameters:

len-anintegerspecifyingthelengthofthecontentbeingreturnedtotheclient;setstheContent-Lengthheader

setContentType

publicvoidsetContentType(java.lang.Stringtype)

Setsthecontenttypeoftheresponsebeingsenttotheclient.Thecontenttypemayincludethetypeofcharacterencodingused,forexample,text/html;charset=ISO-8859-4.

IfobtainingaPrintWriter,thismethodshouldbecalledfirst.

Parameters:type-aStringspecifyingtheMIMEtypeofthecontent

SeeAlso:getOutputStream(),getWriter()

setBufferSize

publicvoidsetBufferSize(intsize)

Setsthepreferredbuffersizeforthebodyoftheresponse.Theservletcontainerwilluseabufferatleastaslargeasthesizerequested.TheactualbuffersizeusedcanbefoundusinggetBufferSize.

Alargerbufferallowsmorecontenttobewrittenbeforeanythingisactuallysent,thusprovidingtheservletwithmoretimetosetappropriatestatuscodesandheaders.Asmallerbufferdecreasesservermemoryloadandallowstheclienttostartreceivingdatamorequickly.

Thismethodmustbecalledbeforeanyresponsebodycontentiswritten;ifcontenthasbeenwritten,thismethodthrowsanIllegalStateException.

Parameters:size-thepreferredbuffersize

Page 321: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Throws:IllegalStateException-ifthismethodiscalledaftercontenthasbeenwritten

SeeAlso:getBufferSize(),flushBuffer(),isCommitted(),reset()

getBufferSize

publicintgetBufferSize()

Returnstheactualbuffersizeusedfortheresponse.Ifnobufferingisused,thismethodreturns0.Returns:

theactualbuffersizeusedSeeAlso:

setBufferSize(int),flushBuffer(),isCommitted(),reset()

flushBuffer

publicvoidflushBuffer()

throwsjava.io.IOException

Forcesanycontentinthebuffertobewrittentotheclient.Acalltothismethodautomaticallycommitstheresponse,meaningthestatuscodeandheaderswillbewritten.SeeAlso:

setBufferSize(int),getBufferSize(),isCommitted(),reset()

resetBuffer

publicvoidresetBuffer()

Clearsthecontentoftheunderlyingbufferintheresponsewithoutclearingheadersorstatuscode.Iftheresponsehasbeencommitted,thismethodthrowsanIllegalStateException.Since:

Page 322: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

2.3SeeAlso:

setBufferSize(int),getBufferSize(),isCommitted(),reset()

isCommitted

publicbooleanisCommitted()

Returnsabooleanindicatingiftheresponsehasbeencommitted.Acommitedresponsehasalreadyhaditsstatuscodeandheaderswritten.Returns:

abooleanindicatingiftheresponsehasbeencommittedSeeAlso:

setBufferSize(int),getBufferSize(),flushBuffer(),reset()

reset

publicvoidreset()

Clearsanydatathatexistsinthebufferaswellasthestatuscodeandheaders.Iftheresponsehasbeencommitted,thismethodthrowsanIllegalStateException.Throws:

IllegalStateException-iftheresponsehasalreadybeencommittedSeeAlso:

setBufferSize(int),getBufferSize(),flushBuffer(),isCommitted()

setLocale

publicvoidsetLocale(java.util.Localeloc)

Setsthelocaleoftheresponse,settingtheheaders(includingtheContent-Type'scharset)asappropriate.ThismethodshouldbecalledbeforeacalltogetWriter().Bydefault,theresponselocaleisthedefaultlocalefortheserver.

Page 323: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Parameters:loc-thelocaleoftheresponse

SeeAlso:getLocale()

getLocale

publicjava.util.LocalegetLocale()

Returnsthelocaleassignedtotheresponse.SeeAlso:

setLocale(java.util.Locale)

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 324: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 325: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletClassServletResponseWrapperjava.lang.Object

|

+--javax.servlet.ServletResponseWrapper

DirectKnownSubclasses:HttpServletResponseWrapper

publicclassServletResponseWrapperextendsjava.lang.ObjectimplementsServletResponse

ProvidesaconvenientimplementationoftheServletResponseinterfacethatcanbesubclassedbydeveloperswishingtoadapttheresponsefromaServlet.ThisclassimplementstheWrapperorDecoratorpattern.Methodsdefaulttocallingthroughtothewrappedresponseobject.

Since:v2.3

SeeAlso:ServletResponse

ConstructorSummaryServletResponseWrapper(ServletResponseresponse)CreatesaServletResponseadaptorwrappingthegivenresponseobject.

MethodSummary

void

flushBuffer()ThedefaultbehaviorofthismethodistocallflushBuffer()onthewrappedresponseobject.

int

getBufferSize()ThedefaultbehaviorofthismethodistoreturngetBufferSize()onthewrappedresponseobject.

Page 326: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

java.lang.String

getCharacterEncoding()ThedefaultbehaviorofthismethodistoreturngetCharacterEncoding()onthewrappedresponseobject.

java.util.Locale

getLocale()ThedefaultbehaviorofthismethodistoreturngetLocale()onthewrappedresponseobject.

ServletOutputStream

getOutputStream()ThedefaultbehaviorofthismethodistoreturngetOutputStream()onthewrappedresponseobject.

ServletResponsegetResponse()ReturnthewrappedServletResponseobject.

java.io.PrintWriter

getWriter()ThedefaultbehaviorofthismethodistoreturngetWriter()onthewrappedresponseobject.

boolean

isCommitted()ThedefaultbehaviorofthismethodistoreturnisCommitted()onthewrappedresponseobject.

void

reset()Thedefaultbehaviorofthismethodistocallreset()onthewrappedresponseobject.

void

resetBuffer()ThedefaultbehaviorofthismethodistocallresetBuffer()onthewrappedresponseobject.

void

setBufferSize(intsize)ThedefaultbehaviorofthismethodistocallsetBufferSize(intsize)onthewrappedresponseobject.

void

setContentLength(intlen)ThedefaultbehaviorofthismethodistocallsetContentLength(intlen)onthewrappedresponseobject.

void

setContentType(java.lang.Stringtype)ThedefaultbehaviorofthismethodistocallsetContentType(Stringtype)onthewrappedresponseobject.

void

setLocale(java.util.Localeloc)ThedefaultbehaviorofthismethodistocallsetLocale(Localeloc)onthewrappedresponseobject.

Page 327: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

voidsetResponse(ServletResponseresponse)Setstheresponsebeingwrapped.

Methodsinheritedfromclassjava.lang.Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,

toString,wait,wait,wait

ConstructorDetail

ServletResponseWrapper

publicServletResponseWrapper(ServletResponseresponse)

CreatesaServletResponseadaptorwrappingthegivenresponseobject.Throws:

java.lang.IllegalArgumentException-iftheresponseisnull.

MethodDetail

getResponse

publicServletResponsegetResponse()

ReturnthewrappedServletResponseobject.

setResponse

publicvoidsetResponse(ServletResponseresponse)

Setstheresponsebeingwrapped.Throws:

java.lang.IllegalArgumentException-iftheresponseisnull.

getCharacterEncoding

Page 328: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

publicjava.lang.StringgetCharacterEncoding()

ThedefaultbehaviorofthismethodistoreturngetCharacterEncoding()onthewrappedresponseobject.Specifiedby:

getCharacterEncodingininterfaceServletResponse

getOutputStream

publicServletOutputStreamgetOutputStream()

throwsjava.io.IOException

ThedefaultbehaviorofthismethodistoreturngetOutputStream()onthewrappedresponseobject.Specifiedby:

getOutputStreamininterfaceServletResponse

getWriter

publicjava.io.PrintWritergetWriter()

throwsjava.io.IOException

ThedefaultbehaviorofthismethodistoreturngetWriter()onthewrappedresponseobject.Specifiedby:

getWriterininterfaceServletResponse

setContentLength

publicvoidsetContentLength(intlen)

ThedefaultbehaviorofthismethodistocallsetContentLength(intlen)onthewrappedresponseobject.Specifiedby:

setContentLengthininterfaceServletResponse

Page 329: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

setContentType

publicvoidsetContentType(java.lang.Stringtype)

ThedefaultbehaviorofthismethodistocallsetContentType(Stringtype)onthewrappedresponseobject.Specifiedby:

setContentTypeininterfaceServletResponse

setBufferSize

publicvoidsetBufferSize(intsize)

ThedefaultbehaviorofthismethodistocallsetBufferSize(intsize)onthewrappedresponseobject.Specifiedby:

setBufferSizeininterfaceServletResponse

getBufferSize

publicintgetBufferSize()

ThedefaultbehaviorofthismethodistoreturngetBufferSize()onthewrappedresponseobject.Specifiedby:

getBufferSizeininterfaceServletResponse

flushBuffer

publicvoidflushBuffer()

throwsjava.io.IOException

ThedefaultbehaviorofthismethodistocallflushBuffer()onthewrappedresponseobject.Specifiedby:

flushBufferininterfaceServletResponse

Page 330: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

isCommitted

publicbooleanisCommitted()

ThedefaultbehaviorofthismethodistoreturnisCommitted()onthewrappedresponseobject.Specifiedby:

isCommittedininterfaceServletResponse

reset

publicvoidreset()

Thedefaultbehaviorofthismethodistocallreset()onthewrappedresponseobject.Specifiedby:

resetininterfaceServletResponse

resetBuffer

publicvoidresetBuffer()

ThedefaultbehaviorofthismethodistocallresetBuffer()onthewrappedresponseobject.Specifiedby:

resetBufferininterfaceServletResponse

setLocale

publicvoidsetLocale(java.util.Localeloc)

ThedefaultbehaviorofthismethodistocallsetLocale(Localeloc)onthewrappedresponseobject.Specifiedby:

setLocaleininterfaceServletResponse

Page 331: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getLocale

publicjava.util.LocalegetLocale()

ThedefaultbehaviorofthismethodistoreturngetLocale()onthewrappedresponseobject.Specifiedby:

getLocaleininterfaceServletResponse

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 332: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD

Page 333: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

javax.servletClassUnavailableExceptionjava.lang.Object

|

+--java.lang.Throwable

|

+--java.lang.Exception

|

+--javax.servlet.ServletException

|

+--javax.servlet.UnavailableException

publicclassUnavailableExceptionextendsServletException

Definesanexceptionthataservletorfilterthrowstoindicatethatitispermanentlyortemporarilyunavailable.

Whenaservletorfilterispermanentlyunavailable,somethingiswrongwiththeit,anditcannothandlerequestsuntilsomeactionistaken.Forexample,aservletmightbeconfiguredincorrectly,orafilter'sstatemaybecorrupted.Thecomponentshouldlogboththeerrorandthecorrectiveactionthatisneeded.

Aservletorfilteristemporarilyunavailableifitcannothandlerequestsmomentarilyduetosomesystem-wideproblem.Forexample,athird-tierservermightnotbeaccessible,ortheremaybeinsufficientmemoryordiskstoragetohandlerequests.Asystemadministratormayneedtotakecorrectiveaction.

Servletcontainerscansafelytreatbothtypesofunavailableexceptionsinthesameway.However,treatingtemporaryunavailabilityeffectivelymakestheservletcontainermorerobust.Specifically,theservletcontainermightblockrequeststotheservletorfilterforaperiodoftimesuggestedbytheexception,ratherthanrejectingthemuntiltheservletcontainerrestarts.

SeeAlso:SerializedForm

Page 334: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

ConstructorSummaryUnavailableException(intseconds,Servletservlet,

java.lang.Stringmsg)Deprecated.AsofJavaServletAPI2.2,useUnavailableException(String,int)instead.UnavailableException(Servletservlet,java.lang.Stringmsg)Deprecated.AsofJavaServletAPI2.2,useUnavailableException(String)instead.UnavailableException(java.lang.Stringmsg)Constructsanewexceptionwithadescriptivemessageindicatingthattheservletispermanentlyunavailable.UnavailableException(java.lang.Stringmsg,intseconds)Constructsanewexceptionwithadescriptivemessageindicatingthattheservletistemporarilyunavailableandgivinganestimateofhowlongitwillbeunavailable.

MethodSummary

Servlet

getServlet()Deprecated.AsofJavaServletAPI2.2,withnoreplacement.Returnstheservletthatisreportingitsunavailability.

int

getUnavailableSeconds()Returnsthenumberofsecondstheservletexpectstobetemporarilyunavailable.

boolean

isPermanent()Returnsabooleanindicatingwhethertheservletispermanentlyunavailable.

Methodsinheritedfromclassjavax.servlet.ServletExceptiongetRootCause

Methodsinheritedfromclassjava.lang.ThrowablefillInStackTrace,getLocalizedMessage,getMessage,

printStackTrace,printStackTrace,printStackTrace,toString

Methodsinheritedfromclassjava.lang.Object

Page 335: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

clone,equals,finalize,getClass,hashCode,notify,notifyAll,

wait,wait,wait

ConstructorDetail

UnavailableException

publicUnavailableException(Servletservlet,

java.lang.Stringmsg)

Deprecated.AsofJavaServletAPI2.2,useUnavailableException(String)instead.Parameters:

servlet-theServletinstancethatisunavailablemsg-aStringspecifyingthedescriptivemessage

UnavailableException

publicUnavailableException(intseconds,

Servletservlet,

java.lang.Stringmsg)

Deprecated.AsofJavaServletAPI2.2,useUnavailableException(String,int)instead.Parameters:

seconds-anintegerspecifyingthenumberofsecondstheservletexpectstobeunavailable;ifzeroornegative,indicatesthattheservletcan'tmakeanestimateservlet-theServletthatisunavailablemsg-aStringspecifyingthedescriptivemessage,whichcanbewrittentoalogfileordisplayedfortheuser.

UnavailableException

publicUnavailableException(java.lang.Stringmsg)

Page 336: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

Constructsanewexceptionwithadescriptivemessageindicatingthattheservletispermanentlyunavailable.Parameters:

msg-aStringspecifyingthedescriptivemessage

UnavailableException

publicUnavailableException(java.lang.Stringmsg,

intseconds)

Constructsanewexceptionwithadescriptivemessageindicatingthattheservletistemporarilyunavailableandgivinganestimateofhowlongitwillbeunavailable.

Insomecases,theservletcannotmakeanestimate.Forexample,theservletmightknowthataserveritneedsisnotrunning,butnotbeabletoreporthowlongitwilltaketoberestoredtofunctionality.Thiscanbeindicatedwithanegativeorzerovalueforthesecondsargument.

Parameters:msg-aStringspecifyingthedescriptivemessage,whichcanbewrittentoalogfileordisplayedfortheuser.seconds-anintegerspecifyingthenumberofsecondstheservletexpectstobeunavailable;ifzeroornegative,indicatesthattheservletcan'tmakeanestimate

MethodDetail

isPermanent

publicbooleanisPermanent()

Returnsabooleanindicatingwhethertheservletispermanentlyunavailable.Ifso,somethingiswrongwiththeservlet,andthesystemadministratormusttakesomecorrectiveaction.Returns:

trueiftheservletispermanentlyunavailable;falseiftheservletisavailableortemporarilyunavailable

Page 337: Java Servlet Development Kit 2.3 Documentation by F.Allimant · Notes La documentation ... fichiers, en particulier les documents PDF. 3. Occurrences multiples d'un mot-clef de l'index

getServlet

publicServletgetServlet()

Deprecated.AsofJavaServletAPI2.2,withnoreplacement.Returnstheservletthatisreportingitsunavailability.Returns:

theServletobjectthatisthrowingtheUnavailableException

getUnavailableSeconds

publicintgetUnavailableSeconds()

Returnsthenumberofsecondstheservletexpectstobetemporarilyunavailable.

Ifthismethodreturnsanegativenumber,theservletispermanentlyunavailableorcannotprovideanestimateofhowlongitwillbeunavailable.Noeffortismadetocorrectforthetimeelapsedsincetheexceptionwasfirstreported.

Returns:anintegerspecifyingthenumberofsecondstheservletwillbetemporarilyunavailable,oranegativenumberiftheservletispermanentlyunavailableorcannotmakeanestimate

Overview Package Class Tree Deprecated IndexHelpPREVCLASSNEXTCLASS FRAMESNOFRAMESSUMMARY:INNER|FIELD|CONSTR|METHOD DETAIL:FIELD|CONSTR|METHOD