Package org.eclipse.scout.rt.ui.html
Class ResponseHistory
java.lang.Object
org.eclipse.scout.rt.ui.html.ResponseHistory
Collects JSON responses and their corresponding request sequence number and response sequence number
until they are acknowledged by the client. A maximum of 10 responses is stored in the history.
This class is thread-safe.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
confirmResponseProcessed
(Long confirmedResponseSequenceNo) Confirms that the response with the given response sequence number has been successfully processed by the client.getRequestSequenceNo
(Long responseSequenceNo) getResponse
(Long responseSequenceNo) getResponseForRequest
(Long requestSequenceNo) getResponseSequenceNo
(Long requestSequenceNo) protected String
void
registerResponse
(Long responseSequenceNo, JSONObject response, Long requestSequenceNo) Stores the given response in the history, along with the response sequence number.int
size()
toString()
Combines all responses currently contained in the history into one new JSON object.withUiSession
(UiSession uiSession)
-
Constructor Details
-
ResponseHistory
public ResponseHistory()
-
-
Method Details
-
getUiSession
-
withUiSession
-
getUiSessionId
-
registerResponse
Stores the given response in the history, along with the response sequence number. If a request sequence number is provided, a mapping between those sequence numbers is stored as well. This allows to retrieve the response by request sequence number.If the history is already full, the oldest entry is discarded.
- Parameters:
responseSequenceNo
- The sequence number of the response to remember (mandatory)response
- The response to remember (mandatory)requestSequenceNo
- The sequence number of the request that caused the response (optional)- Throws:
org.eclipse.scout.rt.platform.util.Assertions.AssertionException
- if mandatory arguments arenull
-
confirmResponseProcessed
Confirms that the response with the given response sequence number has been successfully processed by the client. The response is removed from the history. All responses that are older (i.e. have a lower response sequence number) and the "response - request" mappings are automatically removed as well.- Throws:
org.eclipse.scout.rt.platform.util.Assertions.AssertionException
- if the argument isnull
-
toSyncResponse
Combines all responses currently contained in the history into one new JSON object. -
getResponseSequenceNo
- Returns:
- the response sequence number that corresponds to the given request sequence number (or
null
if no such mapping exists in the history)
-
getRequestSequenceNo
- Returns:
- the request sequence number that corresponds to the given response sequence number (or
null
if no such mapping exists in the history)
-
getResponse
- Returns:
- the response with the given response sequence number (or
null
if no response with this sequence number exists in the history)
-
getResponseForRequest
- Returns:
- the response that was sent as answer for the request with the given request sequence number (or
null
if no response for this request exists in the history)
-
size
public int size()- Returns:
- the number of responses in the history
-
toString
-