tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: Content-Type: text/vnd.wap.wml
Date Fri, 01 Dec 2000 18:34:08 GMT
guy wrote:

> I am running a servlet(on Tomcat 3.1beta) (that uses XT and an XSLT
> stylesheet to convert data to WML). When I try to affect the output
> header with
> response.setContentType("text,vnd.wap.xml"), my output contains:
> HTTP/1.0 200 OK
> Content-Type: text/vnd.wap.wml
> Content-Type: application/xml
>
> which doesn't work.
> (Is the XT servlet outputing its default content after my servlet
> outputs
> what I want?Or does Tomcat set it?)
> How do I get the desired results? ie. only:
>
> HTTP/1.0 200 OK
> Content-Type: text/vnd.wap.wml
>

That's actually pretty easy.  If you want

    Content-Type: text/vnd.wap.wml

then you should call

    response.setContentType("text/vnd.wap.xml");

instead of

    response.setContentType("text,vnd.wap.xml");

Note that, to be effective, you must call response.setContentType() *before*
your response has been commited (that is, before the first buffer is flushed).
I make sure this happens in my code by setting the content type before calling
response.getWriter().

Also, you really should update to Tomcat 3.2 -- there have been huge numbers of
bug fixes (plus better performance to boot).


>
> Thanks
> Guy
>

Craig McClanahan

Mime
View raw message