由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - [转载] Re: 觉得自己很笨
相关主题
sevlet questionhow to multicast objects to clients in java?
how to sent progress message back from a servlet to a client?what kind of machine should I buy
FrameworkServlet?Re: Expert, help me, please -Java Server Environment set up
which http client package is good to use?Please Help!
weblogic Server中如果写一个HTTP Client的程序apache commons是啥东西呀?
Re: about jsp and servlet哎,现在client-side,server-side都要我来写。
Re: 请教一个问题—servletTimeout issue
How to timeout a processWeb Service怎么让多个api call share 同一个 connection ?? (转载)
相关话题的讨论汇总
话题: servlet话题: timeout话题: client话题: writeout
进入Java版参与讨论
1 (共1页)
c***a
发帖数: 69
1
【 以下文字转载自 SanFrancisco 讨论区,原文如下 】
发信人: cilla (想飞的猪~戒肉), 信区: SanFrancisco
标 题: Re: 觉得自己很笨
发信站: The unknown SPACE (Wed Aug 6 21:03:19 2003) WWW-POST
java问题
client open 一个HttpURLConnection 以后getInputStream,
trigger了servlet对HttpServletRequest处理,可是servlet端运行的时间长一些,没有
等到往outputstream里写东西,client的getInputStream就返回了,开始读,自然啥也读
不到。我觉得是HttpConnection timeout了,可是不知道怎么set这个timeout的值。我用
的websphere application developer 5.0
再网上search
很久了,发现别人问的问题都是说如果servlet迟迟不writeout,client会hang,我的behav
ior怎么不一样呢?而且HttpURLC
w********c
发帖数: 2632
2
HttpUrlConnection doesn't allow u to manipulate the timeout value. Maybe u
have to either use Socket or Apache HttpClient.




很久了,发现别人问的问题都是说如果servlet迟迟不writeout,client会hang,我的behav
timeout的值的,除非改用socket

【在 c***a 的大作中提到】
: 【 以下文字转载自 SanFrancisco 讨论区,原文如下 】
: 发信人: cilla (想飞的猪~戒肉), 信区: SanFrancisco
: 标 题: Re: 觉得自己很笨
: 发信站: The unknown SPACE (Wed Aug 6 21:03:19 2003) WWW-POST
: java问题
: client open 一个HttpURLConnection 以后getInputStream,
: trigger了servlet对HttpServletRequest处理,可是servlet端运行的时间长一些,没有
: 等到往outputstream里写东西,client的getInputStream就返回了,开始读,自然啥也读
: 不到。我觉得是HttpConnection timeout了,可是不知道怎么set这个timeout的值。我用
: 的websphere application developer 5.0

v**o
发帖数: 64
3
这个timeout好像是在http server中设的,参考一下apache的httpd.conf文件说明吧




很久了,发现别人问的问题都是说如果servlet迟迟不writeout,client会hang,我的behav
timeout的值的,除非改用socket

【在 c***a 的大作中提到】
: 【 以下文字转载自 SanFrancisco 讨论区,原文如下 】
: 发信人: cilla (想飞的猪~戒肉), 信区: SanFrancisco
: 标 题: Re: 觉得自己很笨
: 发信站: The unknown SPACE (Wed Aug 6 21:03:19 2003) WWW-POST
: java问题
: client open 一个HttpURLConnection 以后getInputStream,
: trigger了servlet对HttpServletRequest处理,可是servlet端运行的时间长一些,没有
: 等到往outputstream里写东西,client的getInputStream就返回了,开始读,自然啥也读
: 不到。我觉得是HttpConnection timeout了,可是不知道怎么set这个timeout的值。我用
: 的websphere application developer 5.0

e***g
发帖数: 158
4
well, keep reading, as long as the input stream is there.

【在 c***a 的大作中提到】
: 【 以下文字转载自 SanFrancisco 讨论区,原文如下 】
: 发信人: cilla (想飞的猪~戒肉), 信区: SanFrancisco
: 标 题: Re: 觉得自己很笨
: 发信站: The unknown SPACE (Wed Aug 6 21:03:19 2003) WWW-POST
: java问题
: client open 一个HttpURLConnection 以后getInputStream,
: trigger了servlet对HttpServletRequest处理,可是servlet端运行的时间长一些,没有
: 等到往outputstream里写东西,client的getInputStream就返回了,开始读,自然啥也读
: 不到。我觉得是HttpConnection timeout了,可是不知道怎么set这个timeout的值。我用
: 的websphere application developer 5.0

m******t
发帖数: 2416
5

The javadoc of InputStream.read() clearly states:
"This method blocks until input data is available, the end of
the stream is detected, or an exception is thrown."
Since you are not getting any exception,
unless the server closes the connection(in which case you'd get
a return value of -1), a read() call should be blocking until there is
some data available.
I would consider using Apache HttpClient.

【在 c***a 的大作中提到】
: 【 以下文字转载自 SanFrancisco 讨论区,原文如下 】
: 发信人: cilla (想飞的猪~戒肉), 信区: SanFrancisco
: 标 题: Re: 觉得自己很笨
: 发信站: The unknown SPACE (Wed Aug 6 21:03:19 2003) WWW-POST
: java问题
: client open 一个HttpURLConnection 以后getInputStream,
: trigger了servlet对HttpServletRequest处理,可是servlet端运行的时间长一些,没有
: 等到往outputstream里写东西,client的getInputStream就返回了,开始读,自然啥也读
: 不到。我觉得是HttpConnection timeout了,可是不知道怎么set这个timeout的值。我用
: 的websphere application developer 5.0

w******n
发帖数: 692
6
Why not use InputStream().available() to check the number of bytes that
can be read?

【在 m******t 的大作中提到】
:
: The javadoc of InputStream.read() clearly states:
: "This method blocks until input data is available, the end of
: the stream is detected, or an exception is thrown."
: Since you are not getting any exception,
: unless the server closes the connection(in which case you'd get
: a return value of -1), a read() call should be blocking until there is
: some data available.
: I would consider using Apache HttpClient.

1 (共1页)
进入Java版参与讨论
相关主题
Web Service怎么让多个api call share 同一个 connection ?? (转载)weblogic Server中如果写一个HTTP Client的程序
Re: unix环境下如何在java程序中执行命令行?Re: about jsp and servlet
Java练习题 6Re: 请教一个问题—servlet
Java练习题 7How to timeout a process
sevlet questionhow to multicast objects to clients in java?
how to sent progress message back from a servlet to a client?what kind of machine should I buy
FrameworkServlet?Re: Expert, help me, please -Java Server Environment set up
which http client package is good to use?Please Help!
相关话题的讨论汇总
话题: servlet话题: timeout话题: client话题: writeout