use of org.apache.olingo.server.api.ODataApplicationException in project teiid by teiid.
the class TeiidServiceHandler method sendResults.
private void sendResults(final DataRequest request, final ODataSQLBuilder visitor, final BaseResponse queryResponse, EdmComplexResponse response) throws ODataApplicationException, SerializerException {
if (request.getPreference(ODATA_MAXPAGESIZE) != null) {
response.writeHeader(PREFERENCE_APPLIED, // $NON-NLS-1$
ODATA_MAXPAGESIZE + "=" + request.getPreference(ODATA_MAXPAGESIZE));
}
CrossJoinResult result = (CrossJoinResult) queryResponse;
URI next = null;
if (result.getNextToken() != null) {
try {
next = new URI(request.getODataRequest().getRawRequestUri() + (request.getODataRequest().getRawQueryPath() == null ? "?$skiptoken=" : "&$skiptoken=") + result.getNextToken());
} catch (URISyntaxException e) {
throw new ODataApplicationException(e.getMessage(), 500, Locale.getDefault(), e);
}
}
response.writeComplexType(result, next);
}
use of org.apache.olingo.server.api.ODataApplicationException in project teiid by teiid.
the class TeiidServiceHandler method sendResults.
private void sendResults(final DataRequest request, final ODataSQLBuilder visitor, final BaseResponse queryResponse, EntitySetResponse response) throws ODataApplicationException, SerializerException {
if (request.getPreference(ODATA_MAXPAGESIZE) != null) {
response.writeHeader(PREFERENCE_APPLIED, // $NON-NLS-1$
ODATA_MAXPAGESIZE + "=" + request.getPreference(ODATA_MAXPAGESIZE));
}
EntityCollectionResponse result = (EntityCollectionResponse) queryResponse;
if (result.getNextToken() != null) {
try {
String nextUri = request.getODataRequest().getRawBaseUri() + request.getODataRequest().getRawODataPath() + "?" + buildNextToken(request.getODataRequest().getRawQueryPath(), result.getNextToken());
result.setNext(new URI(nextUri));
} catch (URISyntaxException e) {
throw new ODataApplicationException(e.getMessage(), 500, Locale.getDefault(), e);
} catch (MalformedURLException e) {
throw new ODataApplicationException(e.getMessage(), 500, Locale.getDefault(), e);
}
}
response.writeReadEntitySet(visitor.getContext().getEdmEntityType(), result);
}
Aggregations