xdoo / vaadin-demo

demo using vaadin with spring boot.
4 stars 2 forks source link

Version für Entities #124

Open peter-mueller opened 9 years ago

peter-mueller commented 9 years ago

Bei parallelem Arbeiten kann es passieren, dass zwischenzeitliche Änderungen überschrieben werden. Das sollte abgefangen oder zumindest erkannt werden.

peter-mueller commented 9 years ago

Version wird jetzt als Etag Header ausgegeben. Falls If-Match mitgesendet wird (wird es noch nicht von der gui) wird auch der oben gennante Fehler verhindert.

@FabianHoltkoetter @xdoo @darenegade Sollen diese Änderungen nun in die GUI eingebaut werden?

8.3. Architecting a more efficient frontend

ETags combined with the If-Match and If-None-Match headers empower you to build frontend that is more friendly to consumer’s data plans and mobile battery lives.

  1. Identify the entities that need locking and add a version attribute. HTML5 nicely supports data-* attributes, so store it in the DOM somewhere like data-etag attribute.
  2. Identify the entiries that would benefit from tracking most recent updates. When fetching these resources, store the Last-Modified in the DOM (data-last-modified perhaps).
  3. When fetching resources, also embed self URIs into your DOM nodes (perhaps data-uri or data-self) so it’s very easy to go back to the resource.
  4. Adjust PUT/PATCH/DELETE operations to use If-Match and also handle HTTP 412 Precondition Failed status codes.
  5. Adjust GET operations to use If-None-Match, If-Modified-Since, and also handle HTTP 304 Not Modified status codes.

By embedding ETags and Last-Modified values into your DOM (or perhaps elsewhere for a native mobile app), you can then reduce the consumption of data/battery by NOT retrieving the same thing over and over. You can also avoid colliding with other clients, and instead, be alerted when you need to reconcile differences.

FabianWilms commented 9 years ago

Sollte meiner Meinung nach auf jedenfall integriert werden. Zusätzlich muss die GUI auf die hiermit verbundenen HTTP-Messages reagieren können.

xdoo commented 8 years ago

@peter-mueller wäre gut, wenn das gemacht würde. Evtl hast du ja schon? :)