Class Index | File Index

Classes


Class sap.ui2.srvc.ODataService


Defined in: ODataService.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
sap.ui2.srvc.ODataService(oODataWrapper, fnDefaultFailure)
Constructs a facade to any OData service, providing token handling for SAP NetWeaver Gateway's token-based CSRF protection mechanism.
Method Summary
Method Attributes Method Name and Description
 
Returns the current value of the CSRF token.
 
Returns the default error handler for this facade.
 
Opens a new queue where all requests are parked until a call to #submitBatchQueue.
 
refreshCsrfToken(fnSuccess, fnFailure)
Refreshes the CSRF token of this OData service by reading the service document again, which is never cached.
<static>  
sap.ui2.srvc.ODataService.resetSharedCsrfTokens()
for test purposes only
 
setCsrfToken(sNewCsrfToken)
Determines the new value of the CSRF token.
 
setDefaultErrorHandler(fnNewDefaultFailure)
Sets the default error handler for this facade.
 
submitBatchQueue(fnBatchAccepted, fnBatchItselfFailed)
Submits the current batch queue opened by #openBatchQueue by sending a single "$batch" request to the OData service and deletes the current batch queue immediately.
 
toString(bVerbose)
Returns this facade's string representation.
Class Detail
sap.ui2.srvc.ODataService(oODataWrapper, fnDefaultFailure)
Constructs a facade to any OData service, providing token handling for SAP NetWeaver Gateway's token-based CSRF protection mechanism. See Cross-Site Request Forgery Protection.
Parameters:
{sap.ui2.srvc.ODataWrapper} oODataWrapper
OData wrapper instance this service facade delegates to
{function (string|[object])} fnDefaultFailure Optional
error handler taking an error message and, since version 1.28.6, an optional object containing the complete error information as delivered by the ODataService. See fnFailure parameter of sap.ui2.srvc.ODataWrapper#onError for more details.
Since:
1.19.0
Method Detail
{string} getCsrfToken()
Returns the current value of the CSRF token. It is initially empty and determined automatically by sap.ui2.srvc.ODataWrapper on successful read requests.
Since:
1.7.0
Returns:
{string} the current value of the CSRF token
See:
#refreshCsrfToken
#setCsrfToken

{function (string|[object])} getDefaultErrorHandler()
Returns the default error handler for this facade.
Since:
1.2.0
Returns:
{function (string|[object])} error handler taking an error message and, since version 1.28.6, an optional object containing the complete error information as delivered by the ODataService. See fnFailure parameter of sap.ui2.srvc.ODataWrapper#onError for more details.

openBatchQueue()
Opens a new queue where all requests are parked until a call to #submitBatchQueue.
Since:
1.19.0

refreshCsrfToken(fnSuccess, fnFailure)
Refreshes the CSRF token of this OData service by reading the service document again, which is never cached. Called automatically by sap.ui2.srvc.ODataWrapper on a write operation if the CSRF token is missing or expired.
Parameters:
{function ()} fnSuccess
a callback function that is executed if the request succeeds
{function (string|[object])} fnFailure Optional
error handler taking an error message and, since version 1.28.6, an optional object containing the complete error information as delivered by the ODataService. See fnFailure parameter of sap.ui2.srvc.ODataWrapper#onError for more details.
Since:
1.17.0
See:
#getCsrfToken
#setCsrfToken
sap.ui2.srvc.ODataWrapper#read

<static> sap.ui2.srvc.ODataService.resetSharedCsrfTokens()
for test purposes only

setCsrfToken(sNewCsrfToken)
Determines the new value of the CSRF token. Use this function to synchronize the CSRF token across multiple instances of this facade in case their first read requests run in parallel. Retrieve the token from a service in the success handler of its read request and distribute it to all other services; do so for each service. Note that the last success handler of all first read requests run in parallel determines the token to be used for modifications.

If debugging HTTP traffic, watch out for x-csrf-token headers and sap-XSRF_* cookies.

Parameters:
{string} sNewCsrfToken Optional, Default: ""
the new value of the CSRF token, which may be null or undefined
Since:
1.7.0
See:
#getCsrfToken
#refreshCsrfToken

setDefaultErrorHandler(fnNewDefaultFailure)
Sets the default error handler for this facade.
Parameters:
{function (string|[object])} fnNewDefaultFailure
error handler taking an error message and, since version 1.28.6, an optional object containing the complete error information as delivered by the ODataService. See fnFailure parameter of sap.ui2.srvc.ODataWrapper#onError for more details.
Since:
1.2.0

submitBatchQueue(fnBatchAccepted, fnBatchItselfFailed)
Submits the current batch queue opened by #openBatchQueue by sending a single "$batch" request to the OData service and deletes the current batch queue immediately.
Defined in: ODataWrapper.js.
Parameters:
{function()} fnBatchAccepted Optional
A callback function that is executed if the batch request is accepted by the server, no matter whether individual operations fail. It will be called after all success or failure handlers of individual operations.
{function(string|[object])} fnBatchItselfFailed Optional
A callback function that is executed if the batch request itself fails, error handler taking an error message and, since version 1.28.6, an optional object containing the complete error information as delivered by the ODataService. See fnFailure parameter of sap.ui2.srvc.ODataWrapper#onError for more details.
Defaults to the OData service facade's default error handler (sap.ui2.srvc.ODataService#getDefaultErrorHandler).
This is called instead of individual failure handlers in this case!
Since:
1.19.0
See:
#openBatchQueue
#isBatchQueueOpen

{string} toString(bVerbose)
Returns this facade's string representation.
Parameters:
{boolean} bVerbose Optional, Default: false
flag whether to show all properties
Since:
1.2.0
Returns:
{string} this facade's string representation

©Copyright (c) 2009-2014 SAP SE, All Rights Reserved
Documentation generated by JsDoc Toolkit 2.4.0 on Tue Mar 14 2017 08:48:14 GMT-0000 (UTC)