From: Eoghan G. <eg...@re...> - 2010-07-06 07:56:06
|
Actually, I tell a lie, the response was: HTTP/1.1 204 No Content Content-Length: 0 Server: Jetty(6.1.23) (I tested against the wrong version). So the zero Content-Length, if explicitly set, is indeed sent by Jetty. Can you try that WebAppException-throwing approach with tjws. Cheers, Eoghan ----- "Eoghan Glynn" <eg...@re...> wrote: > ----- "Darius Bohni" <d....@gm...> wrote: > > > Hi, > > > > I can't actually test inside Tomcat or JBoss. The application musst > > run standalone. Are there other embedded web servers for resteasy? > > > You could try Jetty. > > > > can u explain me how to set the content-length inside a void > method, > > or should i use a response object? > > One simple way of avoid having to change your void method's signature > would be to simply throw a WebApplicationException wrapping a > Response, e.g.: > > throw new > WebApplicationException(Response.status(Status.NO_CONTENT) > > .header(HttpHeaders.CONTENT_LENGTH, "0") > .build()); > > I just tried that on Jetty with a DELETE operation and the response > was simply: > > HTTP/1.1 204 No Content > Server: Jetty(6.1.23) > > i.e. it used neither chunking, nor considered the zero content-length > necessary, presumably because that's already implicit in the > NO_CONTENT status (which obviously by definition is required to have > an empty message body). > > /Eoghan > > > On Mon, Jul 5, 2010 at 4:14 PM, Eoghan Glynn < eg...@re... > > > wrote: > > > > > > > > A-ha, sorry, I mis-read your original question. > > > > Does this only occur when your webapp is deployed via tjws, or have > > you seen the same thing on Tomcat, JBoss etc.? > > > > Have you tried explicitly setting the content-length header to zero > to > > see if that turns off the questionable chunked encoding for the > empty > > response? > > > > Cheers, > > Eoghan > > > > > > > > > > ----- "Darius Bohni" < d....@gm... > wrote: > > > > > Hi Eoghan, > > > > > > Thank you for your answer. Yes the response is chunked. Here is > the > > > Raw-Response: > > > > > > *****START***** > > > HTTP/1.1 204 No content > > > connection: keep-alive > > > date: Mon, 05 Jul 2010 14:00:29 GMT > > > keep-alive: timeout=30, max=100 > > > server: Rogatkin's JWS based on Acme.Serve/Version 1.33, > $Revision: > > > 1.163 $ > > > mime-version: 1.0 > > > transfer-encoding: chunked > > > > > > *****END***** > > > > > > There is no ending 0 :-(. Is this a problem when i build an > > > application (php, perl, asp or some other java lib) which calls > this > > > method and then reads other content? Because firefox and fiddler > > canot > > > read the second response :-/. > > > > > > regards, > > > > > > > > > > > > > > > On Mon, Jul 5, 2010 at 11:49 AM, Eoghan Glynn < eg...@re... > > > > > wrote: > > > > > > > > > > > > Hi Darius, > > > > > > Is the response chunked? i.e. is the "Transfer-Encoding: chunked" > > > header > > > set in the response? > > > > > > If so, the 0 is simply the final chunk indicator, i.e. a chunk > size > > of > > > a > > > zero is interpreted as the end of the chunk stream. > > > > > > Its questionable as to whether a zero-length body should ever be > > > chunked, but AFAIK its legal from a protocol point of view. > > > > > > Cheers, > > > Eoghan > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers |