@@ -185,7 +185,16 @@ private void addMiddleware(@NotNull String requestMethod, @NotNull String contex
185185 }
186186
187187 /**
188- * Add an listener for all request methods.
188+ * Add an listener for all request methods and contexts.
189+ *
190+ * @param request Will be fired on all requests.
191+ */
192+ public void all (@ NotNull HttpRequest request ) {
193+ HANDLER .add (1 , new ExpressFilterImpl (this , "*" , "*" , request ));
194+ }
195+
196+ /**
197+ * Adds an handler for a specific context.
189198 *
190199 * @param context The context.
191200 * @param request An listener which will be fired if the context matches the requestpath.
@@ -195,12 +204,15 @@ public void all(@NotNull String context, @NotNull HttpRequest request) {
195204 }
196205
197206 /**
198- * Add an listener for all request methods and contexts.
207+ * Adds an handler for a specific context and method.
208+ * You can use a star '*' to match every context / request-method.
199209 *
200- * @param request Will be fired on all requests.
210+ * @param context The context.
211+ * @param requestMethod The request method.
212+ * @param request An listener which will be fired if the context matches the requestpath.
201213 */
202- public void all (@ NotNull HttpRequest request ) {
203- HANDLER .add (1 , new ExpressFilterImpl (this , "*" , "*" , request ));
214+ public void all (@ NotNull String context , @ NotNull String requestMethod , @ NotNull HttpRequest request ) {
215+ HANDLER .add (1 , new ExpressFilterImpl (this , requestMethod , context , request ));
204216 }
205217
206218 /**
@@ -254,29 +266,17 @@ public void patch(@NotNull String context, @NotNull HttpRequest request) {
254266 }
255267
256268 /**
257- * Add an listener for an specific request method.
269+ * Adds an handler for a specific context and method.
270+ * You can use a star '*' to match every context / request-method.
258271 *
259- * @param requestMethod The request method
260- * @param context The context for the request handler .
272+ * @param context The context.
273+ * @param requestMethod The request method .
261274 * @param request An listener which will be fired if the context matches the requestpath.
262275 */
263- public void on (@ NotNull String requestMethod , @ NotNull String context , @ NotNull HttpRequest request ) {
276+ public void on (@ NotNull String context , @ NotNull String requestMethod , @ NotNull HttpRequest request ) {
264277 HANDLER .add (1 , new ExpressFilterImpl (this , requestMethod , context , request ));
265278 }
266279
267- /**
268- * Add an listener for an specific request method.
269- * You cann add multiple contexts.
270- *
271- * @param requestMethod The request method
272- * @param contexts The contexts for the request handler..
273- * @param request An listener which will be fired if the context matches the requestpath.
274- */
275- public void on (@ NotNull String requestMethod , @ NotNull HttpRequest request , String ... contexts ) {
276- for (String c : contexts )
277- HANDLER .add (1 , new ExpressFilterImpl (this , requestMethod , c , request ));
278- }
279-
280280 /**
281281 * Start the HTTP-Server on port 80.
282282 * This method is asyncronous so be sure to add an listener or keep it in mind!
0 commit comments