You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by guy <gu...@polylab.sfu.ca> on 2000/12/01 05:33:33 UTC

Content-Type: text/vnd.wap.wml

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

Thanks
Guy

PS I found similar questions in the archives but I am not exactly sure
how to solve the problem :)


Re: Content-Type: text/vnd.wap.wml

Posted by guy <gu...@polylab.sfu.ca>.
Sorry for the typo, I actually have
response.setContentType("text/vnd.wap.xml");  in my code.
I put it right after the doGet but I get the output shown below with two
Content-Types.?
I would like to upgrade to Tomcat 3.2 but my 'root user' is not available for some
time. Perhaps that would solve the problem?

Thanks for your help
Guy

"Craig R. McClanahan" wrote:

> 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


Re: Content-Type: text/vnd.wap.wml

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
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