From ca79593d7659cd9c6dcdd38692888b26dcbef4f5 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Thu, 14 Nov 2024 14:32:32 +0000
Subject: [PATCH] Readme um Buildinfos erweitert

---
 src/de/uhilger/neon/Handler.java |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/de/uhilger/neon/Handler.java b/src/de/uhilger/neon/Handler.java
index 71706d4..14d34d3 100644
--- a/src/de/uhilger/neon/Handler.java
+++ b/src/de/uhilger/neon/Handler.java
@@ -154,25 +154,25 @@
           o = ((Map) md).get(routeRest);
           if (o instanceof ActionDescriptor) {
             found = true;
-            handleRequest(exchange, o, routeRest, route.substring(routeRest.length()));
+            handleRequest(exchange, o, routeRest, route.substring(routeRest.length()), requestMethod);
           }
           pos = routeRest.lastIndexOf("/");
         }
       } else {
         found = true;
-        handleRequest(exchange, o, route, route);
+        handleRequest(exchange, o, route, route, requestMethod);
       }
       if (!found) {
         o = dispatcher.get(requestMethod).get("/");
         if (o instanceof ActionDescriptor) {
-          handleRequest(exchange, o, route, route);
+          handleRequest(exchange, o, route, route, requestMethod);
         }
       }
     }
 
   }
 
-  private void handleRequest(HttpExchange exchange, Object o, String route, String subroute) throws IOException {
+  private void handleRequest(HttpExchange exchange, Object o, String route, String subroute, Type requestMethod) throws IOException {
     ActionDescriptor ad = (ActionDescriptor) o;
     String actorClassName = ad.className;
     try {
@@ -181,7 +181,7 @@
       for (Method method : methods) {
         Action action = method.getAnnotation(Action.class);
         if (action != null) {
-          if (action.route().equals("/") || action.route().startsWith(route)) {
+          if ((action.route().equals("/") || action.route().startsWith(route)) && action.type().equals(requestMethod)) {
             Object[] actionArgs = getActionArgs(exchange, method, ad, subroute);
             Object actorObj = actorClass.getDeclaredConstructor().newInstance();
             addDataProvider(exchange, actorObj);

--
Gitblit v1.9.3