public abstract class DataServlet
extends javax.servlet.http.HttpServlet
Abstract base class for server-side implementation of OData data services.
A service implementation must minimally override the DataServlet.dataService
property. Depending on requirements, other properties and/or functions may also need to be overridden.
For Java service implementations, this class extends javax.servlet.http.HttpServlet
to enable easy inclusion into Java web applications.
DataService
, examples/delta/DeltaServer.java
, examples/java/example/*Server*.java
.
Modifier and Type | Class and Description |
---|---|
class |
DataServlet.SizeLimitingInputStream |
Constructor and Description |
---|
DataServlet() |
Modifier and Type | Method and Description |
---|---|
void |
addMetadataCapabilities()
Add annotations to this service's metadata so that clients will be informed what the server can do.
|
void |
allowUnused(java.lang.Object value)
Helper function so generated subclasses can explicitly ignore a value.
|
GlobalDateTime |
backendTimeNow()
Return the current UTC date/time, as determined by the backend system.
|
void |
bindEntities(EntityValue entity)
|
void |
bindEntities(EntityValue entity,
Property bindingProperty)
|
void |
bindEntities(EntityValue entity,
Property bindingProperty,
boolean afterCreate)
|
void |
bindEntities(EntityValue entity,
Property bindingProperty,
boolean afterCreate,
boolean afterUpdate)
This function may be used in the implementation of entity binding calls, e.g.
|
void |
bindEntitiesAfterCreate(EntityValue entity)
|
void |
bindEntitiesAfterCreate(EntityValue entity,
Property bindingProperty)
This function may be used in the implementation of entity binding calls after the main create action of
DataServlet.createEntity . |
void |
bindEntitiesAfterUpdate(EntityValue entity)
|
void |
bindEntitiesAfterUpdate(EntityValue entity,
Property bindingProperty)
This function may be used in the implementation of entity binding calls after the main update action of
DataServlet.updateEntity . |
void |
checkServerRuntime(java.lang.String expected)
Check that the current server runtime is what is expected for a generated OData service.
|
void |
createChildren(EntityValue entity)
|
void |
createChildren(EntityValue entity,
Property childProperty)
This function may be used in the implementation of "deep insert" calls, e.g.
|
void |
createEntity(EntityValue entity)
Override this function to implement entity creation for this service.
|
void |
createLink(EntityValue source,
Property sourceProperty,
EntityValue target)
Override this function to implement link creation for this service.
|
void |
createLinkUsingForeignKeys(EntityValue source,
Property sourceProperty,
EntityValue target)
Default implementation of 'createLink' using foreign keys from referential constraints in service metadata.
|
void |
createMedia(EntityValue entity,
ByteStream stream)
Override this function to implement media creation for this service.
|
void |
createParents(EntityValue entity)
|
void |
createParents(EntityValue entity,
Property parentProperty)
This function may be used in the implementation of "deep insert" calls, e.g.
|
java.lang.String |
currentUser()
Return the current user name, or throw
DataSecurityException if there is no current user. |
java.lang.String |
currentUserIfAuthenticated()
Return (nullable) The current user name, or
null if there is no current user (e.g. |
void |
deleteChildren(EntityValue entity)
|
void |
deleteChildren(EntityValue entity,
Property childProperty)
This function may be used in the implementation of "on delete" actions, e.g.
|
void |
deleteEntity(EntityValue entity)
Override this function to implement entity deletion for this service.
|
void |
deleteLink(EntityValue source,
Property sourceProperty,
EntityValue target)
Override this function to implement link deletion for this service.
|
void |
deleteLinkUsingForeignKeys(EntityValue source,
Property sourceProperty,
EntityValue target)
Default implementation of 'deleteLink' using foreign keys from referential constraints in service metadata.
|
void |
deleteStream(EntityValue entity,
StreamLink link)
Override this function to implement stream delete for this service.
|
void |
doDelete(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
doHead(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
doOptions(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
doPut(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
downloadMedia(EntityValue entity,
ByteStream stream)
Override this function to implement media downloading for this service.
|
void |
downloadStream(EntityValue entity,
StreamLink link,
ByteStream stream)
Override this function to implement stream downloading for this service.
|
DataValue |
executeQuery(DataQuery query)
Override this function to implement data queries for this service.
|
void |
expandItem(EntityValue entity,
ExpandItem item)
Override this function to implement item expansion for this service.
|
void |
expandItems(DataQuery query,
DataValue result)
|
java.lang.String |
generateETag()
Return a "weak" HTTP ETag (entity tag).
|
void |
generateKey(EntityValue entity)
|
void |
generateKey(EntityValue entity,
Property property)
Generate a primary key for
entity . |
int |
getAllowedMethods()
Return set this property to define the legal access methods for this service.
|
boolean |
getAllowIfMatchAny()
Return set this to
true if clients will not be permitted to use "If-Match: *" in updates when optimistic concurrency is enabled. |
boolean |
getAllowNestedPaging()
Return allow nested next-links in multi-level result (when one or more levels of $expand is used in the client's query).
|
boolean |
getAllowNonPatchUpdates()
Return should this service allow entity updates via PUT (in addition to PATCH which is always allowed)? Defaults to
false . |
boolean |
getApplyPatchBeforeUpdate()
Return should this service apply a patch request to an entity before calling
DataServlet.updateEntity ? Defaults to true . |
DataService |
getBackendService()
Return override this property to return a delegate data service for communication with a backend system.
|
boolean |
getBooleanSetting(java.lang.Class inClass,
java.lang.String name,
boolean defaultValue)
Get the value of a boolean setting (static final field) from 'inClass'.
|
boolean |
getCheckExistingBeforeCreate()
Return should this service check for an existence of an existing entity before calling
DataServlet.createEntity ? Defaults to false . |
boolean |
getCheckExistingBeforeDelete()
Return should this service check for an existence of an existing entity before calling
DataServlet.deleteEntity ? Defaults to true . |
boolean |
getCheckExistingBeforeDownload()
Return should this service check for an existence of an existing entity before calling
DataServlet.downloadMedia or DataServlet.downloadStream . |
boolean |
getCheckExistingBeforeLinking()
Return should this service check for an existence of an existing entity before calling
DataServlet.createLink , DataServlet.updateLink or DataServlet.deleteLink ? Defaults to true . |
boolean |
getCheckExistingBeforeUpdate()
Return should this service check for an existence of an existing entity before calling
DataServlet.updateEntity ? Defaults to true . |
boolean |
getCheckExistingBeforeUpload()
Return should this service check for an existence of an existing entity before calling
DataServlet.uploadMedia or DataServlet.uploadStream . |
GuidValue |
getClientGUID()
Return the value of request header "Client-Instance-ID", or throw
DataException if it is missing/invalid. |
long |
getClientID()
Return the client ID number corresponding to request header "Client-Instance-ID", or throw
DataException if it is missing/invalid. |
EntityValue |
getClientRegistration()
Return an entity value for the current client registration, and remember it to save time if it is requested again later.
|
boolean |
getCreateWithDefaultValues()
Return should
DataServlet.createEntity automatically apply default values for properties not provided by the client? Defaults to true . |
static HttpRequest |
getCurrentBatchRequest()
Return (nullable) The current thread's request batch, or
null if there is no current batch request. |
static HttpRequest |
getCurrentRequest()
Return (nullable) The current thread's HTTP request, or
null if there is no current HTTP request. |
static DataServlet |
getCurrentServlet()
Return (nullable) The current thread's data servlet, or
null if there is no current data servlet. |
abstract DataService |
getDataService()
Return override this property to return a delegate data service that provides metadata for this service.
|
DataTransaction |
getDataTransaction()
Return override this property to specify a custom transaction manager.
|
int |
getDefaultFormat()
Return set this property to define the default data format for this service.
|
int |
getDefaultPageSize()
Return default page size for server-driven paging.
|
boolean |
getDeleteRequiresEntityTag()
Return set this to
false if clients must provide "If-Match: |
DeltaStreamWriter |
getDeltaStream(DataQuery query,
EntityValueList result,
DataContext context,
int format,
HttpRequest request) |
int |
getInputContentLengthLimit()
Return should this service limit input content length.
|
boolean |
getInvokeWithDefaultValues()
Return should
DataServlet.invokeAction , DataServlet.invokeFunction apply the default values for properties of the passed action and function parameters not provided by the client? Defaults to true . |
int |
getMaximumActiveDemandRefreshThreads()
Return the maximum number of on-demand cache refresh threads which may be simultaneously active.
|
int |
getMaximumActiveFastRefreshThreads()
Return the maximum number of scheduled "fast" cache refresh threads which may be simultaneously active.
|
int |
getMaximumActiveSlowRefreshThreads()
Return the maximum number of scheduled "slow" cache refresh threads which may be simultaneously active.
|
int |
getMaximumGraphSize()
Return maximum graph size for server-driven paging.
|
CsdlDocument |
getMetadata()
Return the service metadata for
DataServlet.dataService . |
boolean |
getMustInitializeOptionalProperties()
Return should
DataServlet.createEntity , DataServlet.updateEntity . |
boolean |
getMustInitializeRequiredProperties()
Return should
DataServlet.createEntity , DataServlet.updateEntity , DataServlet.invokeAction , DataServlet.invokeFunction apply default values for required (non-nullable) properties. |
boolean |
getPrettyTracing()
Return should
DataServlet.traceWithData show pretty-printed JSON/XML content? |
int |
getRepeatabilityDays()
Return the number of days that logs of repeatable requests should be retained in order to allow their successful repeated execution (defaults to 50).
|
DataService |
getRepeatabilityService()
Return override this property to return a delegate data service that manages the repeatability status of the requests.
|
static HttpRequest |
getRequiredCurrentRequest()
Return the current (active) request on the current thread, or throw
DataServiceException if there is no active request on the current thread. |
static DataServlet |
getRequiredCurrentServlet()
Return the servlet which is servicing the current (active) request on the current thread, or throw
DataServiceException if there is no active request on the current thread. |
DataValue |
getRequiredHeaderValue(EntityType entityType,
java.lang.String headerName)
Obtain the value of a structure property within a required HTTP header in the current servlet request.
|
boolean |
getRequiresAuthentication()
Return set this property to
true if the service requires authentication for all requests. |
boolean |
getRequiresTransaction()
Return set this property to
true if the service requires transactions for all requests (even for GET / HEAD / POST requests, which would otherwise be executed without a transaction). |
boolean |
getReturnContentAfterCreate()
Return can entity properties be returned in the HTTP response after an entity is created? Defaults to
true . |
boolean |
getReturnContentAfterUpdate()
Return can entity properties be returned in the HTTP response after an entity is updated? Defaults to
true . |
boolean |
getReturnETagWithNoContent()
Return ordinarily per RFC7231 section 4.3.4, a 204 (No Content) response for a PUT request
should have no ETag unless the request's representation data was saved without any transformation applied to the body.
|
boolean |
getSendErrorInnerDetails()
Return should this service send inner error details to clients when exceptions are thrown? Defaults to
false . |
java.lang.String |
getServiceName()
Return the service name.
|
int |
getSlowRefreshCountThreshold()
Return a cache refresh will be considered "slow" if its result count exceeds this value.
|
int |
getSlowRefreshTimeThreshold()
Return a cache refresh will be considered "slow" if its execution time count exceeds this value.
|
boolean |
getStreamDeltaResponses()
Return should this service use streaming for delta responses? Defaults to
false . |
boolean |
getSupportsChangeTracking()
Return does this service support change tracking? Returns
true if dataService uses InMemoryDatabase or SQLDatabaseProvider enabled for change tracking. |
boolean |
getSupportsMultitenancy()
Return is this servlet multi-tenant-aware? Defaults to
false . |
boolean |
getSupportsRepeatability()
Return should handle repeatability request headers (RequestID, RepeatabilityCreation).
|
boolean |
getSupportsTransaction()
Return set this property to
false if the service does not support transactions. |
java.lang.String |
getThreadLocalTenant()
Return thread-local tenant ID.
|
boolean |
getTraceRequests()
Return set this property to enable request tracing for this service.
|
boolean |
getTraceWithData()
Return if
DataServlet.traceRequests is also true , should all requests for this data service be traced with data? Defaults to false . |
boolean |
getTrackChangesByDefault()
Return should this service assume "Prefer: odata.track-changes" even if the client didn't send that header? Defaults to false.
|
boolean |
getUpdateRequiresEntityTag()
Return set this to
false if clients must provide "If-Match: |
boolean |
getUpdateWithDefaultValues()
Return should
DataServlet.updateEntity automatically apply default values for properties not provided by the client? Defaults to true . |
DataValue |
invokeAction(EntityValue entity,
DataMethod method,
ParameterList parameters)
Override this function to implement action invocation for this service.
|
DataValue |
invokeFunction(EntityValue entity,
DataMethod method,
ParameterList parameters)
Override this function to implement function invocation for this service.
|
boolean |
isUserInRole(java.lang.String role)
Return
true if the current user has the provided security role . |
void |
loadInitialData(boolean includeTestData)
Load initial data from web application resource subfolders into the
DataServlet.dataService . |
void |
logBackgroundError(java.lang.String message)
|
void |
logBackgroundError(java.lang.String message,
java.lang.RuntimeException error)
|
void |
logBackgroundError(java.lang.String message,
java.lang.RuntimeException error,
boolean dump)
Override this function to customize the logging of service errors detected by background threads.
|
void |
logBackgroundWarning(java.lang.String message)
|
void |
logBackgroundWarning(java.lang.String message,
java.lang.RuntimeException error)
|
void |
logBackgroundWarning(java.lang.String message,
java.lang.RuntimeException error,
boolean dump)
Override this function to customize the logging of service warnings detected by background threads.
|
void |
logError(HttpRequest request,
java.lang.RuntimeException error,
java.lang.String content)
Override this function to customize the logging of service errors.
|
void |
logInfo(java.lang.String message)
Override this function to customize the logging of service informational messages.
|
java.lang.String |
metadataText(int format,
int version,
java.lang.String language,
java.lang.String document)
Override this function to return metadata document text of the service for the client.
|
java.lang.String |
nextTraceID()
Return a unique ID for tracing of a request.
|
void |
prepareForTenant()
This function should be overridden if
DataServlet.supportsMultitenancy is true , to perform any necessary once-only actions to ready the execution environment for a particular tenant. |
void |
propagateKeys(EntityValue parent,
Property childProperty,
EntityValue child)
This function may be used in the implementation of
createRelatedEntity , to propagate key(s) from a parent entity to foreign keys in its child. |
void |
registerEntityHandler(EntityType entityType,
EntityHandler handler)
Register an entity handler with an entity type.
|
void |
registerEntityListener(EntityType entityType,
EntityListener listener)
Register an entity listener with an entity type.
|
void |
registerEntitySetHandler(EntitySet entitySet,
EntityHandler handler)
Register an entity handler with an entity set.
|
void |
registerEntitySetListener(EntitySet entitySet,
EntityListener listener)
Register an entity listener with an entity set.
|
void |
registerMethodHandler(DataMethod dataMethod,
MethodHandler handler)
Register a method handler with a data method.
|
java.lang.String |
requestForTenant(HttpRequest request)
This function should be overridden if
DataServlet.supportsMultitenancy is true , to fetch the tenant ID from an incoming request. |
EntityValue |
selectEntity(EntityValue entity)
Return newly loaded copy of
entity with all structural properties selected. |
void |
service(HttpRequest request)
Handle an incoming service request, by delegating to the appropriate handler function.
|
protected void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
setAllowedMethods(int value)
Set set this property to define the legal access methods for this service.
|
void |
setAllowIfMatchAny(boolean value)
Set set this to
true if clients will not be permitted to use "If-Match: *" in updates when optimistic concurrency is enabled. |
void |
setAllowNestedPaging(boolean value)
Set allow nested next-links in multi-level result (when one or more levels of $expand is used in the client's query).
|
void |
setAllowNonPatchUpdates(boolean value)
Set should this service allow entity updates via PUT (in addition to PATCH which is always allowed)? Defaults to
false . |
void |
setApplyPatchBeforeUpdate(boolean value)
Set should this service apply a patch request to an entity before calling
DataServlet.updateEntity ? Defaults to true . |
void |
setCheckExistingBeforeCreate(boolean value)
Set should this service check for an existence of an existing entity before calling
DataServlet.createEntity ? Defaults to false . |
void |
setCheckExistingBeforeDelete(boolean value)
Set should this service check for an existence of an existing entity before calling
DataServlet.deleteEntity ? Defaults to true . |
void |
setCheckExistingBeforeDownload(boolean value)
Set should this service check for an existence of an existing entity before calling
DataServlet.downloadMedia or DataServlet.downloadStream . |
void |
setCheckExistingBeforeLinking(boolean value)
Set should this service check for an existence of an existing entity before calling
DataServlet.createLink , DataServlet.updateLink or DataServlet.deleteLink ? Defaults to true . |
void |
setCheckExistingBeforeUpdate(boolean value)
Set should this service check for an existence of an existing entity before calling
DataServlet.updateEntity ? Defaults to true . |
void |
setCheckExistingBeforeUpload(boolean value)
Set should this service check for an existence of an existing entity before calling
DataServlet.uploadMedia or DataServlet.uploadStream . |
void |
setCreateWithDefaultValues(boolean value)
Set should
DataServlet.createEntity automatically apply default values for properties not provided by the client? Defaults to true . |
static void |
setCurrentBatchRequest(HttpRequest value)
Set the current thread's request batch, or
null if there is no current batch request. |
static void |
setCurrentRequest(HttpRequest value)
Set the current thread's HTTP request, or
null if there is no current HTTP request. |
static void |
setCurrentServlet(DataServlet value)
Set the current thread's data servlet, or
null if there is no current data servlet. |
void |
setDefaultFormat(int value)
Set set this property to define the default data format for this service.
|
void |
setDefaultPageSize(int value)
Set default page size for server-driven paging.
|
void |
setDeleteRequiresEntityTag(boolean value)
Set set this to
false if clients must provide "If-Match: |
void |
setInputContentLengthLimit(int value)
Set should this service limit input content length.
|
void |
setInvokeWithDefaultValues(boolean value)
Set should
DataServlet.invokeAction , DataServlet.invokeFunction apply the default values for properties of the passed action and function parameters not provided by the client? Defaults to true . |
void |
setMaximumActiveDemandRefreshThreads(int value)
Set the maximum number of on-demand cache refresh threads which may be simultaneously active.
|
void |
setMaximumActiveFastRefreshThreads(int value)
Set the maximum number of scheduled "fast" cache refresh threads which may be simultaneously active.
|
void |
setMaximumActiveSlowRefreshThreads(int value)
Set the maximum number of scheduled "slow" cache refresh threads which may be simultaneously active.
|
void |
setMaximumGraphSize(int value)
Set maximum graph size for server-driven paging.
|
void |
setMustInitializeOptionalProperties(boolean value)
Set should
DataServlet.createEntity , DataServlet.updateEntity . |
void |
setMustInitializeRequiredProperties(boolean value)
Set should
DataServlet.createEntity , DataServlet.updateEntity , DataServlet.invokeAction , DataServlet.invokeFunction apply default values for required (non-nullable) properties. |
void |
setPrettyTracing(boolean value)
Set should
DataServlet.traceWithData show pretty-printed JSON/XML content? |
void |
setRepeatabilityDays(int value)
Set the number of days that logs of repeatable requests should be retained in order to allow their successful repeated execution (defaults to 50).
|
void |
setRequiresAuthentication(boolean value)
Set set this property to
true if the service requires authentication for all requests. |
void |
setRequiresTransaction(boolean value)
Set set this property to
true if the service requires transactions for all requests (even for GET / HEAD / POST requests, which would otherwise be executed without a transaction). |
void |
setReturnContentAfterCreate(boolean value)
Set can entity properties be returned in the HTTP response after an entity is created? Defaults to
true . |
void |
setReturnContentAfterUpdate(boolean value)
Set can entity properties be returned in the HTTP response after an entity is updated? Defaults to
true . |
void |
setReturnETagWithNoContent(boolean value)
Set ordinarily per RFC7231 section 4.3.4, a 204 (No Content) response for a PUT request
should have no ETag unless the request's representation data was saved without any transformation applied to the body.
|
void |
setSendErrorInnerDetails(boolean value)
Set should this service send inner error details to clients when exceptions are thrown? Defaults to
false . |
void |
setServiceName(java.lang.String value)
Set the service name.
|
void |
setSlowRefreshCountThreshold(int value)
Set a cache refresh will be considered "slow" if its result count exceeds this value.
|
void |
setSlowRefreshTimeThreshold(int value)
Set a cache refresh will be considered "slow" if its execution time count exceeds this value.
|
void |
setStreamDeltaResponses(boolean value)
Set should this service use streaming for delta responses? Defaults to
false . |
void |
setSupportsMultitenancy(boolean value)
Set is this servlet multi-tenant-aware? Defaults to
false . |
void |
setSupportsRepeatability(boolean value)
Set should handle repeatability request headers (RequestID, RepeatabilityCreation).
|
void |
setSupportsTransaction(boolean value)
Set set this property to
false if the service does not support transactions. |
void |
setThreadLocalTenant(java.lang.String value)
Set thread-local tenant ID.
|
void |
setTraceRequests(boolean value)
Set set this property to enable request tracing for this service.
|
void |
setTraceWithData(boolean value)
Set if
DataServlet.traceRequests is also true , should all requests for this data service be traced with data? Defaults to false . |
void |
setTrackChangesByDefault(boolean value)
Set should this service assume "Prefer: odata.track-changes" even if the client didn't send that header? Defaults to false.
|
void |
setUpdateRequiresEntityTag(boolean value)
Set set this to
false if clients must provide "If-Match: |
void |
setUpdateWithDefaultValues(boolean value)
Set should
DataServlet.updateEntity automatically apply default values for properties not provided by the client? Defaults to true . |
void |
startCacheRefreshThread(EntityHandler handler,
EntitySet entitySet,
com.sap.cloud.server.odata.core.ThreadShutdown shutdown)
Start a background thread for refreshing the cache for an entity set.
|
boolean |
supportsDelta(DataQuery query,
HttpRequest request)
Determine if this service supports delta responses for
query . |
void |
transaction(com.sap.cloud.server.odata.core.Action0 work)
Perform some work within a service-managed transaction.
|
void |
unbindEntities(EntityValue entity)
|
void |
unbindEntities(EntityValue entity,
Property bindingProperty)
This function may be used in the implementation of entity binding calls, e.g.
|
void |
unsetClientRegistration()
Forget the previously remembered client registration (if any).
|
void |
updateEntity(EntityValue entity)
Override this function to implement entity updates for this service.
|
void |
updateLink(EntityValue source,
Property sourceProperty,
EntityValue target)
Override this function to implement link updates for this service.
|
void |
updateLinkUsingForeignKeys(EntityValue source,
Property sourceProperty,
EntityValue target)
Default implementation of 'updateLink' using foreign keys from referential constraints in service metadata.
|
void |
uploadMedia(EntityValue entity,
ByteStream stream)
Override this function to implement media uploading for this service.
|
void |
uploadStream(EntityValue entity,
StreamLink link,
ByteStream stream)
Override this function to implement stream uploading for this service.
|
public static final int ALLOW_EXECUTE_QUERY
Allow DataServlet.executeQuery
calls.
public static final int ALLOW_CREATE_ENTITY
Allow DataServlet.createEntity
calls.
public static final int ALLOW_UPDATE_ENTITY
Allow DataServlet.updateEntity
calls.
public static final int ALLOW_DELETE_ENTITY
Allow DataServlet.deleteEntity
calls.
public static final int ALLOW_CREATE_LINK
Allow DataServlet.createLink
calls.
public static final int ALLOW_UPDATE_LINK
Allow DataServlet.updateLink
calls.
public static final int ALLOW_DELETE_LINK
Allow DataServlet.deleteLink
calls.
public static final int ALLOW_INVOKE_ACTION
Allow DataServlet.invokeAction
calls.
public static final int ALLOW_INVOKE_FUNCTION
Allow DataServlet.invokeFunction
calls.
public static final int ALLOW_CREATE_MEDIA
Allow DataServlet.createMedia
calls.
public static final int ALLOW_DOWNLOAD_MEDIA
Allow DataServlet.downloadMedia
calls.
public static final int ALLOW_DOWNLOAD_STREAM
Allow DataServlet.downloadStream
calls.
public static final int ALLOW_UPLOAD_MEDIA
Allow DataServlet.uploadMedia
calls.
public static final int ALLOW_UPLOAD_STREAM
Allow DataServlet.uploadStream
calls.
public static final int ALLOW_DELETE_STREAM
Allow DataServlet.deleteStream
calls.
public static final int ALLOW_ALL_METHODS
Allow all service calls.
protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
service
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
java.io.IOException
public void doDelete(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
doDelete
in class javax.servlet.http.HttpServlet
java.io.IOException
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
doGet
in class javax.servlet.http.HttpServlet
java.io.IOException
public void doHead(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
doHead
in class javax.servlet.http.HttpServlet
java.io.IOException
public void doOptions(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
doOptions
in class javax.servlet.http.HttpServlet
java.io.IOException
public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
doPost
in class javax.servlet.http.HttpServlet
java.io.IOException
public void doPut(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
doPut
in class javax.servlet.http.HttpServlet
java.io.IOException
public boolean getBooleanSetting(java.lang.Class inClass, java.lang.String name, boolean defaultValue)
inClass
- Settings class.name
- Setting name.defaultValue
- Default value.public void addMetadataCapabilities()
Add annotations to this service's metadata so that clients will be informed what the server can do.
public void allowUnused(java.lang.Object value)
Helper function so generated subclasses can explicitly ignore a value.
value
- Value to be ignored.public GlobalDateTime backendTimeNow()
Return the current UTC date/time, as determined by the backend system.
Override this function as necessary, for example to fetch the date/time from backend system.
The default behaviour of this function is to get the UTC date/time from a SQL database
(if this.dataService.provider
is a SQLDatabaseProvider
),
or from the current system (which is inappropriate if the backend system is on a separate host).
public void bindEntities(EntityValue entity)
entity
- Entity parameter.public void bindEntities(EntityValue entity, Property bindingProperty)
entity
- Entity parameter.bindingProperty
- BindingProperty parameter.public void bindEntities(EntityValue entity, Property bindingProperty, boolean afterCreate)
entity
- Entity parameter.bindingProperty
- BindingProperty parameter.afterCreate
- AfterCreate parameter.public void bindEntities(EntityValue entity, Property bindingProperty, boolean afterCreate, boolean afterUpdate)
This function may be used in the implementation of entity binding calls, e.g. by EntityValue.bindEntity
.
It relies on the existence of appropriate referential constraints in the service metadata, or an appropriately set join entity set.
entity
- Source entity, which may contain inline bindings for the binding property.bindingProperty
- (nullable) Binding property. If null
, then all of the source's navigation properties are considered.afterCreate
- Is this call for binding after createEntity has created entity
? Defaults to false.afterUpdate
- Is this call for binding after updateEntity has updated entity
? Defaults to false.public void bindEntitiesAfterCreate(EntityValue entity)
entity
- Entity parameter.public void bindEntitiesAfterCreate(EntityValue entity, Property bindingProperty)
This function may be used in the implementation of entity binding calls after the main create action of DataServlet.createEntity
.
It relies on the existence of appropriate referential constraints in the service metadata.
entity
- Source entity, which may contain inline bindings for the binding property.bindingProperty
- (nullable) Binding property. If null
, then all of the source's navigation properties are considered.public void bindEntitiesAfterUpdate(EntityValue entity)
entity
- Entity parameter.public void bindEntitiesAfterUpdate(EntityValue entity, Property bindingProperty)
This function may be used in the implementation of entity binding calls after the main update action of DataServlet.updateEntity
.
It relies on the existence of appropriate referential constraints in the service metadata.
entity
- Source entity, which may contain inline bindings for the binding property.bindingProperty
- (nullable) Binding property. If null
, then all of the source's navigation properties are considered.public void checkServerRuntime(java.lang.String expected)
Check that the current server runtime is what is expected for a generated OData service.
expected
- One of: "sap.cf", "sap.neo", "jetty", "tomee" or "virgo".public void createChildren(EntityValue entity)
entity
- Entity parameter.public void createChildren(EntityValue entity, Property childProperty)
This function may be used in the implementation of "deep insert" calls, e.g. by DataServlet.createEntity
.
This function will execute "deep insert" if the parent-child entity relationship is fulfilled through join set.
entity
- Parent entity, which may contain inline children for the child property.childProperty
- (nullable) Child property. If null
, then all of the parent's navigation properties are considered.public void createEntity(EntityValue entity)
Override this function to implement entity creation for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
entity
- Entity to be created.public void createLink(EntityValue source, Property sourceProperty, EntityValue target)
Override this function to implement link creation for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
source
- Source entity for the link to be created.sourceProperty
- Source navigation property for the link to be created. This may be a one-to-one or one-to-many navigation property.target
- Target entity for the link to be created.public void createLinkUsingForeignKeys(EntityValue source, Property sourceProperty, EntityValue target)
Default implementation of 'createLink' using foreign keys from referential constraints in service metadata.
source
- Source entity for the link to be created.sourceProperty
- Source navigation property for the link to be created. This may be a one-to-one or one-to-many navigation property.target
- Target entity for the link to be created.public void createMedia(EntityValue entity, ByteStream stream)
Override this function to implement media creation for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
entity
- Owning entity, without key properties set.stream
- Input stream, to access uploaded content.public void createParents(EntityValue entity)
entity
- Entity parameter.public void createParents(EntityValue entity, Property parentProperty)
This function may be used in the implementation of "deep insert" calls, e.g. by DataServlet.createEntity
.
This function will not execute "deep insert" if the parent-child entity relationship is fulfilled through join set.
entity
- Child entity, which may contain inline parent(s) via the parent property.parentProperty
- (nullable) Child property. If null
, then all of the parent's navigation properties are considered.public java.lang.String currentUser()
Return the current user name, or throw DataSecurityException
if there is no current user.
DataSecurityException
if there is no current user.public java.lang.String currentUserIfAuthenticated()
Return (nullable) The current user name, or null
if there is no current user (e.g. if the service is not configured for authentication).
null
if there is no current user (e.g. if the service is not configured for authentication).public void deleteChildren(EntityValue entity)
entity
- Entity parameter.public void deleteChildren(EntityValue entity, Property childProperty)
This function may be used in the implementation of "on delete" actions, e.g. by DataServlet.deleteEntity
.
entity
- Parent entity.childProperty
- (nullable) Child property. If `null`, then all of the parent's navigation properties are considered.public void deleteEntity(EntityValue entity)
Override this function to implement entity deletion for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
entity
- Entity to be deleted.public void deleteLink(EntityValue source, Property sourceProperty, EntityValue target)
Override this function to implement link deletion for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
source
- Source entity for the link to be deleted.sourceProperty
- Source navigation property for the link to be deleted. This may be a one-to-one or one-to-many navigation property.target
- Target entity for the link to be deleted. Ignored for a one-to-one navigation property, where sourceProperty unambiguously identifies the link to be deleted.public void deleteLinkUsingForeignKeys(EntityValue source, Property sourceProperty, EntityValue target)
Default implementation of 'deleteLink' using foreign keys from referential constraints in service metadata.
source
- Source entity for the link to be created.sourceProperty
- Source navigation property for the link to be created. This may be a one-to-one or one-to-many navigation property.target
- Target entity for the link to be created.public void deleteStream(EntityValue entity, StreamLink link)
Override this function to implement stream delete for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
entity
- Owning entity, with key properties set.link
- Stream link, identifying the stream property the client is deleting.public void downloadMedia(EntityValue entity, ByteStream stream)
Override this function to implement media downloading for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
entity
- Owning entity, with key properties set.stream
- Output stream, to receive downloaded content.public void downloadStream(EntityValue entity, StreamLink link, ByteStream stream)
Override this function to implement stream downloading for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
entity
- Owning entity, with key properties set.link
- Stream link, identifying the stream property the client is downloading.stream
- Output stream, to receive downloaded content.public DataValue executeQuery(DataQuery query)
Override this function to implement data queries for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
query
- Query to be executed.public void expandItem(EntityValue entity, ExpandItem item)
Override this function to implement item expansion for this service. If not overridden, referential constraints are used to implement automatic expansion.
entity
- Entity whose item is to be expanded.item
- Item to be expanded.public void expandItems(DataQuery query, DataValue result)
If query
contains any DataQuery.expandItems
, apply them to result
.
query
- Query which may optionally contain expand items.result
- (nullable) Query result, to which item expansion may be applied (if not null
, the result should be an entity value or entity list).public java.lang.String generateETag()
Return a "weak" HTTP ETag (entity tag).
public void generateKey(EntityValue entity)
entity
- Entity parameter.public void generateKey(EntityValue entity, Property property)
Generate a primary key for entity
.
Override this function to implement custom key generation.
entity
- Entity requiring key generatiuon.property
- (nullable) Key property to be generated. If null
, all key properties of entity
will be generated.public boolean getAllowIfMatchAny()
Return set this to true
if clients will not be permitted to use "If-Match: *" in updates when optimistic concurrency is enabled. Defaults to true
.
true
if clients will not be permitted to use "If-Match: *" in updates when optimistic concurrency is enabled. Defaults to true
.public boolean getAllowNestedPaging()
Return allow nested next-links in multi-level result (when one or more levels of $expand is used in the client's query). Defaults to false
.
Clients by default might not expect nested paging, so if this property is configured to true
, clients must be coded to
handle the nested next-links that will occur in query results.
false
.public boolean getAllowNonPatchUpdates()
Return should this service allow entity updates via PUT (in addition to PATCH which is always allowed)? Defaults to false
.
Set this property to return true
if you want to allow PUT requests.
Note: PATCH is the preferred mechanism for updates with OData.
Allowing PUT can result in data loss when round-tripping properties that the client may not know about in advance, such as open or added properties, or properties not specified in metadata.
false
.public int getAllowedMethods()
Return set this property to define the legal access methods for this service. Defaults to ALLOW_ALL_METHODS.
public boolean getApplyPatchBeforeUpdate()
Return should this service apply a patch request to an entity before calling DataServlet.updateEntity
? Defaults to true
.
Set this property to false
when you also override updateEntity, if the overridden operation will do existence checking itself.
DataServlet.updateEntity
? Defaults to true
.public DataService getBackendService()
Return override this property to return a delegate data service for communication with a backend system.
This is used when caching (staging) a backend service with a SQL database.
By default, this property will return the DataServlet.dataService
.
public boolean getCheckExistingBeforeCreate()
Return should this service check for an existence of an existing entity before calling DataServlet.createEntity
? Defaults to false
.
Set this property to true
when you also override createEntity, if the overridden operation will do existence checking itself.
DataServlet.createEntity
? Defaults to false
.public boolean getCheckExistingBeforeDelete()
Return should this service check for an existence of an existing entity before calling DataServlet.deleteEntity
? Defaults to true
.
Set this property to false
when you also override deleteEntity, if the overridden operation will do existence checking itself.
DataServlet.deleteEntity
? Defaults to true
.public boolean getCheckExistingBeforeDownload()
Return should this service check for an existence of an existing entity before calling DataServlet.downloadMedia
or DataServlet.downloadStream
.
Set this property to false
when you also override downloadMedia/downloadStream, if the overridden operation will do existence checking itself.
DataServlet.downloadMedia
or DataServlet.downloadStream
.public boolean getCheckExistingBeforeLinking()
Return should this service check for an existence of an existing entity before calling DataServlet.createLink
, DataServlet.updateLink
or DataServlet.deleteLink
? Defaults to true
.
Set this property to false
when you also override createLink/updateLink/deleteLink, if the overridden operation will do existence checking itself.
DataServlet.createLink
, DataServlet.updateLink
or DataServlet.deleteLink
? Defaults to true
.public boolean getCheckExistingBeforeUpdate()
Return should this service check for an existence of an existing entity before calling DataServlet.updateEntity
? Defaults to true
.
Set this property to false
when you also override updateEntity, if the overridden operation will do existence checking itself.
DataServlet.updateEntity
? Defaults to true
.public boolean getCheckExistingBeforeUpload()
Return should this service check for an existence of an existing entity before calling DataServlet.uploadMedia
or DataServlet.uploadStream
.
Set this property to false
when you also override uploadMedia/uploadStream, if the overridden operation will do existence checking itself.
DataServlet.uploadMedia
or DataServlet.uploadStream
.public GuidValue getClientGUID()
Return the value of request header "Client-Instance-ID", or throw DataException
if it is missing/invalid.
DataException
if it is missing/invalid.public long getClientID()
Return the client ID number corresponding to request header "Client-Instance-ID", or throw DataException
if it is missing/invalid.
DataException
if it is missing/invalid.public EntityValue getClientRegistration()
Return an entity value for the current client registration, and remember it to save time if it is requested again later. Throw DataException
if no registration is found.
Assumes that a ClientRegistration
entity type exists in the service metadata, and Client-Instance-ID
HTTP request parameter is available.
DataException
if no registration is found.public boolean getCreateWithDefaultValues()
Return should DataServlet.createEntity
automatically apply default values for properties not provided by the client? Defaults to true
.
If this property is false
, then the implementer of DataServlet.createEntity
must take responsibility for initialization of missing properties.
DataServlet.createEntity
automatically apply default values for properties not provided by the client? Defaults to `true`.public static HttpRequest getCurrentBatchRequest()
Return (nullable) The current thread's request batch, or null
if there is no current batch request.
public static HttpRequest getCurrentRequest()
Return (nullable) The current thread's HTTP request, or null
if there is no current HTTP request.
public static DataServlet getCurrentServlet()
Return (nullable) The current thread's data servlet, or null
if there is no current data servlet.
public abstract DataService getDataService()
Return override this property to return a delegate data service that provides metadata for this service.
If DataService.provider
is not metadata-only, then DataServlet.dataService
will also be used to provide a default implementation of any of the data access methods
(DataServlet.metadataText
, DataServlet.executeQuery
,
DataServlet.createEntity
, DataServlet.updateEntity
, DataServlet.deleteEntity
,
DataServlet.createLink
, DataServlet.updateLink
, DataServlet.deleteLink
,
DataServlet.invokeAction
, DataServlet.invokeFunction
,
DataServlet.createMedia
, DataServlet.downloadMedia
, DataServlet.downloadStream
,
DataServlet.uploadMedia
, DataServlet.uploadStream
, DataServlet.deleteStream
)
that have not been overridden.
public DataTransaction getDataTransaction()
Return override this property to specify a custom transaction manager.
This property specifies a transaction manager which manages the transaction boundaries for
change sets within batch requests, as well as individual change requests.
If DataServlet.dataService
is configured for access to a local (server-side) database, then its
DataService.dataTransaction
will be suitable for use as a default transaction manager
for transactional work performed solely within that database.
Otherwise if non-data-service-managed database resources are accessed, or if multiple database
resources are accessed within a single transaction (requiring two-phase commit),
then this property must be overridden to provide access to a suitable transaction manager (e.g. JTA).
public int getDefaultFormat()
Return set this property to define the default data format for this service. Defaults to DataFormat.JSON.
public int getDefaultPageSize()
Return default page size for server-driven paging. This is the number of top level entities in the query result graph. A zero value implies no default. Server-side paging is disabled by default. However it is recommended to configure this property to a reasonable value, e.g. 1000.
public boolean getDeleteRequiresEntityTag()
Return set this to false
if clients must provide "If-Match: true
.
false
if clients must provide "If-Match: true
.public DeltaStreamWriter getDeltaStream(DataQuery query, EntityValueList result, DataContext context, int format, HttpRequest request)
public int getInputContentLengthLimit()
Return should this service limit input content length. Defaults to zero (no limit). If this property is greater than zero, then the client will receive an exception if input content length is excessive. Set this property to a value greater than zero to help avoid denial-of-service attacks.
public boolean getInvokeWithDefaultValues()
Return should DataServlet.invokeAction
, DataServlet.invokeFunction
apply the default values for properties of the passed action and function parameters not provided by the client? Defaults to true
.
If this property is false
, then the implementer of DataServlet.invokeAction
, DataServlet.invokeFunction
must take responsibility for initialization of missing properties.
DataServlet.invokeAction
, DataServlet.invokeFunction
apply the default values for properties of the passed action and function parameters not provided by the client? Defaults to `true`.public int getMaximumActiveDemandRefreshThreads()
Return the maximum number of on-demand cache refresh threads which may be simultaneously active. Defaults to 5.
public int getMaximumActiveFastRefreshThreads()
Return the maximum number of scheduled "fast" cache refresh threads which may be simultaneously active. Defaults to 5.
public int getMaximumActiveSlowRefreshThreads()
Return the maximum number of scheduled "slow" cache refresh threads which may be simultaneously active. Defaults to 1.
public int getMaximumGraphSize()
Return maximum graph size for server-driven paging. This is the number of entities in a query result graph (including expanded children). A zero value implies no maximum. Server-side paging is disabled by default. However it is recommended to configure this property to a reasonable value, e.g. 10000.
public CsdlDocument getMetadata()
Return the service metadata for DataServlet.dataService
.
DataServlet.dataService
.public boolean getMustInitializeOptionalProperties()
Return should DataServlet.createEntity
, DataServlet.updateEntity
. DataServlet.invokeAction
, DataServlet.invokeFunction
apply default values for optional (nullable) properties. Defaults to true
.
DataServlet.createEntity
, DataServlet.updateEntity
. DataServlet.invokeAction
, DataServlet.invokeFunction
apply default values for optional (nullable) properties. Defaults to true
.public boolean getMustInitializeRequiredProperties()
Return should DataServlet.createEntity
, DataServlet.updateEntity
, DataServlet.invokeAction
, DataServlet.invokeFunction
apply default values for required (non-nullable) properties. Defaults to true
.
DataServlet.createEntity
, DataServlet.updateEntity
, DataServlet.invokeAction
, DataServlet.invokeFunction
apply default values for required (non-nullable) properties. Defaults to true
.public boolean getPrettyTracing()
Return should DataServlet.traceWithData
show pretty-printed JSON/XML content?
DataServlet.traceWithData
show pretty-printed JSON/XML content?public int getRepeatabilityDays()
Return the number of days that logs of repeatable requests should be retained in order to allow their successful repeated execution (defaults to 50).
public DataService getRepeatabilityService()
Return override this property to return a delegate data service that manages the repeatability status of the requests.
By default, it is assumed that DataServlet.dataService
will be able to manage repeatability.
public static HttpRequest getRequiredCurrentRequest()
Return the current (active) request on the current thread, or throw DataServiceException
if there is no active request on the current thread.
DataServiceException
if there is no active request on the current thread.public static DataServlet getRequiredCurrentServlet()
Return the servlet which is servicing the current (active) request on the current thread, or throw DataServiceException
if there is no active request on the current thread.
DataServiceException
if there is no active request on the current thread.public DataValue getRequiredHeaderValue(EntityType entityType, java.lang.String headerName)
Obtain the value of a structure property within a required HTTP header in the current servlet request. The header structure value should be encoded using OData JSON format wrapped as a data URI with media type "application/json" and base64-encoded data.
entityType
- (nullable) Entity type, whose name (if provided) will be prefixed to the headerName
name to determine the structure type for the header value.headerName
- Header name, e.g. "CreateParameters.Reason" to obtain the "Reason" property value inside the entity value for HTTP header "X-Create-Parameters".public boolean getRequiresAuthentication()
Return set this property to true
if the service requires authentication for all requests. Defaults to false
.
true
if the service requires authentication for all requests. Defaults to false
.public boolean getRequiresTransaction()
Return set this property to true
if the service requires transactions for all requests (even for GET / HEAD / POST requests, which would otherwise be executed without a transaction). Defaults to false
.
public boolean getReturnContentAfterCreate()
Return can entity properties be returned in the HTTP response after an entity is created? Defaults to true
.
If true
, entity properties will be returned if requested by the client (using "Prefer: return-content" header for OData V1-V3 or "Prefer: return=representation" for OData V4+), or if returning properties is the default behaviour specified for the OData version used in the HTTP request.
Set this property to false
to prevent content from being returned, forcing HTTP response status 204 (No Content).
true
.public boolean getReturnContentAfterUpdate()
Return can entity properties be returned in the HTTP response after an entity is updated? Defaults to true
.
If true
, entity properties will be returned if requested by the client (using "Prefer: return-content" header for OData V1-V3 or "Prefer: return=representation" for OData V4+), or if returning properties is the default behaviour specified for the OData version used in the HTTP request.
Set this property to false
to prevent content from being returned, forcing HTTP response status 204 (No Content).
true
.public boolean getReturnETagWithNoContent()
Return ordinarily per RFC7231 section 4.3.4, a 204 (No Content) response for a PUT request
should have no ETag unless the request's representation data was saved without any transformation applied to the body.
This property defaults to true
to allow easy interoperability with OData clients which may expect an ETag with response status 204, even though such expectations are at variance with RFC7231.
To ensure compliance with RFC7231, this property can be set false
which will omit the ETag with response status 204.
public boolean getSendErrorInnerDetails()
Return should this service send inner error details to clients when exceptions are thrown? Defaults to false
.
Set this property to true
only if you are confident that will not result in
Information Leakage to untrusted or insufficiently authorized users.
For example, a server running in debugging mode, or when servicing a user with an administrator account, might be able to safely reveal such error details.
false
.public java.lang.String getServiceName()
Return the service name.
public int getSlowRefreshCountThreshold()
Return a cache refresh will be considered "slow" if its result count exceeds this value. Defaults to 100000 results.
public int getSlowRefreshTimeThreshold()
Return a cache refresh will be considered "slow" if its execution time count exceeds this value. Defaults to 60 seconds.
public boolean getStreamDeltaResponses()
Return should this service use streaming for delta responses? Defaults to false
.
Using streaming can help to minimize memory utilization during the production of large responses.
To enable streaming, the DataServlet.dataService
must delegate to a provider (e.g. SQLDatabaseProvider
) that supports streaming.
Set this property to true
to enable streamed responses for OData query responses with change tracking (Prefer: odata.track-changes).
This applies to initial download (when query excludes $deltatoken) and delta download (when query includes $deltatoken).
false
.public boolean getSupportsChangeTracking()
Return does this service support change tracking? Returns true
if dataService
uses InMemoryDatabase
or SQLDatabaseProvider
enabled for change tracking. Otherwise returns false
.
Override this property to return true
if this service is using another kind of provider that supports change tracking.
true
if dataService
uses InMemoryDatabase
or SQLDatabaseProvider
enabled for change tracking. Otherwise returns false
.public boolean getSupportsMultitenancy()
Return is this servlet multi-tenant-aware? Defaults to false
.
public boolean getSupportsRepeatability()
Return should handle repeatability request headers (RequestID, RepeatabilityCreation).
public boolean getSupportsTransaction()
Return set this property to false
if the service does not support transactions. Defaults to true
.
Any work performed in a non-transactional context will not be rolled back upon failure.
For OData change sets within request batches, that would result in non-standard behaviour.
public java.lang.String getThreadLocalTenant()
Return thread-local tenant ID.
public boolean getTraceRequests()
Return set this property to enable request tracing for this service. Defaults to false
.
false
.public boolean getTraceWithData()
Return if DataServlet.traceRequests
is also true
, should all requests for this data service be traced with data? Defaults to false
.
Note that care must be taken when enabling tracing with data, as the resulting log files may contain sensitive information.
On the other hand, tracing with data may sometimes be invaluable for troubleshooting purposes.
DataServlet.traceRequests
is also true
, should all requests for this data service be traced with data? Defaults to false
.public boolean getTrackChangesByDefault()
Return should this service assume "Prefer: odata.track-changes" even if the client didn't send that header? Defaults to false. OData V4 clients should send that header explicitly if they want change tracking, but pre-V4 clients might not do so.
public boolean getUpdateRequiresEntityTag()
Return set this to false
if clients must provide "If-Match: true
.
false
if clients must provide "If-Match: true
.public boolean getUpdateWithDefaultValues()
Return should DataServlet.updateEntity
automatically apply default values for properties not provided by the client? Defaults to true
.
If this property is false
, then the implementer of DataServlet.updateEntity
must take responsibility for initialization of missing properties.
DataServlet.updateEntity
automatically apply default values for properties not provided by the client? Defaults to `true`.public DataValue invokeAction(EntityValue entity, DataMethod method, ParameterList parameters)
Override this function to implement action invocation for this service.
Do not override this function if you are DataServlet.registerMethodHandler
or if you wish to delegate automatically to DataServlet.dataService
.
entity
- (nullable) Entity binding parameter (for a bound action that is bound to an entity type), otherwise null
.method
- Data method for the action.parameters
- Action parameters.public DataValue invokeFunction(EntityValue entity, DataMethod method, ParameterList parameters)
Override this function to implement function invocation for this service.
Do not override this function if you are DataServlet.registerMethodHandler
or if you wish to delegate automatically to DataServlet.dataService
.
entity
- (nullable) Entity binding parameter (for a bound function that is bound to an entity type), otherwise null
.method
- Data method for the function.parameters
- Function parameters.public boolean isUserInRole(java.lang.String role)
Return true
if the current user has the provided security role
.
role
- Security role name.true
if the current user has the provided security role
.public void loadInitialData(boolean includeTestData)
Load initial data from web application resource subfolders into the DataServlet.dataService
.
The initial data subfolder is named "initial-data". Optionally test data can also be loaded from the "test-data" subfolder.
In a Maven webapp project (in source code), the resource subfolders are located inside "src/main/resources"
.
For a compiled Java servlet-based application, the resource subfolders are located inside "WEB-INF/classes"
.
Each initial data file in a resource subfolder is a file with name "EntitySetName.json".
The file contents should be a JSON array of objects representing an OData entity set, where each object uses the OData JSON representation for entity properties.
A file may contain nested child entities using OData "deep insert" representation.
includeTestData
- Include test data?public void logBackgroundError(java.lang.String message)
message
- Message parameter.public void logBackgroundError(java.lang.String message, java.lang.RuntimeException error)
message
- Message parameter.error
- Error parameter.public void logBackgroundError(java.lang.String message, java.lang.RuntimeException error, boolean dump)
Override this function to customize the logging of service errors detected by background threads.
message
- Warning message.error
- (nullable) Associated exception.dump
- Dump stack trace?public void logBackgroundWarning(java.lang.String message)
message
- Message parameter.public void logBackgroundWarning(java.lang.String message, java.lang.RuntimeException error)
message
- Message parameter.error
- Error parameter.public void logBackgroundWarning(java.lang.String message, java.lang.RuntimeException error, boolean dump)
Override this function to customize the logging of service warnings detected by background threads.
message
- Warning message.error
- (nullable) Associated exception.dump
- Dump stack trace?public void logError(HttpRequest request, java.lang.RuntimeException error, java.lang.String content)
Override this function to customize the logging of service errors.
request
- Service request.error
- (nullable) Caught exception, or null
.content
- (nullable) Error content (JSON or XML format, depending on the client's Accept header).public void logInfo(java.lang.String message)
Override this function to customize the logging of service informational messages.
message
- Informational message.public java.lang.String metadataText(int format, int version, java.lang.String language, java.lang.String document)
Override this function to return metadata document text of the service for the client.
The default behaviour (if not overridden) is to return metadata document text from DataServlet.dataService
.
format
- Requested metadata format (e.g. JSON or XML).version
- Requested data version (e.g. ODATA_V4).language
- (nullable) Client's preferred language (if known).document
- (nullable) Client's requested document (e.g. CSDL Reference document), or `null` if the service "$metadata" document was requested.public java.lang.String nextTraceID()
Return a unique ID for tracing of a request. The ID should be unique across multiple requests to the same service, but need not be unique within a cluster or across server restarts.
public void prepareForTenant()
This function should be overridden if DataServlet.supportsMultitenancy
is true
, to perform any necessary once-only actions to ready the execution environment for a particular tenant.
This will be called only once per tenant, and DataServlet.requestForTenant
will have been called beforehand.
public void propagateKeys(EntityValue parent, Property childProperty, EntityValue child)
This function may be used in the implementation of createRelatedEntity
, to propagate key(s) from a parent entity to foreign keys in its child.
parent
- Parent entity.childProperty
- Child property.child
- Child entity.public void registerEntityHandler(EntityType entityType, EntityHandler handler)
Register an entity handler with an entity type. Subsequently the entity handler functions will be invoked to implement associated entity operations.
entityType
- Entity type.handler
- Entity handler.public void registerEntityListener(EntityType entityType, EntityListener listener)
Register an entity listener with an entity type. Subsequently the entity listener functions will be invoked before/after associated entity operations.
entityType
- Entity type.listener
- Entity listener.public void registerEntitySetHandler(EntitySet entitySet, EntityHandler handler)
Register an entity handler with an entity set.
Subsequently the entity handler functions will be invoked to implement associated entity operations.
If an entity set has no handler, then the handler for its EntitySet.entityType
will be used if available.
entitySet
- Entity set.handler
- Entity handler.public void registerEntitySetListener(EntitySet entitySet, EntityListener listener)
Register an entity listener with an entity set.
Subsequently the entity listener functions will be invoked before/after associated entity operations.
If an entity set has no listener, then the listener for its EntitySet.entityType
will be used if available.
entitySet
- Entity set.listener
- Entity listener.public void registerMethodHandler(DataMethod dataMethod, MethodHandler handler)
Register a method handler with a data method. Subsequently the method handler functions will be invoked to implement associated method operations.
dataMethod
- Data method.handler
- Method handler.public java.lang.String requestForTenant(HttpRequest request)
This function should be overridden if DataServlet.supportsMultitenancy
is true
, to fetch the tenant ID from an incoming request.
request
- Incoming request.null
if no tenant ID was provided.public EntityValue selectEntity(EntityValue entity)
Return newly loaded copy of entity
with all structural properties selected.
entity
- Entity value.entity
with all structural properties selected.public void service(HttpRequest request)
Handle an incoming service request, by delegating to the appropriate handler function.
DataServlet.createEntity
, DataServlet.updateEntity
, DataServlet.deleteEntity
,
DataServlet.createLink
, DataServlet.updateLink
, DataServlet.deleteLink
,
DataServlet.invokeAction
, DataServlet.invokeFunction
,
DataServlet.createMedia
, DataServlet.downloadMedia
, DataServlet.downloadStream
,
DataServlet.uploadMedia
, DataServlet.uploadStream
.request
- Service request.public void setAllowIfMatchAny(boolean value)
Set set this to true
if clients will not be permitted to use "If-Match: *" in updates when optimistic concurrency is enabled. Defaults to true
.
value
- Set this to true
if clients will not be permitted to use "If-Match: *" in updates when optimistic concurrency is enabled. Defaults to true
.public void setAllowNestedPaging(boolean value)
Set allow nested next-links in multi-level result (when one or more levels of $expand is used in the client's query). Defaults to false
.
Clients by default might not expect nested paging, so if this property is configured to true
, clients must be coded to
handle the nested next-links that will occur in query results.
value
- Allow nested next-links in multi-level result (when one or more levels of $expand is used in the client's query). Defaults to false
.public void setAllowNonPatchUpdates(boolean value)
Set should this service allow entity updates via PUT (in addition to PATCH which is always allowed)? Defaults to false
.
Set this property to return true
if you want to allow PUT requests.
Note: PATCH is the preferred mechanism for updates with OData.
Allowing PUT can result in data loss when round-tripping properties that the client may not know about in advance, such as open or added properties, or properties not specified in metadata.
value
- Should this service allow entity updates via PUT (in addition to PATCH which is always allowed)? Defaults to false
.public void setAllowedMethods(int value)
Set set this property to define the legal access methods for this service. Defaults to ALLOW_ALL_METHODS.
value
- Set this property to define the legal access methods for this service. Defaults to ALLOW_ALL_METHODS.public void setApplyPatchBeforeUpdate(boolean value)
Set should this service apply a patch request to an entity before calling DataServlet.updateEntity
? Defaults to true
.
Set this property to false
when you also override updateEntity, if the overridden operation will do existence checking itself.
value
- Should this service apply a patch request to an entity before calling DataServlet.updateEntity
? Defaults to true
.public void setCheckExistingBeforeCreate(boolean value)
Set should this service check for an existence of an existing entity before calling DataServlet.createEntity
? Defaults to false
.
Set this property to true
when you also override createEntity, if the overridden operation will do existence checking itself.
value
- Should this service check for an existence of an existing entity before calling DataServlet.createEntity
? Defaults to false
.public void setCheckExistingBeforeDelete(boolean value)
Set should this service check for an existence of an existing entity before calling DataServlet.deleteEntity
? Defaults to true
.
Set this property to false
when you also override deleteEntity, if the overridden operation will do existence checking itself.
value
- Should this service check for an existence of an existing entity before calling DataServlet.deleteEntity
? Defaults to true
.public void setCheckExistingBeforeDownload(boolean value)
Set should this service check for an existence of an existing entity before calling DataServlet.downloadMedia
or DataServlet.downloadStream
.
Set this property to false
when you also override downloadMedia/downloadStream, if the overridden operation will do existence checking itself.
value
- Should this service check for an existence of an existing entity before calling DataServlet.downloadMedia
or DataServlet.downloadStream
.public void setCheckExistingBeforeLinking(boolean value)
Set should this service check for an existence of an existing entity before calling DataServlet.createLink
, DataServlet.updateLink
or DataServlet.deleteLink
? Defaults to true
.
Set this property to false
when you also override createLink/updateLink/deleteLink, if the overridden operation will do existence checking itself.
value
- Should this service check for an existence of an existing entity before calling DataServlet.createLink
, DataServlet.updateLink
or DataServlet.deleteLink
? Defaults to true
.public void setCheckExistingBeforeUpdate(boolean value)
Set should this service check for an existence of an existing entity before calling DataServlet.updateEntity
? Defaults to true
.
Set this property to false
when you also override updateEntity, if the overridden operation will do existence checking itself.
value
- Should this service check for an existence of an existing entity before calling DataServlet.updateEntity
? Defaults to true
.public void setCheckExistingBeforeUpload(boolean value)
Set should this service check for an existence of an existing entity before calling DataServlet.uploadMedia
or DataServlet.uploadStream
.
Set this property to false
when you also override uploadMedia/uploadStream, if the overridden operation will do existence checking itself.
value
- Should this service check for an existence of an existing entity before calling DataServlet.uploadMedia
or DataServlet.uploadStream
.public void setCreateWithDefaultValues(boolean value)
Set should DataServlet.createEntity
automatically apply default values for properties not provided by the client? Defaults to true
.
If this property is false
, then the implementer of DataServlet.createEntity
must take responsibility for initialization of missing properties.
value
- Should DataServlet.createEntity
automatically apply default values for properties not provided by the client? Defaults to `true`.public static void setCurrentBatchRequest(HttpRequest value)
Set the current thread's request batch, or null
if there is no current batch request.
value
- The current thread's request batch, or `null` if there is no current batch request.public static void setCurrentRequest(HttpRequest value)
Set the current thread's HTTP request, or null
if there is no current HTTP request.
value
- The current thread's HTTP request, or `null` if there is no current HTTP request.public static void setCurrentServlet(DataServlet value)
Set the current thread's data servlet, or null
if there is no current data servlet.
value
- The current thread's data servlet, or `null` if there is no current data servlet.public void setDefaultFormat(int value)
Set set this property to define the default data format for this service. Defaults to DataFormat.JSON.
value
- Set this property to define the default data format for this service. Defaults to DataFormat.JSON.public void setDefaultPageSize(int value)
Set default page size for server-driven paging. This is the number of top level entities in the query result graph. A zero value implies no default. Server-side paging is disabled by default. However it is recommended to configure this property to a reasonable value, e.g. 1000.
value
- Default page size for server-driven paging. This is the number of top level entities in the query result graph. A zero value implies no default.public void setDeleteRequiresEntityTag(boolean value)
Set set this to false
if clients must provide "If-Match: true
.
value
- Set this to false
if clients must provide "If-Match: true
.public void setInputContentLengthLimit(int value)
Set should this service limit input content length. Defaults to zero (no limit). If this property is greater than zero, then the client will receive an exception if input content length is excessive. Set this property to a value greater than zero to help avoid denial-of-service attacks.
value
- Should this service limit input content length. Defaults to zero (no limit).public void setInvokeWithDefaultValues(boolean value)
Set should DataServlet.invokeAction
, DataServlet.invokeFunction
apply the default values for properties of the passed action and function parameters not provided by the client? Defaults to true
.
If this property is false
, then the implementer of DataServlet.invokeAction
, DataServlet.invokeFunction
must take responsibility for initialization of missing properties.
value
- Should DataServlet.invokeAction
, DataServlet.invokeFunction
apply the default values for properties of the passed action and function parameters not provided by the client? Defaults to `true`.public void setMaximumActiveDemandRefreshThreads(int value)
Set the maximum number of on-demand cache refresh threads which may be simultaneously active. Defaults to 5.
value
- The maximum number of on-demand cache refresh threads which may be simultaneously active. Defaults to 5.public void setMaximumActiveFastRefreshThreads(int value)
Set the maximum number of scheduled "fast" cache refresh threads which may be simultaneously active. Defaults to 5.
value
- The maximum number of scheduled "fast" cache refresh threads which may be simultaneously active. Defaults to 5.public void setMaximumActiveSlowRefreshThreads(int value)
Set the maximum number of scheduled "slow" cache refresh threads which may be simultaneously active. Defaults to 1.
value
- The maximum number of scheduled "slow" cache refresh threads which may be simultaneously active. Defaults to 1.public void setMaximumGraphSize(int value)
Set maximum graph size for server-driven paging. This is the number of entities in a query result graph (including expanded children). A zero value implies no maximum. Server-side paging is disabled by default. However it is recommended to configure this property to a reasonable value, e.g. 10000.
value
- Maximum graph size for server-driven paging. This is the number of entities in a query result graph (including expanded children). A zero value implies no maximum.public void setMustInitializeOptionalProperties(boolean value)
Set should DataServlet.createEntity
, DataServlet.updateEntity
. DataServlet.invokeAction
, DataServlet.invokeFunction
apply default values for optional (nullable) properties. Defaults to true
.
value
- Should DataServlet.createEntity
, DataServlet.updateEntity
. DataServlet.invokeAction
, DataServlet.invokeFunction
apply default values for optional (nullable) properties. Defaults to true
.public void setMustInitializeRequiredProperties(boolean value)
Set should DataServlet.createEntity
, DataServlet.updateEntity
, DataServlet.invokeAction
, DataServlet.invokeFunction
apply default values for required (non-nullable) properties. Defaults to true
.
value
- Should DataServlet.createEntity
, DataServlet.updateEntity
, DataServlet.invokeAction
, DataServlet.invokeFunction
apply default values for required (non-nullable) properties. Defaults to true
.public void setPrettyTracing(boolean value)
Set should DataServlet.traceWithData
show pretty-printed JSON/XML content?
value
- Should DataServlet.traceWithData
show pretty-printed JSON/XML content?public void setRepeatabilityDays(int value)
Set the number of days that logs of repeatable requests should be retained in order to allow their successful repeated execution (defaults to 50).
value
- The number of days that logs of repeatable requests should be retained in order to allow their successful repeated execution (defaults to 50).public void setRequiresAuthentication(boolean value)
Set set this property to true
if the service requires authentication for all requests. Defaults to false
.
value
- Set this property to true
if the service requires authentication for all requests. Defaults to false
.public void setRequiresTransaction(boolean value)
Set set this property to true
if the service requires transactions for all requests (even for GET / HEAD / POST requests, which would otherwise be executed without a transaction). Defaults to false
.
value
- Set this property to `true` if the service requires transactions for all requests (even for GET / HEAD / POST requests, which would otherwise be executed without a transaction). Defaults to `false`.public void setReturnContentAfterCreate(boolean value)
Set can entity properties be returned in the HTTP response after an entity is created? Defaults to true
.
If true
, entity properties will be returned if requested by the client (using "Prefer: return-content" header for OData V1-V3 or "Prefer: return=representation" for OData V4+), or if returning properties is the default behaviour specified for the OData version used in the HTTP request.
Set this property to false
to prevent content from being returned, forcing HTTP response status 204 (No Content).
value
- Can entity properties be returned in the HTTP response after an entity is created? Defaults to true
.public void setReturnContentAfterUpdate(boolean value)
Set can entity properties be returned in the HTTP response after an entity is updated? Defaults to true
.
If true
, entity properties will be returned if requested by the client (using "Prefer: return-content" header for OData V1-V3 or "Prefer: return=representation" for OData V4+), or if returning properties is the default behaviour specified for the OData version used in the HTTP request.
Set this property to false
to prevent content from being returned, forcing HTTP response status 204 (No Content).
value
- Can entity properties be returned in the HTTP response after an entity is updated? Defaults to true
.public void setReturnETagWithNoContent(boolean value)
Set ordinarily per RFC7231 section 4.3.4, a 204 (No Content) response for a PUT request
should have no ETag unless the request's representation data was saved without any transformation applied to the body.
This property defaults to true
to allow easy interoperability with OData clients which may expect an ETag with response status 204, even though such expectations are at variance with RFC7231.
To ensure compliance with RFC7231, this property can be set false
which will omit the ETag with response status 204.
value
- Ordinarily per RFC7231 section 4.3.4, a 204 (No Content) response for a PUT requestpublic void setSendErrorInnerDetails(boolean value)
Set should this service send inner error details to clients when exceptions are thrown? Defaults to false
.
Set this property to true
only if you are confident that will not result in
Information Leakage to untrusted or insufficiently authorized users.
For example, a server running in debugging mode, or when servicing a user with an administrator account, might be able to safely reveal such error details.
value
- Should this service send inner error details to clients when exceptions are thrown? Defaults to false
.public void setServiceName(java.lang.String value)
Set the service name.
value
- The service name.public void setSlowRefreshCountThreshold(int value)
Set a cache refresh will be considered "slow" if its result count exceeds this value. Defaults to 100000 results.
value
- A cache refresh will be considered "slow" if its result count exceeds this value. Defaults to 100000 results.public void setSlowRefreshTimeThreshold(int value)
Set a cache refresh will be considered "slow" if its execution time count exceeds this value. Defaults to 60 seconds.
value
- A cache refresh will be considered "slow" if its execution time count exceeds this value. Defaults to 60 seconds.public void setStreamDeltaResponses(boolean value)
Set should this service use streaming for delta responses? Defaults to false
.
Using streaming can help to minimize memory utilization during the production of large responses.
To enable streaming, the DataServlet.dataService
must delegate to a provider (e.g. SQLDatabaseProvider
) that supports streaming.
Set this property to true
to enable streamed responses for OData query responses with change tracking (Prefer: odata.track-changes).
This applies to initial download (when query excludes $deltatoken) and delta download (when query includes $deltatoken).
value
- Should this service use streaming for delta responses? Defaults to false
.public void setSupportsMultitenancy(boolean value)
Set is this servlet multi-tenant-aware? Defaults to false
.
value
- Is this servlet multi-tenant-aware? Defaults to `false`.public void setSupportsRepeatability(boolean value)
Set should handle repeatability request headers (RequestID, RepeatabilityCreation).
value
- Should handle repeatability request headers (RequestID, RepeatabilityCreation).public void setSupportsTransaction(boolean value)
Set set this property to false
if the service does not support transactions. Defaults to true
.
Any work performed in a non-transactional context will not be rolled back upon failure.
For OData change sets within request batches, that would result in non-standard behaviour.
value
- Set this property to `false` if the service does not support transactions. Defaults to `true`.public void setThreadLocalTenant(java.lang.String value)
Set thread-local tenant ID.
value
- Thread-local tenant ID.public void setTraceRequests(boolean value)
Set set this property to enable request tracing for this service. Defaults to false
.
value
- Set this property to enable request tracing for this service. Defaults to false
.public void setTraceWithData(boolean value)
Set if DataServlet.traceRequests
is also true
, should all requests for this data service be traced with data? Defaults to false
.
Note that care must be taken when enabling tracing with data, as the resulting log files may contain sensitive information.
On the other hand, tracing with data may sometimes be invaluable for troubleshooting purposes.
value
- If DataServlet.traceRequests
is also true
, should all requests for this data service be traced with data? Defaults to false
.public void setTrackChangesByDefault(boolean value)
Set should this service assume "Prefer: odata.track-changes" even if the client didn't send that header? Defaults to false. OData V4 clients should send that header explicitly if they want change tracking, but pre-V4 clients might not do so.
value
- Should this service assume "Prefer: odata.track-changes" even if the client didn't send that header? Defaults to false.public void setUpdateRequiresEntityTag(boolean value)
Set set this to false
if clients must provide "If-Match: true
.
value
- Set this to false
if clients must provide "If-Match: true
.public void setUpdateWithDefaultValues(boolean value)
Set should DataServlet.updateEntity
automatically apply default values for properties not provided by the client? Defaults to true
.
If this property is false
, then the implementer of DataServlet.updateEntity
must take responsibility for initialization of missing properties.
value
- Should DataServlet.updateEntity
automatically apply default values for properties not provided by the client? Defaults to `true`.public void startCacheRefreshThread(EntityHandler handler, EntitySet entitySet, com.sap.cloud.server.odata.core.ThreadShutdown shutdown)
Start a background thread for refreshing the cache for an entity set.
handler
- Entity handler.entitySet
- Entity set.shutdown
- Signal for shutting down the started thread.public boolean supportsDelta(DataQuery query, HttpRequest request)
Determine if this service supports delta responses for query
.
If overriding this function, take care not to allow delta responses for a query if the DataServlet.executeQuery
will not ensure correct change tracking.
query
- Data query.request
- HTTP request.true
(by default) if query
does not use top/skip/count, expand/filter, key predicate, property path, function call or data transformation.public void transaction(com.sap.cloud.server.odata.core.Action0 work)
Perform some work within a service-managed transaction. If a transaction is already active, then the work will be performed within a nested transaction.
work
- Work to be executed within a transaction.public void unbindEntities(EntityValue entity)
entity
- Entity parameter.public void unbindEntities(EntityValue entity, Property bindingProperty)
This function may be used in the implementation of entity binding calls, e.g. by EntityValue.unbindEntity
.
It relies on the existence of appropriate referential constraints in the service metadata.
entity
- Source entity, which may contain inline bindings for the binding property.bindingProperty
- (nullable) Binding property. If null
, then all of the source's navigation properties are considered.public void unsetClientRegistration()
Forget the previously remembered client registration (if any).
public void updateEntity(EntityValue entity)
Override this function to implement entity updates for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
entity
- Entity to be updated.public void updateLink(EntityValue source, Property sourceProperty, EntityValue target)
Override this function to implement link updates for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
source
- Source entity for the link to be updated.sourceProperty
- Source navigation property for the link to be updated. This must be a one-to-one navigation property.target
- Target entity for the link to be updated.public void updateLinkUsingForeignKeys(EntityValue source, Property sourceProperty, EntityValue target)
Default implementation of 'updateLink' using foreign keys from referential constraints in service metadata.
source
- Source entity for the link to be created.sourceProperty
- Source navigation property for the link to be created. This may be a one-to-one or one-to-many navigation property.target
- Target entity for the link to be created.public void uploadMedia(EntityValue entity, ByteStream stream)
Override this function to implement media uploading for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
entity
- Owning entity, with key properties set.stream
- Input stream, to access uploaded content.public void uploadStream(EntityValue entity, StreamLink link, ByteStream stream)
Override this function to implement stream uploading for this service.
Do not override this function if you are usingDataServlet.registerEntityHandler
or if you wish to delegate automatically to DataServlet.dataService
.
entity
- Owning entity, with key properties set.link
- Stream link, identifying the stream property the client is uploading.stream
- Input stream, to access uploaded content.