cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurent Perez <>
Subject Re: Where do you access HttpResponse from ?
Date Wed, 21 Sep 2005 21:52:47 GMT
> so you want to execute biz logic depending on the total size of the http
> response ...

yep, exactly : I'm delivering content to poor browsers which, for
example, will not accept more than 50KB from the http response, the
biz logic is nothing too fancy, it only logs warnings about response
being too rich.

> I don't think it is possible to retrieve response headers using the
> servlet API - however check the api docs to be sure.

well, there is org.apache.cocoon.environment.http.HttpResponse which
implements the Response interface, and offers int getBufferSize() and
ServletOutputStream getOutputStream(). getBufferSize() sounds good,
however it's not documented in 2.1.7 javadocs :/

Or I could tell the Cocoon servlet itself to write into a, then do a size() to get the content
length, process my logic, then use
writeTo(HttpResponse.getOutputStream) to deliver the stream to the
client, however this sounds overkill.

what I miss is : can I access
org.apache.cocoon.environment.http.HttpResponse from a "proper" place,
or should I have to hack its source directly ? Because this class uses
setContentLength(), I could probably fit my logic call in this method.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message