On 4 nov, 07:52, ArunDhaJ <[EMAIL PROTECTED]> wrote: > Hi All, > When I use HTTPRequest's asyncGet, it sends the request twice. This > creates problem in my application. > On a request I send a "name" parameter as query string, the servlet > makes a database entry with this value which is a unique field. > > When I use asyncGet it adds an entry into the database without any > problem, since its sending the request again(I don't know why) adding > a duplicate entry in unique field throws exception.
Not a solution but... GET is supposed to be safe and idempotent in HTTP (i.e. no side-effect on the resource, could be repeated without side-effect, and without "breaking" anything; a response to GET could be cached so that other GET requests are served from intermediaries and never ever reach the origin server; that's actually what makes the Web scale so well). You should definitely use a POST (either to the same URL, having the "name" in the query-string, or sending the "query" as application/x- www-form-urlencoded in the request body --same format as a query- string, but as request "data" instead of being surfaced in the URL--); either by using asyncPost or, better, replacing HttpRequest calls with RequestBuilder. Actually, this might be your problem: the browser assume that GET is safe and idempotent and that it can safely make two requests (I bet they're not exactly the same actually). --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---