| | |
| | | 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 { |
| | |
| | | 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); |
| | |
| | | |
| | | Wenn einer dieser beiden Faelle eintritt, wird alles als Parameter an die Methode |
| | | uebergeben, was eventuell als Teil einer Query im URL oder im Body enthalten ist. |
| | | Ein Actor kann dann den Body nicht mehr lesen, weil das bereits an dieser Stelle |
| | | gemacht wurde. |
| | | Fuer Mthoden, die nicht vom Typ HTTP GET sind, kann ein Actor kann dann den Body |
| | | nicht mehr lesen, weil das bereits an dieser Stelle gemacht wurde. |
| | | */ |
| | | Map queryParams = new HashMap(); |
| | | if ((count > 1 && count > routeParams.length) |