Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

[REST] Display a message on primary endpoint #68

Open
watta90 opened this issue Oct 9, 2016 · 4 comments
Open

[REST] Display a message on primary endpoint #68

watta90 opened this issue Oct 9, 2016 · 4 comments

Comments

@watta90
Copy link

watta90 commented Oct 9, 2016

Hi,

How do you choose what to return when the primary endpoint is called on your REST api?

I would like to return a String when a user calls GET on /rest

I'm not able to find any documentation on how to achieve this.

@pkriens
Copy link
Member

pkriens commented Oct 10, 2016

This is currently not possible …

Kind regards,

Peter Kriens

On 9 okt. 2016, at 20:42, vatanbytyqi [email protected] wrote:

Hi,

How do you choose what to return when the primary endpoint is called on your REST api?

I would like to return a String when a user calls GET on /rest

I'm not able to find any documentation on how to achieve this.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub #68, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMPLuN9HhN3I0J7Tv8Jq4bxdHiU-DH0ks5qyTWTgaJpZM4KSExD.

@watta90
Copy link
Author

watta90 commented Oct 10, 2016

that was sad.. Do you know if someone is working on this so I can follow up on that? Currently I don't have the time to make a contribution my self at the moment, hopefully in a couple of months.

Regards
Vatan

@pkriens
Copy link
Member

pkriens commented Oct 10, 2016

The source code is https://github.com/osgi/osgi.enroute.bundles/tree/master/osgi.enroute.rest.simple.provider https://github.com/osgi/osgi.enroute.bundles/tree/master/osgi.enroute.rest.simple.provider

Since this is so little code it should not be very hard to add this feature here https://github.com/osgi/osgi.enroute.bundles/blob/master/osgi.enroute.rest.simple.provider/src/osgi/enroute/rest/simple/provider/RestMapper.java#L227 https://github.com/osgi/osgi.enroute.bundles/blob/master/osgi.enroute.rest.simple.provider/src/osgi/enroute/rest/simple/provider/RestMapper.java#L227

You could use a function that has some magic name like get$ to map to the empty path.

That said, you could also switch to JAX-RS. The OSGi enRoute REST API is incredibly easy to use but was not designed to allow the implementation of all possible REST APIs. Its primary goal was to support calls from the Javascript code into the java OSGI code.

Kind regards,

Peter Kriens

On 10 okt. 2016, at 13:04, vatanbytyqi [email protected] wrote:

that was sad.. Do you know if someone is working on this so I can follow up on that? Currently I don't have the time to make a contribution my self at the moment, hopefully in a couple of months.

Regards
Vatan


You are receiving this because you commented.
Reply to this email directly, view it on GitHub #68 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AAMPLjjMlucAmxeJ_bOEItIhNQdxioiRks5qyhu3gaJpZM4KSExD.

eliasvasylenko pushed a commit to eliasvasylenko/osgi.enroute.bundles that referenced this issue Mar 24, 2017
…int.

If a method is named for the verb with no path given, provide from the
root of the endpoint.

Signed-off-by: Elias N Vasylenko <[email protected]>
@eliasvasylenko
Copy link
Contributor

I think the most natural system is to just use raw verbs get(), post(), etc. rather than a special path name like $. Is there any problem with this approach? It was straightforward to implement this way, pretty much just removed the checks and error messages and it works: #85

eliasvasylenko pushed a commit to eliasvasylenko/osgi.enroute.bundles that referenced this issue Mar 24, 2017
…int.

If a method is named for the verb with no path given, provide from the
root of the endpoint.

Signed-off-by: Elias N Vasylenko <[email protected]>
pkriens added a commit that referenced this issue Mar 24, 2017
Simple response to feature request #68, enable primary rest endpoint.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants