Micael,

yeah, here's the code I've written that I believe to be applicable.  The
controlServlet (the first snippet) sets the contentType, gets the out and
writes to the writer, the output of the XSLT transformation.  This is done
by calling transformTOWriter (which is in a dff't class).  Note, that I have
provided the overridden version of this method as well so you can see how
the one applicable to the first snippet basically just aliases to the 3 arg
version of the mehtod.

This seems to work with most classes just not all.  :(

In regard to a couple of questions as to whether the contentLength was set
to 0 upon refreshing - na ... its this way the first time its called and
even if I do an explicit refresh.  The content comes out fine, displays
fine, but the lenght is still 0 and the contentType is not there.  FYI,
here's the tool I'm using to view this info:

http://www.searchengineworld.com/cgi-bin/sim_spider.cgi


<<<CODE REFERRED TO ABOVE>>>

//Preperare & publish
 response.setContentType("text/html");
 PrintWriter out = response.getWriter();
 XslTool xt = new XslTool();
 xt.transformToWriter(xml, xsl, out, xslParams);


   public void transformToWriter(Document xml, Transformer xsl, Writer out,
Hashtable parameters)
    throws TransformerException {
      if (parameters != null) {
         for (Enumeration e = parameters.keys() ; e.hasMoreElements() ;) {
            String key = (String)e.nextElement();
            xsl.setParameter(key, (String)parameters.get(key));
         }
      }
      transformToWriter(xml,xsl,out);
   }

   /** Transform specified DOM against specified transformed and out to a
writer. */
  public void transformToWriter(Document xml, Transformer xsl, Writer out)
    throws TransformerException {

        xsl.transform(new DOMSource(xml), new StreamResult(out));
   }

-----Original Message-----
From: micael [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 26, 2002 11:48 AM
To: Tomcat Users List
Subject: RE: Response.ContentType - not always setting contentType in
Header


Can you provide the relevant code from one that does not work and one that
does work?  Or, would you have to kill me if you did that?

At 11:35 AM 11/26/2002 -0800, you wrote:
>Definitive classes.  And I have (and still am) going through the XSLT and
>the page classses (the classes that the control servlet calls specific to
>the requested page) with a fine tooth comb.  The only thing that the 3
>problem pages seem to have in common that I have not yet eliminated is that
>they (a) read from the request header info, and (b) do a couple of
redirects
>if needed based upon that request header info.  But those conditions should
>not be applicable to a simple request and thus should not affect the
output.
>In fact, the status code is 200 (not 302 in the case of a redirect).  So
>then, I guess the only really difference that I'm seeing so far is that
they
>read from the request header.  but I can't imagine that this would make a
>difference.  :(
>
>Thanks.
>Neal
>
>-----Original Message-----
>From: micael [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, November 26, 2002 11:27 AM
>To: Tomcat Users List
>Subject: Re: Response.ContentType - not always setting contentType in
>Header
>
>
>Is it seemingly random or is it definitive classes Neal?
>
>At 11:17 AM 11/26/2002 -0800, you wrote:
> >Does anyone know of a reason why response.setContentType() would only
> >sometimes set my content type?
> >
> >I have a single control servlet which sets content type explicitly
> >
> >response.setContentType("text/html");
> >
> >just before it opens an outputStream and writes an XSLT transformation to
> >out.  For 70% of my pages the contentType is correct.  For 30% of them
>(even
> >the pages otherwise work perfectly fine) the header info is messed up.
>There
> >is no contentType specified and contentLenght is 0.  Very strange. In
these
> >pages (their control classes I do not do anything specific to the
response
> >object that is any different from the other pages.  In the XsLTs I
specify
> >output as HTML on all the pages.  Very confusing.
> >
> >Any thoughts as to why this might happen or how to correct it?  I think
it
> >may be causing me search engine indexing problems.
> >
> >Thanks.
> >Neal
> >
> >--
> >To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>Micael
>
>-------------------------------------------------------
>
>This electronic mail  transmission and any accompanying documents contain
>information belonging to the sender which may be confidential and legally
>privileged.  This information is intended only for the use of the
>individual or entity to whom this electronic mail transmission was sent as
>indicated above. If you are not the intended recipient, any disclosure,
>copying, distribution, or action taken in reliance on the contents of the
>information contained in this transmission is strictly prohibited.  If you
>have received this transmission in error, please delete the message.  Thank
>you
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

Micael

-------------------------------------------------------

This electronic mail  transmission and any accompanying documents contain
information belonging to the sender which may be confidential and legally
privileged.  This information is intended only for the use of the
individual or entity to whom this electronic mail transmission was sent as
indicated above. If you are not the intended recipient, any disclosure,
copying, distribution, or action taken in reliance on the contents of the
information contained in this transmission is strictly prohibited.  If you
have received this transmission in error, please delete the message.  Thank
you



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to