@Override public void visit(EntitySetResponse response) throws ODataApplicationException, SerializerException { if (request.getPreference(ODATA_MAX_PAGE_SIZE) != null) { response.writeHeader("Preference-Applied", ODATA_MAX_PAGE_SIZE + "=" + request.getPreference(ODATA_MAX_PAGE_SIZE)); } if (details.entity == null && !request.getNavigations().isEmpty()) { response.writeReadEntitySet(details.entityType, new EntityCollection()); } else { response.writeReadEntitySet(details.entityType, details.entitySet); } }
public void writeReadEntitySet(EdmEntityType entityType, EntityCollection entitySet) throws SerializerException { assert (!isClosed()); if (entitySet == null) { writeNotFound(true); return; } if (ContentTypeHelper.isODataMetadataFull(this.responseContentType)) { buildOperations(entityType, entitySet); } // write the whole collection to response this.response.setContent(this.serializer.entityCollection(metadata, entityType, entitySet, this.options) .getContent()); writeOK(responseContentType); close(); }
@Override public void visit(EntitySetResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(EntityCollectionProcessor.class).readEntityCollection(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } });
public void writeError(ODataServerError error) { try { writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.toContentTypeString()); writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { writeServerError(true); } }
if (isCollection()) { handler.read(DataRequest.this, EntitySetResponse.getInstance(DataRequest.this, getContextURL(odata), true, response)); } else { handler.read(DataRequest.this,
entityType.getFullQualifiedName(), true); if (action != null) { entitySet.getOperations().add(buildOperation(action, buildOperationTarget(options.getContextURL()))); if (action != null) { for (Entity entity:entitySet.getEntities()) { entity.getOperations().add(buildOperation(action, entity.getId().toASCIIString())); entitySet.getOperations().add(buildOperation(function, buildOperationTarget(options.getContextURL()))); entity.getOperations().add(buildOperation(function, entity.getId().toASCIIString()));
public static EntitySetResponse getInstance(ServiceRequest request, ContextURL contextURL, boolean referencesOnly, ODataResponse response) throws ContentNegotiatorException, SerializerException { EntityCollectionSerializerOptions options = request.getSerializerOptions( EntityCollectionSerializerOptions.class, contextURL, referencesOnly); return new EntitySetResponse(request.getServiceMetaData(),response, request.getSerializer(), options, request.getResponseContentType(), request.getPreferences()); }
public void writeError(ODataServerError error) { try { writeHeader(HttpHeader.CONTENT_TYPE, this.responseContentType.toContentTypeString()); writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { writeServerError(true); } }
if (isCollection()) { handler.read(DataRequest.this, EntitySetResponse.getInstance(DataRequest.this, getContextURL(odata), true, response)); } else { handler.read(DataRequest.this,
entityType.getFullQualifiedName(), true); if (action != null) { entitySet.getOperations().add(buildOperation(action, buildOperationTarget(options.getContextURL()))); if (action != null) { for (Entity entity:entitySet.getEntities()) { entity.getOperations().add(buildOperation(action, entity.getId().toASCIIString())); entitySet.getOperations().add(buildOperation(function, buildOperationTarget(options.getContextURL()))); entity.getOperations().add(buildOperation(function, entity.getId().toASCIIString()));
public static EntitySetResponse getInstance(ServiceRequest request, ContextURL contextURL, boolean referencesOnly, ODataResponse response) throws ContentNegotiatorException, SerializerException { EntityCollectionSerializerOptions options = request.getSerializerOptions( EntityCollectionSerializerOptions.class, contextURL, referencesOnly); return new EntitySetResponse(request.getServiceMetaData(),response, request.getSerializer(), options, request.getResponseContentType(), request.getPreferences()); }
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, ODATA_MAXPAGESIZE+"="+ request.getPreference(ODATA_MAXPAGESIZE)); //$NON-NLS-1$ } 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); } } response.writeReadEntitySet(visitor.getContext().getEdmEntityType(), result); }
public void writeReadEntitySet(EdmEntityType entityType, EntityCollection entitySet) throws SerializerException { assert (!isClosed()); if (entitySet == null) { writeNotFound(true); return; } if (ContentTypeHelper.isODataMetadataFull(this.responseContentType)) { buildOperations(entityType, entitySet); } // write the whole collection to response this.response.setContent(this.serializer.entityCollection(metadata, entityType, entitySet, this.options) .getContent()); writeOK(responseContentType); close(); }
@Override public void execute(ServiceHandler handler, ODataResponse response) throws ODataLibraryException, ODataApplicationException { // check for valid HTTP Verb assertHttpMethod(response); // Functions always have return per 11.5.3 if (isReturnTypePrimitive() || isReturnTypeComplex()) { // per odata-json-format/v4.0 = 11 Individual Property or Operation Response handler.invoke(this, getODataRequest().getMethod(), PropertyResponse.getInstance(this, response, getReturnType().getType(), getContextURL(this.odata), isCollection())); } else { // returnType.getType().getKind() == EdmTypeKind.ENTITY if (isCollection()) { handler.invoke(this, getODataRequest().getMethod(), EntitySetResponse.getInstance(this, getContextURL(odata), false, response)); } else { handler.invoke(this, getODataRequest().getMethod(), EntityResponse.getInstance(this, getContextURL(odata), false, response)); } } }
@Override public void visit(EntitySetResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(EntityCollectionProcessor.class).readEntityCollection(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } });
@Override public void execute(ServiceHandler handler, ODataResponse response) throws ODataLibraryException, ODataApplicationException { // check for valid HTTP Verb assertHttpMethod(response); // Functions always have return per 11.5.3 if (isReturnTypePrimitive() || isReturnTypeComplex()) { // per odata-json-format/v4.0 = 11 Individual Property or Operation Response handler.invoke(this, getODataRequest().getMethod(), PropertyResponse.getInstance(this, response, getReturnType().getType(), getContextURL(this.odata), isCollection())); } else { // returnType.getType().getKind() == EdmTypeKind.ENTITY if (isCollection()) { handler.invoke(this, getODataRequest().getMethod(), EntitySetResponse.getInstance(this, getContextURL(odata), false, response)); } else { handler.invoke(this, getODataRequest().getMethod(), EntityResponse.getInstance(this, getContextURL(odata), false, response)); } } }
@Override public void visit(EntitySetResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(EntityCollectionProcessor.class).readEntityCollection(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } });
if (isCollection()) { handler.read(DataRequest.this, EntitySetResponse.getInstance(DataRequest.this, getContextURL(odata), false, response)); } else { handler.read(DataRequest.this,entityResponse);
@Override public void visit(EntitySetResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(EntityCollectionProcessor.class).readEntityCollection(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } });
if (isCollection()) { handler.read(DataRequest.this, EntitySetResponse.getInstance(DataRequest.this, getContextURL(odata), false, response)); } else { handler.read(DataRequest.this,entityResponse);