File tree Expand file tree Collapse file tree
kilo-server/src/main/java/org/httprpc/kilo Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -873,6 +873,8 @@ public void init() throws ServletException {
873873
874874 var resource = root ;
875875
876+ var n = 0 ;
877+
876878 var resourcePath = method .getAnnotation (ResourcePath .class );
877879
878880 if (resourcePath != null ) {
@@ -886,9 +888,21 @@ public void init() throws ServletException {
886888 }
887889
888890 resource = resource .resources .computeIfAbsent (component , key -> new Resource ());
891+
892+ if (component .equals (KEY_PLACEHOLDER )) {
893+ n ++;
894+ }
889895 }
890896 }
891897
898+ if (verb == Verb .POST || verb == Verb .PUT ) {
899+ n ++;
900+ }
901+
902+ if (method .getParameterCount () < n ) {
903+ throw new ServletException ("Invalid parameter count." );
904+ }
905+
892906 resource .handlerLists .computeIfAbsent (verb , key -> new LinkedList <>()).add (method );
893907 }
894908
You can’t perform that action at this time.
0 commit comments