From 0218e57c7f102cf0956391153938d966819b3b67 Mon Sep 17 00:00:00 2001 From: Elias N Vasylenko Date: Fri, 24 Mar 2017 10:15:08 +0000 Subject: [PATCH] Simple response to feature request #68, enable primary rest endpoint. 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 --- .../src/osgi/enroute/rest/simple/provider/Function.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osgi.enroute.rest.simple.provider/src/osgi/enroute/rest/simple/provider/Function.java b/osgi.enroute.rest.simple.provider/src/osgi/enroute/rest/simple/provider/Function.java index 0c67471..5d04047 100644 --- a/osgi.enroute.rest.simple.provider/src/osgi/enroute/rest/simple/provider/Function.java +++ b/osgi.enroute.rest.simple.provider/src/osgi/enroute/rest/simple/provider/Function.java @@ -122,6 +122,10 @@ public Object convert(Type dest, Object o) throws Exception { hasPayloadAsParameter = false; } + if (path.equals("/") && cardinality > 0) + throw new IllegalArgumentException("Invalid " + verb + + " method " + method.getName() + ". A method on the root path cannot have a non-zero cardinality."); + this.post = requestBody; this.cardinality = cardinality;