You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by Vinayak Joshi <wi...@gmail.com> on 2016/01/14 10:10:22 UTC

Olingo V4 - customizing the service root uri

Hi,

I am trying to build a dynamic OData solution where a user can build
multiple OData services e.g. to different data sources.

My current attempt at doing this is by creating a single entry servlet.

When a user configures an OData service, I assign a unique "service-id" for
the generated service and inform the user that his service is generated at
say :

http://example.com/odata/service-id/

My entry servlet is configured to receive calls at  /odata/*

The entry servlet reads the service-id from the pathInfo () and routes the
request to the appropriate ODataHTTPHandler -> handler.process (req, resp);

My problem currently is that doing this makes OData respond with this error:

"Cannot find EntitySet, Singleton, ActionImport or FunctionImport with name
'service-id'"

It appears OData is inspecting the servlet path on the incoming request to
determine what needs to be done and takes 'service-id' in the path to be an
entity etc.

Looks like if I can inform OData in some way to consider
http://example.com/odata/service-id/ as the service root uri instead of
http://example.com/odata/ , then my problem would be solved. Is there a way
to do this with Olingo V4 ?


P.S:
This is a first so please excuse me for sending this mail off to both user
and dev mailing lists. Was not quite sure which of the two was the right
mailing list for this query. If someone points out - I can take care going
forward :)

- Vin

Re: Olingo V4 - customizing the service root uri

Posted by Vinayak Joshi <wi...@gmail.com>.
Thanks Steven, that worked like a charm!

On Thu, Jan 14, 2016 at 6:47 PM, Steven Veum <St...@progress.com>
wrote:

> I dealt with a similar issue by setting the split for the path to be 1.
> It defaults to 0.
>
> For example, I had code like the following when setting up the
> ODataHttpHandler:
>
> ODataHttpHandler handler = odata.createHandler(edm);
> handler.setSplit(1);
>
> -----Original Message-----
> From: Vinayak Joshi [mailto:winjoshi4@gmail.com]
> Sent: Thursday, January 14, 2016 4:10 AM
> To: dev@olingo.apache.org; user@olingo.apache.org
> Subject: Olingo V4 - customizing the service root uri
>
> Hi,
>
> I am trying to build a dynamic OData solution where a user can build
> multiple OData services e.g. to different data sources.
>
> My current attempt at doing this is by creating a single entry servlet.
>
> When a user configures an OData service, I assign a unique "service-id"
> for the generated service and inform the user that his service is generated
> at say :
>
> http://example.com/odata/service-id/
>
> My entry servlet is configured to receive calls at  /odata/*
>
> The entry servlet reads the service-id from the pathInfo () and routes the
> request to the appropriate ODataHTTPHandler -> handler.process (req, resp);
>
> My problem currently is that doing this makes OData respond with this
> error:
>
> "Cannot find EntitySet, Singleton, ActionImport or FunctionImport with
> name 'service-id'"
>
> It appears OData is inspecting the servlet path on the incoming request to
> determine what needs to be done and takes 'service-id' in the path to be an
> entity etc.
>
> Looks like if I can inform OData in some way to consider
> http://example.com/odata/service-id/ as the service root uri instead of
> http://example.com/odata/ , then my problem would be solved. Is there a
> way to do this with Olingo V4 ?
>
>
> P.S:
> This is a first so please excuse me for sending this mail off to both user
> and dev mailing lists. Was not quite sure which of the two was the right
> mailing list for this query. If someone points out - I can take care going
> forward :)
>
> - Vin
>

RE: Olingo V4 - customizing the service root uri

Posted by Steven Veum <St...@progress.com>.
I dealt with a similar issue by setting the split for the path to be 1.  It defaults to 0.

For example, I had code like the following when setting up the ODataHttpHandler:

ODataHttpHandler handler = odata.createHandler(edm);
handler.setSplit(1);

-----Original Message-----
From: Vinayak Joshi [mailto:winjoshi4@gmail.com] 
Sent: Thursday, January 14, 2016 4:10 AM
To: dev@olingo.apache.org; user@olingo.apache.org
Subject: Olingo V4 - customizing the service root uri

Hi,

I am trying to build a dynamic OData solution where a user can build multiple OData services e.g. to different data sources.

My current attempt at doing this is by creating a single entry servlet.

When a user configures an OData service, I assign a unique "service-id" for the generated service and inform the user that his service is generated at say :

http://example.com/odata/service-id/

My entry servlet is configured to receive calls at  /odata/*

The entry servlet reads the service-id from the pathInfo () and routes the request to the appropriate ODataHTTPHandler -> handler.process (req, resp);

My problem currently is that doing this makes OData respond with this error:

"Cannot find EntitySet, Singleton, ActionImport or FunctionImport with name 'service-id'"

It appears OData is inspecting the servlet path on the incoming request to determine what needs to be done and takes 'service-id' in the path to be an entity etc.

Looks like if I can inform OData in some way to consider http://example.com/odata/service-id/ as the service root uri instead of http://example.com/odata/ , then my problem would be solved. Is there a way to do this with Olingo V4 ?


P.S:
This is a first so please excuse me for sending this mail off to both user and dev mailing lists. Was not quite sure which of the two was the right mailing list for this query. If someone points out - I can take care going forward :)

- Vin