<snippage>

Sometimes I find a website that gives an unexpected response. Usually I drop
HttpClient for the basic java.net approach, but this time that did not work
too! Somehow HttpClient posts a form different than IE and Mozilla. How
exactly i do not know - but maybe I am just doing something wrong in these
particular cases.

</snippage>

We have a small container that one of the guys here developed.  One of the things that 
it can do is bind a class to an http server.  I ran into what you're seeing.  I think 
so, anyway.  After digging around and reading _How Tomcat Works_, I came to this 
conclusion.  I don't know how or why it's built this way, but it seems to me that it 
is, and the tomcat book seems to back it up.

When you do a post, there are essentially two hunks of data.  The headers and the post 
data (parameters, etc) which come after.  This is different from a get where the 
parameters are mixed in the header.  By using what seems to be a completely 
non-deterministic algorithm (I suspect astrology), these two hunks of data can be 
combined into one big hunk or can come in two separate ones, requiring a second read.

When I got inside the container code, I discovered that they were, quite sensibly, 
reading the socket until there wasn't anything else to read.  Sometimes I got my post 
data, sometimes I didn't.  I put in a second read when it was a post.  Sometimes I got 
my post data and sometimes, when the post data was in the first hunk, the second read 
just hung.  So now I've got some stupid "logic" in there that does the second read in 
a thread so that I can time it out if there's nothing there.  That works.

I don't know if this actually helps with your problem, but maybe it will provide a 
little insight into what may be going on...

Carey

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

Reply via email to