Search code examples
httpodataodata4j

How to return a 404 error from OData Producer?


I have an OData Producer (using odata4j Java). In the getEntities() method I check that the entity name supplied exists in the meta-data document. If the name is not present I want to return a http 404 error - Not Found.

How do I return this error when the producer is due to return a EntitiesResponse object? What's the way of building/returning errors.


Solution

  • Currently (as of version 0.5), you can throw NotFoundException.

    Hope that helps,
    - john