Novice GWT question: Parallel Post Requests

2012-04-24 Thread LogicalGoetz
This may be a terribly novice question, but for each POST performed
by, say, a FormPanel, is there a subsequent HttpResponse generated by
the Servlet?

Obviously in standard situations this will play out as follows:
-client makes a POST request
-servlet handles the request
-servlet sends POST response
-client receives response

However, the situation I'm curious about is when something like this
occurs:
-client makes a POST request
-servlet handles the request
-client makes a POST request (this occurs a few times possibly)
-servlet handles these requests
-servlet generates responses
-client receives a series of responses (no guarantee on order)

>From my current testing, it seems that if I have a FormPanel make
multiple POST requests while the servlet processes the requests, only
the first will ever generate a response.  Is this the nature of Java
servlets, my client application (firefox), the http specification, or
possibly a coding blunder on my part?

Thank you in advance for any information,
 Mike

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Novice GWT question: Parallel Post Requests

2012-04-24 Thread Alan Chaney

Interesting question... see comments below

On 4/23/2012 2:20 PM, LogicalGoetz wrote:

This may be a terribly novice question, but for each POST performed
by, say, a FormPanel, is there a subsequent HttpResponse generated by
the Servlet?

Obviously in standard situations this will play out as follows:
-client makes a POST request
-servlet handles the request
-servlet sends POST response
-client receives response

However, the situation I'm curious about is when something like this
occurs:
-client makes a POST request
-servlet handles the request
-client makes a POST request (this occurs a few times possibly)
-servlet handles these requests
-servlet generates responses
-client receives a series of responses (no guarantee on order)

 From my current testing, it seems that if I have a FormPanel make
multiple POST requests while the servlet processes the requests, only
the first will ever generate a response.  Is this the nature of Java
servlets, my client application (firefox), the http specification, or
possibly a coding blunder on my part?


for each post there should be a response  = that's the http specification.

There is no limit in the java servlet spec to the number of simultaneous 
requests. A server is normally expected to queue requests or reject them 
("temporarily unavailable") but for each request there is still a 
response - otherwise you'd get a timeout ("server not responding")


The servlet spec does provide alternative mechanisms for scheduling. A 
good design will always assume that many requests can be concurrently 
occurring and handle that accordingly - for example by using stateless 
objects and transactional data stores. Avoid synchronous servlets like 
the plague.


Either you are somehow *not* generating more than one post or you are 
getting more than one response and overwriting the results.


Try:
1. watching the request/response with firebug or similar and do some 
console logging of state in your client

2. Add some debugging output to the servlet to see whats happening there.

Then study the results and determine the causality! At least, that's 
what I'd do.


HTH

Alan




Thank you in advance for any information,
  Mike



--
You received this message because you are subscribed to the Google Groups "Google 
Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Novice GWT question: Parallel Post Requests

2012-04-24 Thread Joseph Lust
I've run into this exact problem before, but not while using GWT. I found 
that for XHR's, Post 1 must return before Post 2 can return. I'm not sure 
why this it, but it seems to be the case at least on FF and Chrome.

My use case was to:

   - Post 1 - start a long running task
   - Post 2 - Check on state of long running application (repeat on timer)
   - Post 1 finally returns.

I had to work around with setting a work queue in a database and then 
checking it with a cron job (it was PHP, so no persistent 
global synchronized lists like in Java), but I'd love to know why this 
works this way. I just assume it is some browser quirk.

Sincerely,
Joseph

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/zl-Eh8pSmhcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Novice GWT question: Parallel Post Requests

2012-04-25 Thread kim young ill
On Mon, Apr 23, 2012 at 11:20 PM, LogicalGoetz wrote:

> This may be a terribly novice question, but for each POST performed
> by, say, a FormPanel, is there a subsequent HttpResponse generated by
> the Servlet?
>
> Obviously in standard situations this will play out as follows:
> -client makes a POST request
> -servlet handles the request
> -servlet sends POST response
> -client receives response
>
> However, the situation I'm curious about is when something like this
> occurs:
> -client makes a POST request
> -servlet handles the request
> -client makes a POST request (this occurs a few times possibly)
> -servlet handles these requests
> -servlet generates responses
> -client receives a series of responses (no guarantee on order)
>
> From my current testing, it seems that if I have a FormPanel make
> multiple POST requests while the servlet processes the requests, only
> the first will ever generate a response.


AFAICT, if u have a (html) form (which wrapped by a formpanel), this will
be posted only once to server , for which u'll get a response, this form in
this case will not be available for u anymore on the client side to do a
re-post.

or did i misunderstanding when u says "a FormPanel make
multiple POST requests " ?





>  Is this the nature of Java
> servlets, my client application (firefox), the http specification, or
> possibly a coding blunder on my part?
>
> Thank you in advance for any information,
> Mike
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Novice GWT question: Parallel Post Requests

2012-04-25 Thread Joseph Lust
However, keep in mind that GET requests are quite limited. For example, IE 
cannot handle a URL longer than 2083 characters. Thus, not very much 
information can be serialized into a URL. Hence, most forms are usually 
POST'd, not GET'd.


Joe

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/C4RmK-oou2oJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.