You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by tek1 <te...@pobox.com> on 2002/09/08 22:11:16 UTC
RE: anyone using filter to set content length of response?
i've attached the source files (created as a netbeans web module, so the
source and .class files appear in the same directory), as well as the .war file.
i d/led jboss3.0.2 (using jetty) today and dropped my .war file in the
deploy directory and my mobile client had no problem with the filter
setting the content length (i.e. the mobile client recognized the
response's content length).
it appears that the content length isn't being set properly in a filter in
tomcat (both4.0.4 and 4.1.10), and only appears to be happening with mobile
java clients (as web browsers have extra processing to determine the
content length even if it isn't explicity set by the servlet).
i will also try jrun and weblogic, just to see if the problem occurs in
those containers as well.
if you see a bug in my code, please let me know. the main code to check in
the .zip file is:
MyFilter.doFilter()
MyServlet.processRequest()
is there any way we can test if a filter in tomcat is correctly setting the
response's content length?
thanks.
At 23:34 02/08/22 -0400, you wrote:
>Stupid question time: is your filter being invoked? All the answers below
>ssem as if the filter is not running at all.
>
>can you post your filter and wrapper? I'm really just looking for how your
>filter and wrapper interact
>
>Charlie
>
> > -----Original Message-----
> > From: tek1 [mailto:tek1@pobox.com]
> > Sent: Friday, August 23, 2002 11:43 AM
> > To: Tomcat Users List
> > Subject: RE: anyone using filter to set content length of response?
> >
> >
> > At 11:04 02/08/23 -0400, you wrote:
> > >but are you setting it from your servlet, and then resetting
> > it in your
> > >filter?
> >
> > set CL in servlet? set CL in filter?
> > working?
> > --------------- ------------- -------
> > scenario1 no yes no
> > scenario2 yes yes
> > sort of
> >
> > i want to use scenario1, but it's not working.
> >
> > scenario2 works because the servlet is setting the content
> > length, but it's
> > not the correct length.
> >
> >
> >
> > > Or is the filter not called when the servlet sets the length?
> >
> > the filter is still called when the servlet set the length,
> > and the content
> > length that the java client sees if the length that the
> > servlet set, not
> > the length that the filter set.
> >
> >
> > >which is the case for the working scenario?
> > >request -> filter -> wrapper -> servlet -> setcontentLength ->
> > > return resp in wrapper -> filter -> return wrapped response
> > >unchanged
> > >--or--
> > >request -> servlet -> setcontentLength -> return response
> >
> > both work, but content length is wrong.
> >
> >
> > >Now which for the non-working scenario:
> > >request -> filter -> wrapper -> servlet -> setcontentLength ->
> > > return resp in wrapper -> filter -> set new content
> > length ->
> > > return wrapped response with more data
> >
> > works, but content length is wrong.
> >
> >
> > >--or--
> > >request -> filter -> wrapper -> servlet -> **do not set
> > content length** ->
> > > return resp in wrapper -> filter -> set new content
> > length ->
> > > return wrapped response with more data
> >
> > doesn't work (because servlet did not set content length).
> >
> >
> >
> > thanks....
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>