public class JsonRequestDeserializer extends Object implements RequestDeserializer
{ "actors": [
{ "id": "1000", "first_name": "_Jack", "surname": "Daniels" },
{ "id": "1001", "first_name": "_Jack", "surname": "Smith" }
]
}
With hierarchical resources, these top-level objects could either be parents or children. They are children when the
request URI points to one parent, using its primary key(s), as in res/HierOneToMany/100. The body
contains JSON like:
{ "movies": [
{ "year": "2011", "title": "ESCAPE FROM TOMORROW", "film_id": "5000" },
{ "year": "2012", "title": "BLOOD PURPLE", "film_id": "5001" }
]
}
If the URI is generic, as in res/HierOneToMany, the top-level objects will be parents, and may contain
an array of child objects, for example:
{ "languages": [
{ "language_id": "100", "langName": "New Esperanto",
"movies": [
{ "year": "2011", "title": "ESCAPE FROM TOMORROW", "film_id": "5000" },
{ "year": "2012", "title": "BLOOD PURPLE", "film_id": "5001" }
]
},
{ "language_id": "101", "langName": "New Greek",
"movies": [
{ "year": "2012", "title": "THE DARKENING", "film_id": "5002" },
{ "year": "2012", "title": "THE LIGHTENING", "film_id": "5003" }
]
}
]
}
Each top-level object is sent off as one request to the SQL resource. If there are two-levels, then the second level
array is parsed in full, and then included in the request with the parent attributes. Note that the framework will
only operate on children if they are included, not parents and children simultaneously.| Constructor and Description |
|---|
JsonRequestDeserializer() |
| Modifier and Type | Method and Description |
|---|---|
WriteResponse |
execWrite(HttpRequestAttributes httpAttributes,
Request.Type requestType,
List<RequestValue> resIds,
SqlResource sqlResource,
String requestBody,
RequestLogger requestLogger)
Executes write request.
|
String |
getSupportedMediaType()
Returns supported media type.
|
public WriteResponse execWrite(HttpRequestAttributes httpAttributes, Request.Type requestType, List<RequestValue> resIds, SqlResource sqlResource, String requestBody, RequestLogger requestLogger) throws SqlResourceException
RequestDeserializerexecWrite in interface RequestDeserializerSqlResourceExceptionpublic String getSupportedMediaType()
RequestDeserializergetSupportedMediaType in interface RequestDeserializerCopyright © 2011-2018 restSQL Project Contributors