Search code examples
javarestodataolingo

How to make versioning on the olingo odata url


I am using Olingo OData to create my restful API. My question is if there is anyway to put versioning on the API URL? For example, we I have right now is

http://localhost:9090/cars

I am wondering if I can make it looks like

http://localhost:9090/v1/cars

Thanks in advance.


Solution

  • I believe that you use some kind of HttpServlet for exposing the OData service. Then, changing the URL is a matter of changing a mapping in your web.xml or wherever you have it.

    Here is a repository where I put an example Spring Olingo app: https://github.com/sollersconsulting/confitura2017/tree/master/snapgram. Mapping is done in the main class.