Re: [Simpleweb-Support] committing in 4.0.2
Brought to you by:
niallg
From: Aleksandar C. <yop...@ya...> - 2008-09-16 15:12:06
|
It was really fast, thank you, Well, I tried once more and... When I remove resp.commit() from this code: if(req.getMethod().equals("HEAD") || code==204 || code==304){ resp.setContentLength(0); resp.commit(); resp.close(); return; } my browser is just waiting for response. --- On Tue, 9/16/08, Niall Gallagher <gal...@ya...> wrote: From: Niall Gallagher <gal...@ya...> Subject: Re: [Simpleweb-Support] committing in 4.0.2 To: Sim...@li..., yop...@ya... Date: Tuesday, September 16, 2008, 10:21 PM Hi, For most cases its best to ignore commit. The commit method basically commits the HTTP header. It does not send anything. The best thing to do is just use the close() method. Either in the output stream or the response. This is sufficient. There are very few instances when commit is needed. Its typically used when you want to forward the response to another service and you don't want that service to modify the header. Niall --- On Tue, 9/16/08, Aleksandar Cvijovic <yop...@ya...> wrote: > From: Aleksandar Cvijovic <yop...@ya...> > Subject: [Simpleweb-Support] committing in 4.0.2 > To: Sim...@li... > Date: Tuesday, September 16, 2008, 2:14 PM > Hi, > > I switched to new version and... > > Earlier all worked well with commit() when OutputStream is > not used at all (content length 0), but now both methods > must be called (resp.commit(); resp.close();). > Is it bug or normal behavior? > > >From documentation: > "It is important to note that the Response controls > the processing of the HTTP pipeline. The next HTTP request > is > not processed until the response has committed. The > response is > committed once the commit method is invoked if there > is NO content body. Committing with a content body is done > only if > correct content is given. The OutputStream acts as > a client and commits the response once the specified > content has > been written to the issued OutputStream." > > > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK > & win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support |