You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ja...@brainna.com on 2002/02/05 16:45:59 UTC

Strange output stream behavior

Hi all,
I'm seeing something strange in the output stream from Jakarta.  Here's the
setup:
Jakarta 4.0.1 (from zip file)
Windows XP Professional
JDK 1.3.1_02 and jsdk1.4rc (makes no difference in the output)

Here's the code I'm using:

        res.setContentType("text/html");

        PrintWriter out = res.getWriter();

        out.println("<HTML>");
        out.println("<HEAD><TITLE>hello!</TITLE></HEAD>");
        out.println("<BODY><BIG>hello</BIG></BODY></HTML>");


and here's the output:
***********************************************************************************************
HTTP/1.1 200 OK
Content-Type: text/html
Date: Tue, 05 Feb 2002 14:44:37 GMT
Transfer-Encoding: chunked
Server: Apache Tomcat/4.0.1 (HTTP/1.1 Connector)

6
<HTML>
2


22
<HEAD><TITLE>hello!</TITLE></HEAD>
2


24
<BODY><BIG>hello</BIG></BODY></HTML>
2


0
**********************************************************************************************

It looks like every call to println() is putting characters before and
after.  This also happens with the write() and println() methods on the
servletoutputstream.  Is this correct?  The strangest thing is that IE
(6.0) displays the html correctly, and a view source has the extra numbers
stripped out.

I'm pulling my hair out trying to figure this one out, can anyone point me
in the correct direction?

Thanks!
-Jake


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Apache + Tomcat

Posted by Liam Holohan <li...@mail.smartframeworks.com>.
Gang Wu wrote:

> Hi,
> 
> I wonder where i can find doc for installing Apache as web sever and plug in
> Tomcat as servlet container only. Or Can anyone please give me a short
> headline about this issue.
> 
> regards
> Gang
> 
> 
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
> 

loads of docs available for installing apache and integrating tomcat..
easiest thing to do is ...


(Linux/unix version)
download apache src

apache_1.3.22.tar.Z  (a gzipped' tar ball of source code)

put the src somewhere on your machine and do a
gzip - d apache_1.3.22.tar.Z
tar xvf  apache_1.3.22.tar

I wrote a script to build it called "buildapache..." put it into the 
same directory as your unpacked apache and run it as root
(I'm building it into my own location (/home/wasp/modules/apache/1.3.22)

#!/bin/bash
./configure --prefix=/home/wasp/modules/apache/1.3.22 
--logfiledir=/home/wasp/modules/apache/1.3.22/logs --enable-module=most 
--enable-shared=max --enable-suexec
--suexec-logfile=/home/wasp/logs/suexec.log --suexec-umask=077
make
echo DONE
make install

This should get your apache server up

Then download tomcat and install
I downloaded the binary and unpacked it in /home/wasp/modules/tomcat/4.0/


you can integrate apache and tomcat with either jserv mod_jk or 
mod_webapp  (loads of documentation on the web about this stuff)

Search google for mod_webapp for example.  there is an article in the 
best pratices of sun website called "making tomcat work with apache"


hope this gets you started..

Liam :-)


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Apache + Tomcat

Posted by kuma <ku...@ntlworld.com>.
Hey i found this site very inspiring check it out , try server-side 
articles ,
http://www.devshed.com/

Best of luck

Chuckie & Out

Gang Wu wrote:

>Hi,
>
>I wonder where i can find doc for installing Apache as web sever and plug in
>Tomcat as servlet container only. Or Can anyone please give me a short
>headline about this issue.
>
>regards
>Gang
>
>
>--
>To unsubscribe:   <ma...@jakarta.apache.org>
>For additional commands: <ma...@jakarta.apache.org>
>Troubles with the list: <ma...@jakarta.apache.org>
>
>



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


RE: Apache + Tomcat

Posted by Daniel Thomas <da...@ntlworld.com>.
I wrote a doc on how to integrate them once. I am not sure how good it is, I
am not exactly a technical author, but it might be use full. It is based on
the a windows environment.

Hope it helps

Dan


Installing Tomcat and Apache on
The Application Server

Required files:

apache_1_3_14_win32_r2.exe	Apache Installation File
jakarta-tomcat-3.2.1.zip	Tomcat Installation File
mod_jk.dll	Allows Apache to work with Tomcat


Tomcat

Extract tomcat file to a directory on your Hard Disk. (<TOMCAT_HOME>)

Edit the tomcat.bat file (<TOMCAT_HOME>\bin\tomcat.bat)

Insert the line below into the ‘Save Environment Variables That May Change’
section:

Set JAVA_HOME = <the location of your JDK directory>


Edit the Server.xml file (<TOMCAT_HOME>\conf\server.xml)

Insert the lines below at the bottom of the file:
<Connector className="org.apache.tomcat.service.PoolTcpConnector">
<Parameter name="handler"
value="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/>
<Parameter name="port" value="8009"/>
</Connector>


Apache

Run the Apache Installation File and install to a directory of your choice.
Copy the mod_jk.dll file to à  \Apache group\Apache\Modules

Edit the httpd.conf file ( \Apache group\Apache\Conf\httpd.conf)

Insert the line below at the bottom of the file

Include <TOMCAT_HOME>/conf/mod_jk.conf-auto


Installing the Web site

Place the website files on the Hard Disk

File	Path
downloadBottom.html	/
downloadMain.html	/
downloadMiddle.html	/
downloadTop.html	/
index.html	/
xmldownloadBottom.html	/
xmldownloadmain.html	/
xmldownloadMiddle.html	/
xmldownloadTop.html	/
consoleSTUB_JRE.EXE	/download/stub
consoleSTUB_NJRE.EXE	/download/stub
ccfile.xml	/download/xmlfiles
appser.gif	/images
astub.gif	/images
bcraceclose.gif	/images
braceopen.gif	/images
btmain.gif	/images
collect.gif	/images
djre.gif	/images
dloadtop.gif	/images
dxml.gif	/images
instruction.gif	/images
jre.gif	/images
jreimg.gif	/images
linuxlogo.gif	/images
mslogo.gif	/images
sollogo.gif	/images
stubimg.gif	/images
ttlogo.gif	/images
ttName.gif	/images
VivianceLogo.gif	/images
vivilogo1.gif	/images
vivilogo2.gif	/images
vssver.scc	/images
xml.gif	/images
xmltop.gif	/images

Edit the httpd.conf file ( \Apache group\Apache\Conf\httpd.conf)

Alter line:
DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs"

To:
DocumentRoot "<location of the files above>"
-----Original Message-----
From: Gang Wu [mailto:gang.wu@tietoenator.com]
Sent: 06 February 2002 11:52
To: Tomcat Users List
Subject: Apache + Tomcat


Hi,

I wonder where i can find doc for installing Apache as web sever and plug in
Tomcat as servlet container only. Or Can anyone please give me a short
headline about this issue.

regards
Gang


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.306 / Virus Database: 166 - Release Date: 04/12/2001

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.306 / Virus Database: 166 - Release Date: 04/12/2001


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Apache + Tomcat

Posted by Gang Wu <ga...@tietoenator.com>.
Hi,

I wonder where i can find doc for installing Apache as web sever and plug in
Tomcat as servlet container only. Or Can anyone please give me a short
headline about this issue.

regards
Gang


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Strange output stream behavior

Posted by Volker Turau <tu...@pcsrv1.informatik.fh-wiesbaden.de>.
Hi,

that is correct behaviour, because Tomcat uses chunked transfer encoding.
The browser interpretes these extra characters and displays only the
content.


volker turau
FH Wiesbaden Fachbereich Informatik
Tel.: +49-611-9495-205 FAX +49-611-9495-210
http://www.informatik.fh-wiesbaden.de/~turau

On Tue, 5 Feb 2002 Jake.Dockter@brainna.com wrote:

> Hi all,
> I'm seeing something strange in the output stream from Jakarta.  Here's the
> setup:
> Jakarta 4.0.1 (from zip file)
> Windows XP Professional
> JDK 1.3.1_02 and jsdk1.4rc (makes no difference in the output)
>
> Here's the code I'm using:
>
>         res.setContentType("text/html");
>
>         PrintWriter out = res.getWriter();
>
>         out.println("<HTML>");
>         out.println("<HEAD><TITLE>hello!</TITLE></HEAD>");
>         out.println("<BODY><BIG>hello</BIG></BODY></HTML>");
>
>
> and here's the output:
> ***********************************************************************************************
> HTTP/1.1 200 OK
> Content-Type: text/html
> Date: Tue, 05 Feb 2002 14:44:37 GMT
> Transfer-Encoding: chunked
> Server: Apache Tomcat/4.0.1 (HTTP/1.1 Connector)
>
> 6
> <HTML>
> 2
>
>
> 22
> <HEAD><TITLE>hello!</TITLE></HEAD>
> 2
>
>
> 24
> <BODY><BIG>hello</BIG></BODY></HTML>
> 2
>
>
> 0
> **********************************************************************************************
>
> It looks like every call to println() is putting characters before and
> after.  This also happens with the write() and println() methods on the
> servletoutputstream.  Is this correct?  The strangest thing is that IE
> (6.0) displays the html correctly, and a view source has the extra numbers
> stripped out.
>
> I'm pulling my hair out trying to figure this one out, can anyone point me
> in the correct direction?
>
> Thanks!
> -Jake
>
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>