How to implement server-side parallel feed in GWT?

I am creating a GWT application with many forms. I am using a gwt platform with a submit module.

The next step, in my opinion, is to prevent double subordination on the server side. The problem is that I don’t know how to do it for sure ...

I thought of something like this:

  • When the application loads, the server passes the generated token to the client
  • The server stores a token inside an HTTPSession
  • When a client submits a form, it submits a token from (1.) along with the form
  • The server checks if the sent token == was a token inside an HTTPSession
  • In response to the client, he will send a new token

Is it safe to store the token inside an HTTPSession? Or should I just create a HashMap on a server that maps from SESSION_ID to the generated token?

Or maybe the implementation has already been implemented in the GWT or gwt platform or somewhere else?

thank

+3
source share
1 answer

The question you should ask yourself first is: What is the type of problem scenario you want to avoid?

  • The user accidentally (or because of disappointment, ...) presses the button twice.
  • A resource that is available only once (for example, reserving for a specific seat on an airplane) is consumed twice.

Don't just say "I want to avoid both." Even if you do, you will have to solve two problems separately.

Problem 1

This is best solved on the client side (for example, by disabling the button after pressing it).

( , , - ,...), . (, JavaScript, ), : 1 .

2

( ) . . , , ! ?

: . :

  • .
  • , , , .
  • , .

- . , ( 1).

... 3

- , :

, . -. . , , , .

, , , , , " ", " 1". , ..

+5

All Articles