Re: Servlet --> File --> Web-browser

2001-05-02 Thread alan leung

can any one helps me out?
thanks again.

--- alan leung <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a servlet reads a file from FileInputStream
> and
> copy those bytes to ServletOutputStream and send
> back
> to web browser.
> 
> But if user click CANCEL while downloading in
> netscape. i will get an exception in doGet method.
> -->
> IOException in doGet(): java.net.SocketException:
> Connection aborted by peer: socket write error
> 
> if user click CANCEL in IE (Internet Explorer). i
> didn't get any exception print out.
> 
> Both cases is browser connect to servlet engine
> directly (tomcat)
> 
> if browser connects to apache server --> then
> tomcat;
> no exception got caught for netscape and IE if user
> click CANCEL while download. 
> 
> What i think is clicking CANCEL while downloading a
> file would lost the TCP connection without ending
> it.
> which would always rise an IOException right?  Why
> if
> i use apache server w/ tomcat or IE connect to
> tomcat
> directly won't cause IOException in doGet() method?
> 
> thanks.
> 
> 
> 
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great
> prices
> http://auctions.yahoo.com/


__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



Re: Servlet --> File --> Web-browser

2001-05-03 Thread alan leung

can any one helps me out?
thanks again.

--- alan leung <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a servlet reads a file from FileInputStream
> and
> copy those bytes to ServletOutputStream and send
> back
> to web browser.
> 
> But if user click CANCEL while downloading in
> netscape. i will get an exception in doGet method.
> -->
> IOException in doGet(): java.net.SocketException:
> Connection aborted by peer: socket write error
> 
> if user click CANCEL in IE (Internet Explorer). i
> didn't get any exception print out.
> 
> Both cases is browser connect to servlet engine
> directly (tomcat)
> 
> if browser connects to apache server --> then
> tomcat;
> no exception got caught for netscape and IE if user
> click CANCEL while download. 
> 
> What i think is clicking CANCEL while downloading a
> file would lost the TCP connection without ending
> it.
> which would always rise an IOException right?  Why
> if
> i use apache server w/ tomcat or IE connect to
> tomcat
> directly won't cause IOException in doGet() method?
> 
> thanks.
> 
> 
> 
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great
> prices
> http://auctions.yahoo.com/


__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



RE: Servlet --> File --> Web-browser

2001-05-03 Thread William Kaufman

I didn't answer, because I'd hoped someone could say for sure.  But my own
guesses are:

1) The "Cancel" button in IE doesn't actually do anything once the data
starts streaming.  I've suspected this was the case, and it sounds like
you've got evidence.

2) Apache is buffering the response somehow: directly connected to Netscape,
you get an immediate exception when writing to a closed stream; but, with
Apache in the middle, the writes don't happen immediately, and no exception
is propagated to the servlet.

My only advice would be to flush your servlet output early and often: you
might (or might not) get an exception immediately.

-- Bill K.


> -Original Message-
> From: alan leung [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 03, 2001 10:43 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Servlet --> File --> Web-browser
> 
> 
> can any one helps me out?
> thanks again.
> 
> --- alan leung <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I have a servlet reads a file from FileInputStream
> > and
> > copy those bytes to ServletOutputStream and send
> > back
> > to web browser.
> > 
> > But if user click CANCEL while downloading in
> > netscape. i will get an exception in doGet method.
> > -->
> > IOException in doGet(): java.net.SocketException:
> > Connection aborted by peer: socket write error
> > 
> > if user click CANCEL in IE (Internet Explorer). i
> > didn't get any exception print out.
> > 
> > Both cases is browser connect to servlet engine
> > directly (tomcat)
> > 
> > if browser connects to apache server --> then
> > tomcat;
> > no exception got caught for netscape and IE if user
> > click CANCEL while download. 
> > 
> > What i think is clicking CANCEL while downloading a
> > file would lost the TCP connection without ending
> > it.
> > which would always rise an IOException right?  Why
> > if
> > i use apache server w/ tomcat or IE connect to
> > tomcat
> > directly won't cause IOException in doGet() method?
> > 
> > thanks.
> > 
> > 
> > 
> > __
> > Do You Yahoo!?
> > Yahoo! Auctions - buy the things you want at great
> > prices
> > http://auctions.yahoo.com/
> 
> 
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
> 



RE: Servlet --> File --> Web-browser

2001-05-03 Thread Jay Burgess

I agree with your (2) statement below, at least if Apache is running on 
Windows.  Flushing doesn't really help, as there is a specific issue with 
buffering in Apache on Windows.  We had to introduce a patch to 
HTTP_PROTOCOL.C that someone posted in a newsgroup to solve the 
problem.  It's comment pretty much summarizes the details:

/*
  * WIN32 pipes will ALWAYS block until data arrives,
  * therefore the ap_bread() will NEVER return 0,
  * therefore we will never flush r->connection->client,
  * therefore the client will only get data when we have
  * pushed in enough to write to the socket (IOBUFSIZE
  * probably) or the script finishes,
  * therefore server push does not work.
  * Work around this by always flushing before a read.
  * This is probably quite inefficient in some cases.
  */
if (ap_bflush(r->connection->client) < 0) {
 ap_log_rerror(APLOG_MARK, APLOG_INFO, r,
 "client stopped connection before send body completed");
 ap_bsetflag(r->connection->client, B_EOUT, 1);
 r->connection->aborted = 1;
 break;
}

If you can't find the details of this patch, let me know and I'll send you 
a copy of the file.  Unfortunately, though, it means you'll have to set up 
a build environment for Windows (which is something we didn't have to do 
before).

Jay

-Original Message-
From: William Kaufman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 5:00 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Servlet --> File --> Web-browser


I didn't answer, because I'd hoped someone could say for sure.  But my own
guesses are:

1) The "Cancel" button in IE doesn't actually do anything once the data
starts streaming.  I've suspected this was the case, and it sounds like
you've got evidence.

2) Apache is buffering the response somehow: directly connected to Netscape,
you get an immediate exception when writing to a closed stream; but, with
Apache in the middle, the writes don't happen immediately, and no exception
is propagated to the servlet.

My only advice would be to flush your servlet output early and often: you
might (or might not) get an exception immediately.

 -- Bill K.


 > -Original Message-
 > From: alan leung [mailto:[EMAIL PROTECTED]]
 > Sent: Thursday, May 03, 2001 10:43 AM
 > To: [EMAIL PROTECTED]
 > Subject: Re: Servlet --> File --> Web-browser
 >
 >
 > can any one helps me out?
 > thanks again.
 >
 > --- alan leung <[EMAIL PROTECTED]> wrote:
 > > Hi,
 > > I have a servlet reads a file from FileInputStream
 > > and
 > > copy those bytes to ServletOutputStream and send
 > > back
 > > to web browser.
 > >
 > > But if user click CANCEL while downloading in
 > > netscape. i will get an exception in doGet method.
 > > -->
 > > IOException in doGet(): java.net.SocketException:
 > > Connection aborted by peer: socket write error
 > >
 > > if user click CANCEL in IE (Internet Explorer). i
 > > didn't get any exception print out.
 > >
 > > Both cases is browser connect to servlet engine
 > > directly (tomcat)
 > >
 > > if browser connects to apache server --> then
 > > tomcat;
 > > no exception got caught for netscape and IE if user
 > > click CANCEL while download.
 > >
 > > What i think is clicking CANCEL while downloading a
 > > file would lost the TCP connection without ending
 > > it.
 > > which would always rise an IOException right?  Why
 > > if
 > > i use apache server w/ tomcat or IE connect to
 > > tomcat
 > > directly won't cause IOException in doGet() method?
 > >
 > > thanks.
 > >

-- Jay Burgess
Delano Technology Corporation
mailto:[EMAIL PROTECTED]
(913) 438-9444 x154




RE: Servlet --> File --> Web-browser

2001-05-03 Thread tim leung

Thanks.
I found that even user click cancel in NETSCAPE. With
apache in the middle servlet will continue send the
"WHOLE" file to apache.

In IE, if user click cancel, strange thing would
happen ( both connection to tomcat directly or apache
in middle ) :

-  No exception caught in servlet 
-  But it looks like my servlet never exits the
doGet() method after clicking cancel in IE. 
-  It looks like when clicking cancel, TCP connection
still alive.
-  I put a println() in the end of the doGet() but it
never get print out. It seems servlet "BLOCKS" forever
in the out.write(int) method of the OutputStream.

Any reason cause servlet didn't exit doGet() method? I
think if doGet() didn't returns, the thread is still
running, right? resource (memory / thread) will not be
free up.

P.S.
I am using 
tomcat 3.2.1
apache 1.3.17

thanks.


--- William Kaufman <[EMAIL PROTECTED]> wrote:
> I didn't answer, because I'd hoped someone could say
> for sure.  But my own
> guesses are:
> 
> 1) The "Cancel" button in IE doesn't actually do
> anything once the data
> starts streaming.  I've suspected this was the case,
> and it sounds like
> you've got evidence.
> 
> 2) Apache is buffering the response somehow:
> directly connected to Netscape,
> you get an immediate exception when writing to a
> closed stream; but, with
> Apache in the middle, the writes don't happen
> immediately, and no exception
> is propagated to the servlet.
> 
> My only advice would be to flush your servlet output
> early and often: you
> might (or might not) get an exception immediately.
> 
> 
>-- Bill K.
> 
> 
> > -Original Message-----
> > From: alan leung [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 03, 2001 10:43 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Servlet --> File --> Web-browser
> > 
> > 
> > can any one helps me out?
> > thanks again.
> > 
> > --- alan leung <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > > I have a servlet reads a file from
> FileInputStream
> > > and
> > > copy those bytes to ServletOutputStream and send
> > > back
> > > to web browser.
> > > 
> > > But if user click CANCEL while downloading in
> > > netscape. i will get an exception in doGet
> method.
> > > -->
> > > IOException in doGet():
> java.net.SocketException:
> > > Connection aborted by peer: socket write error
> > > 
> > > if user click CANCEL in IE (Internet Explorer).
> i
> > > didn't get any exception print out.
> > > 
> > > Both cases is browser connect to servlet engine
> > > directly (tomcat)
> > > 
> > > if browser connects to apache server --> then
> > > tomcat;
> > > no exception got caught for netscape and IE if
> user
> > > click CANCEL while download. 
> > > 
> > > What i think is clicking CANCEL while
> downloading a
> > > file would lost the TCP connection without
> ending
> > > it.
> > > which would always rise an IOException right? 
> Why
> > > if
> > > i use apache server w/ tomcat or IE connect to
> > > tomcat
> > > directly won't cause IOException in doGet()
> method?
> > > 
> > > thanks.
> > > 
> > > 
> > > 
> > >
> __
> > > Do You Yahoo!?
> > > Yahoo! Auctions - buy the things you want at
> great
> > > prices
> > > http://auctions.yahoo.com/
> > 
> > 
> > __
> > Do You Yahoo!?
> > Yahoo! Auctions - buy the things you want at great
> prices
> > http://auctions.yahoo.com/
> > 



__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



RE: Servlet --> File --> Web-browser

2001-05-03 Thread William Kaufman

> Any reason cause servlet didn't exit doGet() method? I
> think if doGet() didn't returns, the thread is still
> running, right?

Probably, yes.  You might be getting an unexpected RuntimeException or
Error, though, which bypasses whatever you do to test for exting doGet().

You can also try hitting the "break" key (it's Control+Break in Windows, and
I think it's Control+Y in Unix) in the window that's running Tomcat: that
will show you the state of all the running threads.


-- Bill K.


> -Original Message-
> From: tim leung [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 03, 2001 3:44 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Servlet --> File --> Web-browser
> 
> 
> Thanks.
> I found that even user click cancel in NETSCAPE. With
> apache in the middle servlet will continue send the
> "WHOLE" file to apache.
> 
> In IE, if user click cancel, strange thing would
> happen ( both connection to tomcat directly or apache
> in middle ) :
> 
> -  No exception caught in servlet 
> -  But it looks like my servlet never exits the
> doGet() method after clicking cancel in IE. 
> -  It looks like when clicking cancel, TCP connection
> still alive.
> -  I put a println() in the end of the doGet() but it
> never get print out. It seems servlet "BLOCKS" forever
> in the out.write(int) method of the OutputStream.
> 
> Any reason cause servlet didn't exit doGet() method? I
> think if doGet() didn't returns, the thread is still
> running, right? resource (memory / thread) will not be
> free up.
> 
> P.S.
> I am using 
> tomcat 3.2.1
> apache 1.3.17
> 
> thanks.
> 
> 
> --- William Kaufman <[EMAIL PROTECTED]> wrote:
> > I didn't answer, because I'd hoped someone could say
> > for sure.  But my own
> > guesses are:
> > 
> > 1) The "Cancel" button in IE doesn't actually do
> > anything once the data
> > starts streaming.  I've suspected this was the case,
> > and it sounds like
> > you've got evidence.
> > 
> > 2) Apache is buffering the response somehow:
> > directly connected to Netscape,
> > you get an immediate exception when writing to a
> > closed stream; but, with
> > Apache in the middle, the writes don't happen
> > immediately, and no exception
> > is propagated to the servlet.
> > 
> > My only advice would be to flush your servlet output
> > early and often: you
> > might (or might not) get an exception immediately.
> > 
> > 
> >-- Bill K.
> > 
> > 
> > > -Original Message-
> > > From: alan leung [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, May 03, 2001 10:43 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: Servlet --> File --> Web-browser
> > > 
> > > 
> > > can any one helps me out?
> > > thanks again.
> > > 
> > > --- alan leung <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> > > > I have a servlet reads a file from
> > FileInputStream
> > > > and
> > > > copy those bytes to ServletOutputStream and send
> > > > back
> > > > to web browser.
> > > > 
> > > > But if user click CANCEL while downloading in
> > > > netscape. i will get an exception in doGet
> > method.
> > > > -->
> > > > IOException in doGet():
> > java.net.SocketException:
> > > > Connection aborted by peer: socket write error
> > > > 
> > > > if user click CANCEL in IE (Internet Explorer).
> > i
> > > > didn't get any exception print out.
> > > > 
> > > > Both cases is browser connect to servlet engine
> > > > directly (tomcat)
> > > > 
> > > > if browser connects to apache server --> then
> > > > tomcat;
> > > > no exception got caught for netscape and IE if
> > user
> > > > click CANCEL while download. 
> > > > 
> > > > What i think is clicking CANCEL while
> > downloading a
> > > > file would lost the TCP connection without
> > ending
> > > > it.
> > > > which would always rise an IOException right? 
> > Why
> > > > if
> > > > i use apache server w/ tomcat or IE connect to
> > > > tomcat
> > > > directly won't cause IOException in doGet()
> > method?
> > > > 
> > > > thanks.
> > > > 
> > > > 
> > > > 
> > > >
> > __
> > > > Do You Yahoo!?
> > > > Yahoo! Auctions - buy the things you want at
> > great
> > > > prices
> > > > http://auctions.yahoo.com/
> > > 
> > > 
> > > __
> > > Do You Yahoo!?
> > > Yahoo! Auctions - buy the things you want at great
> > prices
> > > http://auctions.yahoo.com/
> > > 
> 
> 
> 
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
> 



RE: Servlet --> File --> Web-browser

2001-05-03 Thread tim leung

Thanks your input.
i had try Control+break in tomcat window. Is this
option only avaliable in tomcat window? can i use it
in other java application running window?

After i click cancel while download from IE. i hit
control+break. and it shows 1 of the running thread
has exception. 

Would that means that thread will be in running state
forever and will never die (never release resource)?
Why this exception didn't print out on screen?  need
Crt+Break instead.  

the following is part of the exception:
"Thread-22" prio=5 tid=0x8def7a8 nid=0x2fc runnable
[0x987f000..0x987fdc4]
at
java.net.SocketOutputStream.socketWrite(Native Method)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:83)
at
org.apache.tomcat.service.http.HttpResponseAdapter.doWrite(HttpResponseAdapter.java:162)
at 

...etc

thanks.


--- William Kaufman <[EMAIL PROTECTED]> wrote:
> > Any reason cause servlet didn't exit doGet()
> method? I
> > think if doGet() didn't returns, the thread is
> still
> > running, right?
> 
> Probably, yes.  You might be getting an unexpected
> RuntimeException or
> Error, though, which bypasses whatever you do to
> test for exting doGet().
> 
> You can also try hitting the "break" key (it's
> Control+Break in Windows, and
> I think it's Control+Y in Unix) in the window that's
> running Tomcat: that
> will show you the state of all the running threads.
> 
> 
> 
>-- Bill K.
> 
> 
> > -Original Message-
> > From: tim leung [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 03, 2001 3:44 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: Servlet --> File --> Web-browser
> > 
> > 
> > Thanks.
> > I found that even user click cancel in NETSCAPE.
> With
> > apache in the middle servlet will continue send
> the
> > "WHOLE" file to apache.
> > 
> > In IE, if user click cancel, strange thing would
> > happen ( both connection to tomcat directly or
> apache
> > in middle ) :
> > 
> > -  No exception caught in servlet 
> > -  But it looks like my servlet never exits the
> > doGet() method after clicking cancel in IE. 
> > -  It looks like when clicking cancel, TCP
> connection
> > still alive.
> > -  I put a println() in the end of the doGet() but
> it
> > never get print out. It seems servlet "BLOCKS"
> forever
> > in the out.write(int) method of the OutputStream.
> > 
> > Any reason cause servlet didn't exit doGet()
> method? I
> > think if doGet() didn't returns, the thread is
> still
> > running, right? resource (memory / thread) will
> not be
> > free up.
> > 
> > P.S.
> > I am using 
> > tomcat 3.2.1
> > apache 1.3.17
> > 
> > thanks.
> > 
> > 
> > --- William Kaufman <[EMAIL PROTECTED]> wrote:
> > > I didn't answer, because I'd hoped someone could
> say
> > > for sure.  But my own
> > > guesses are:
> > > 
> > > 1) The "Cancel" button in IE doesn't actually do
> > > anything once the data
> > > starts streaming.  I've suspected this was the
> case,
> > > and it sounds like
> > > you've got evidence.
> > > 
> > > 2) Apache is buffering the response somehow:
> > > directly connected to Netscape,
> > > you get an immediate exception when writing to a
> > > closed stream; but, with
> > > Apache in the middle, the writes don't happen
> > > immediately, and no exception
> > > is propagated to the servlet.
> > > 
> > > My only advice would be to flush your servlet
> output
> > > early and often: you
> > > might (or might not) get an exception
> immediately.
> > > 
> > > 
>
> > >-- Bill K.
> > > 
> > > 
> > > > -Original Message-
> > > > From: alan leung [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, May 03, 2001 10:43 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: Servlet --> File --> Web-browser
> > > > 
> > > > 
> > > > can any one helps me out?
> > > > thanks again.
> > > > 
> > > > --- alan leung <[EMAIL PROTECTED]> wrote:
> > > > > Hi,
> > > > > I have a servlet reads a file from
> > > FileInputStream
> > > > > and
> >

RE: Servlet --> File --> Web-browser

2001-05-03 Thread William Kaufman

> i had try Control+break in tomcat window. Is this
> option only avaliable in tomcat window? can i use it
> in other java application running window?

It'll work in any Java application.

> After i click cancel while download from IE. i hit
> control+break. and it shows 1 of the running thread
> has exception. 

It's not actually an exception--it just looks like one.  It dumps the stacks
for all the running threads.  So, for the stack you show, it just tells you
that that thread is hung while writing to a socket--pretty much what you
expected.

-- Bill K.


> -Original Message-
> From: tim leung [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 03, 2001 4:44 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Servlet --> File --> Web-browser
> 
> 
> Thanks your input.
> i had try Control+break in tomcat window. Is this
> option only avaliable in tomcat window? can i use it
> in other java application running window?
> 
> After i click cancel while download from IE. i hit
> control+break. and it shows 1 of the running thread
> has exception. 
> 
> Would that means that thread will be in running state
> forever and will never die (never release resource)?
> Why this exception didn't print out on screen?  need
> Crt+Break instead.  
> 
> the following is part of the exception:
> "Thread-22" prio=5 tid=0x8def7a8 nid=0x2fc runnable
> [0x987f000..0x987fdc4]
> at
> java.net.SocketOutputStream.socketWrite(Native Method)
> at
> java.net.SocketOutputStream.write(SocketOutputStream.java:83)
> at
> org.apache.tomcat.service.http.HttpResponseAdapter.doWrite(Htt
> pResponseAdapter.java:162)
> at 
> 
> ...etc
> 
> thanks.
> 
> 
> --- William Kaufman <[EMAIL PROTECTED]> wrote:
> > > Any reason cause servlet didn't exit doGet()
> > method? I
> > > think if doGet() didn't returns, the thread is
> > still
> > > running, right?
> > 
> > Probably, yes.  You might be getting an unexpected
> > RuntimeException or
> > Error, though, which bypasses whatever you do to
> > test for exting doGet().
> > 
> > You can also try hitting the "break" key (it's
> > Control+Break in Windows, and
> > I think it's Control+Y in Unix) in the window that's
> > running Tomcat: that
> > will show you the state of all the running threads.
> > 
> > 
> > 
> >-- Bill K.
> > 
> > 
> > > -Original Message-
> > > From: tim leung [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, May 03, 2001 3:44 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: RE: Servlet --> File --> Web-browser
> > > 
> > > 
> > > Thanks.
> > > I found that even user click cancel in NETSCAPE.
> > With
> > > apache in the middle servlet will continue send
> > the
> > > "WHOLE" file to apache.
> > > 
> > > In IE, if user click cancel, strange thing would
> > > happen ( both connection to tomcat directly or
> > apache
> > > in middle ) :
> > > 
> > > -  No exception caught in servlet 
> > > -  But it looks like my servlet never exits the
> > > doGet() method after clicking cancel in IE. 
> > > -  It looks like when clicking cancel, TCP
> > connection
> > > still alive.
> > > -  I put a println() in the end of the doGet() but
> > it
> > > never get print out. It seems servlet "BLOCKS"
> > forever
> > > in the out.write(int) method of the OutputStream.
> > > 
> > > Any reason cause servlet didn't exit doGet()
> > method? I
> > > think if doGet() didn't returns, the thread is
> > still
> > > running, right? resource (memory / thread) will
> > not be
> > > free up.
> > > 
> > > P.S.
> > > I am using 
> > > tomcat 3.2.1
> > > apache 1.3.17
> > > 
> > > thanks.
> > > 
> > > 
> > > --- William Kaufman <[EMAIL PROTECTED]> wrote:
> > > > I didn't answer, because I'd hoped someone could
> > say
> > > > for sure.  But my own
> > > > guesses are:
> > > > 
> > > > 1) The "Cancel" button in IE doesn't actually do
> > > > anything once the data
> > > > starts streaming.  I've suspected this was the
> > case,
> > > > and 

RE: Servlet --> File --> Web-browser

2001-05-03 Thread tim leung

yup, you are right william.

it's not really exception. it's thread's running state
at the time i push Crt+Break. 

One thing i have been stuck for 1/2 month is that :

why the thread still running when i click canel on IE?
click cancel in IE (i think) would close the TCP
connection. servlet would konw that in the socket
immediately ( this is the case in netscape). and
caught an exception.

I suspect IE still keeps the TCP connection even after
user click cancel. (that's bit strange idea).  but
what else can keep the thread in servlet keep running
if the socket is closed?  the thread didn't dies if i
make another request, it's still there.

I am using JBuilder and i think the thread panel is
same as the option Ctrl+Break.  

thanks.





--- William Kaufman <[EMAIL PROTECTED]> wrote:
> > i had try Control+break in tomcat window. Is this
> > option only avaliable in tomcat window? can i use
> it
> > in other java application running window?
> 
> It'll work in any Java application.
> 
> > After i click cancel while download from IE. i hit
> > control+break. and it shows 1 of the running
> thread
> > has exception. 
> 
> It's not actually an exception--it just looks like
> one.  It dumps the stacks
> for all the running threads.  So, for the stack you
> show, it just tells you
> that that thread is hung while writing to a
> socket--pretty much what you
> expected.
> 
> 
>-- Bill K.
> 
> 
> > -Original Message-----
> > From: tim leung [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 03, 2001 4:44 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: Servlet --> File --> Web-browser
> > 
> > 
> > Thanks your input.
> > i had try Control+break in tomcat window. Is this
> > option only avaliable in tomcat window? can i use
> it
> > in other java application running window?
> > 
> > After i click cancel while download from IE. i hit
> > control+break. and it shows 1 of the running
> thread
> > has exception. 
> > 
> > Would that means that thread will be in running
> state
> > forever and will never die (never release
> resource)?
> > Why this exception didn't print out on screen? 
> need
> > Crt+Break instead.  
> > 
> > the following is part of the exception:
> > "Thread-22" prio=5 tid=0x8def7a8 nid=0x2fc
> runnable
> > [0x987f000..0x987fdc4]
> > at
> > java.net.SocketOutputStream.socketWrite(Native
> Method)
> > at
> >
>
java.net.SocketOutputStream.write(SocketOutputStream.java:83)
> > at
> >
>
org.apache.tomcat.service.http.HttpResponseAdapter.doWrite(Htt
> > pResponseAdapter.java:162)
> > at 
> > 
> > ...etc
> > 
> > thanks.
> > 
> > 
> > --- William Kaufman <[EMAIL PROTECTED]> wrote:
> > > > Any reason cause servlet didn't exit doGet()
> > > method? I
> > > > think if doGet() didn't returns, the thread is
> > > still
> > > > running, right?
> > > 
> > > Probably, yes.  You might be getting an
> unexpected
> > > RuntimeException or
> > > Error, though, which bypasses whatever you do to
> > > test for exting doGet().
> > > 
> > > You can also try hitting the "break" key (it's
> > > Control+Break in Windows, and
> > > I think it's Control+Y in Unix) in the window
> that's
> > > running Tomcat: that
> > > will show you the state of all the running
> threads.
> > > 
> > > 
> > > 
>
> > >-- Bill K.
> > > 
> > > 
> > > > -Original Message-
> > > > From: tim leung [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, May 03, 2001 3:44 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: RE: Servlet --> File --> Web-browser
> > > > 
> > > > 
> > > > Thanks.
> > > > I found that even user click cancel in
> NETSCAPE.
> > > With
> > > > apache in the middle servlet will continue
> send
> > > the
> > > > "WHOLE" file to apache.
> > > > 
> > > > In IE, if user click cancel, strange thing
> would
> > > > happen ( both connection to tomcat directly or
> > > apache
> > > > in middle ) :
> > > > 
> > > > -  No exception caught in servlet 
> &g

Re: Servlet --> File --> Web-browser

2001-05-03 Thread Steve Brunton

On Thu, May 03, 2001, Purple Mutants made tim leung write:
> yup, you are right william.
> 
> it's not really exception. it's thread's running state
> at the time i push Crt+Break. 
> 
> One thing i have been stuck for 1/2 month is that :
> 
> why the thread still running when i click canel on IE?
> click cancel in IE (i think) would close the TCP
> connection. servlet would konw that in the socket
> immediately ( this is the case in netscape). and
> caught an exception.
> 
> I suspect IE still keeps the TCP connection even after
> user click cancel. (that's bit strange idea).  but
> what else can keep the thread in servlet keep running
> if the socket is closed?  the thread didn't dies if i
> make another request, it's still there.
> 


 MSIE very loosely honors the HTTP/1.1 spec. If your webserver 
is setup to allow HTTP/1.1 connection with keep-alives then MSIE
will keep the connection open even if the user has hit stop. It also
does weird things the a keep-alive timeout. 
  You could try forcing the webserver to not allow keep-alives and
trying the same test to see if you get an exception or not. I don't 
remember from the start of the thread if you are using one of the apache
modules or talking straight to Tomcat. 

-- 
Steve Brunton   <[EMAIL PROTECTED]>  Phone: 404-827-2756
Chief Engineer Enterprise SystemsOne CNN Center, Atlanta GA
CNN Internet Technologies  ICBM: 84W 23' 45" 33N 45' 29"
<*> I see you've set aside this special time to humiliate yourself in public. <*>



Re: Servlet --> File --> Web-browser

2001-05-04 Thread tim leung

thanks steve,

But I am connect to tomcat 3.2.1 directly (not apache
in midddle). it looks like TCP connection exist even i
click cancel during download until i close IE.

i will get :
IOException in doGet(): java.net.SocketException:
Connection reset by peer: socket write error
when I close IE window.

i am pretty sure tomcat 3.2.1 don't not support
presistent connection(HTTP/1.1 connection keep alive).
 it must be IE didn't close the socket. 

If i use apache in between. i will never get an
exception in servlet. Is that right?  what i think is
apache will always buffer the whole file when it get
some request from client. Is that right? even for
static content.  

But how about for a very big file like 100MB. will it
buffer the whole file too? when user click cancel in
the very beginning.

thanks.
 
--- Steve Brunton <[EMAIL PROTECTED]> wrote:
> On Thu, May 03, 2001, Purple Mutants made tim leung
> write:
> > yup, you are right william.
> > 
> > it's not really exception. it's thread's running
> state
> > at the time i push Crt+Break. 
> > 
> > One thing i have been stuck for 1/2 month is that
> :
> > 
> > why the thread still running when i click canel on
> IE?
> > click cancel in IE (i think) would close the TCP
> > connection. servlet would konw that in the socket
> > immediately ( this is the case in netscape). and
> > caught an exception.
> > 
> > I suspect IE still keeps the TCP connection even
> after
> > user click cancel. (that's bit strange idea).  but
> > what else can keep the thread in servlet keep
> running
> > if the socket is closed?  the thread didn't dies
> if i
> > make another request, it's still there.
> > 
> 
> 
>  MSIE very loosely honors the HTTP/1.1 spec. If your
> webserver 
> is setup to allow HTTP/1.1 connection with
> keep-alives then MSIE
> will keep the connection open even if the user has
> hit stop. It also
> does weird things the a keep-alive timeout. 
>   You could try forcing the webserver to not allow
> keep-alives and
> trying the same test to see if you get an exception
> or not. I don't 
> remember from the start of the thread if you are
> using one of the apache
> modules or talking straight to Tomcat. 
> 
> -- 
> Steve Brunton   <[EMAIL PROTECTED]>  Phone:
> 404-827-2756
> Chief Engineer Enterprise SystemsOne CNN Center,
> Atlanta GA
> CNN Internet Technologies  ICBM: 84W 23' 45"
> 33N 45' 29"
> <*> I see you've set aside this special time to
> humiliate yourself in public. <*>


__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



Re: Servlet --> File --> Web-browser

2001-05-04 Thread tim leung

anyone can help?
thanks.

--- tim leung <[EMAIL PROTECTED]> wrote:
> thanks steve,
> 
> But I am connect to tomcat 3.2.1 directly (not
> apache
> in midddle). it looks like TCP connection exist even
> i
> click cancel during download until i close IE.
> 
> i will get :
> IOException in doGet(): java.net.SocketException:
> Connection reset by peer: socket write error
> when I close IE window.
> 
> i am pretty sure tomcat 3.2.1 don't not support
> presistent connection(HTTP/1.1 connection keep
> alive).
>  it must be IE didn't close the socket. 
> 
> If i use apache in between. i will never get an
> exception in servlet. Is that right?  what i think
> is
> apache will always buffer the whole file when it get
> some request from client. Is that right? even for
> static content.  
> 
> But how about for a very big file like 100MB. will
> it
> buffer the whole file too? when user click cancel in
> the very beginning.
> 
> thanks.
>  
> --- Steve Brunton <[EMAIL PROTECTED]> wrote:
> > On Thu, May 03, 2001, Purple Mutants made tim
> leung
> > write:
> > > yup, you are right william.
> > > 
> > > it's not really exception. it's thread's running
> > state
> > > at the time i push Crt+Break. 
> > > 
> > > One thing i have been stuck for 1/2 month is
> that
> > :
> > > 
> > > why the thread still running when i click canel
> on
> > IE?
> > > click cancel in IE (i think) would close the TCP
> > > connection. servlet would konw that in the
> socket
> > > immediately ( this is the case in netscape). and
> > > caught an exception.
> > > 
> > > I suspect IE still keeps the TCP connection even
> > after
> > > user click cancel. (that's bit strange idea). 
> but
> > > what else can keep the thread in servlet keep
> > running
> > > if the socket is closed?  the thread didn't dies
> > if i
> > > make another request, it's still there.
> > > 
> > 
> > 
> >  MSIE very loosely honors the HTTP/1.1 spec. If
> your
> > webserver 
> > is setup to allow HTTP/1.1 connection with
> > keep-alives then MSIE
> > will keep the connection open even if the user has
> > hit stop. It also
> > does weird things the a keep-alive timeout. 
> >   You could try forcing the webserver to not allow
> > keep-alives and
> > trying the same test to see if you get an
> exception
> > or not. I don't 
> > remember from the start of the thread if you are
> > using one of the apache
> > modules or talking straight to Tomcat. 
> > 
> > -- 
> > Steve Brunton   <[EMAIL PROTECTED]>  Phone:
> > 404-827-2756
> > Chief Engineer Enterprise SystemsOne CNN
> Center,
> > Atlanta GA
> > CNN Internet Technologies  ICBM: 84W 23'
> 45"
> > 33N 45' 29"
> > <*> I see you've set aside this special time to
> > humiliate yourself in public. <*>
> 
> 
> __
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great
> prices
> http://auctions.yahoo.com/


__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/