tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Parsons Technical Services" <parsonstechni...@earthlink.net>
Subject Re: Content type for jsp/html files
Date Tue, 24 Feb 2004 22:28:18 GMT
Johan,

If the purpose is just to see the code, then you can parse the stream and
replace each of the <> symbols with a substitute. This will cause the
browser to see everything as plain text.
Parse the stream. If character equals < then replace with &lt; If character
equals > then replace with &gt;

With this your code will display correctly on the screen.

Doug

----- Original Message ----- 
From: "Johan Wallinder" <walle@post.utfors.se>
To: <tomcat-user@jakarta.apache.org>
Sent: Tuesday, February 24, 2004 1:39 PM
Subject: Content type for jsp/html files


> Hi.
>
> I've want to make a servlet that can display the source of any jsp/html
> file (not the rendered one).
>
> Basically my code is like this:
>
> *set content type to text/plain
> *get PrintWriter object out
> *get the fileobject as an inputstream
> *write to the out object
> *flush/close
>
> The code is working fine, but viewing the servlet execution in a
> browser, the content type is set to text/html which means that all tags
> are not displayed (hidden).
>
> How can I override this behavior. If I read a text file everything works
> fine. But if the file begins with an <html> tag, the contenttype is set
> to text/html. Is this a browser problem?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message