/** * Creates a {@link Predicate} based on a URI template. * This will listen for all Methods. * * @param uri The string to compile into a URI template and use for matching * * @return The new {@link HttpPredicate}. * * @see Predicate */ public static Predicate<HttpServerRequest> http(String uri, @Nullable HttpVersion protocol, HttpMethod method) { if (null == uri) { return null; } return new HttpPredicate(uri, protocol, method); }
/** * An alias for {@link HttpPredicate#http}. * <p> * Creates a {@link Predicate} based on a URI template filtering . * <p> * This will listen for POST Method. * * @param uri The string to compile into a URI template and use for matching * * @return The new {@link Predicate}. * * @see Predicate */ public static Predicate<HttpServerRequest> post(String uri) { return http(uri, null, HttpMethod.POST); }
/** * An alias for {@link HttpPredicate#get} prefix ([prefix]/**), useful for file system * mapping. * <p> * Creates a {@link Predicate} based on a URI template filtering . * <p> * This will listen for WebSocket Method. * * @return The new {@link Predicate}. * * @see Predicate */ public static Predicate<HttpServerRequest> prefix(String prefix) { return prefix(prefix, HttpMethod.GET); }
/** * Listen for HTTP GET on the passed path to be used as a routing condition. The file * at provided path will be served. * <p> * Additional regex matching is available, e.g. "/test/{param}". Params are resolved * using {@link HttpServerRequest#param(CharSequence)} * * @param uri The GET path used by clients * @param path the resource path to serve * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes file(String uri, String path) { return file(HttpPredicate.get(uri), Paths.get(path), null); }
/** * Listen for HTTP HEAD on the passed path to be used as a routing condition. Incoming * connections will query the internal registry to invoke the matching handlers. <p> * Additional regex matching is available e.g. * "/test/{param}". Params are resolved using {@link HttpServerRequest#param(CharSequence)} * * @param path The HEAD path used by clients * @param handler an handler to invoke for the given condition * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes head(String path, BiFunction<? super HttpServerRequest, ? super HttpServerResponse, ? extends Publisher<Void>> handler) { return route(HttpPredicate.head(path), handler); }
/** * Listen for HTTP PUT on the passed path to be used as a routing condition. Incoming * connections will query the internal registry to invoke the matching handlers. <p> * Additional regex matching is available e.g. * "/test/{param}". Params are resolved using {@link HttpServerRequest#param(CharSequence)} * * @param path The PUT path used by clients * @param handler an handler to invoke for the given condition * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes put(String path, BiFunction<? super HttpServerRequest, ? super HttpServerResponse, ? extends Publisher<Void>> handler) { return route(HttpPredicate.put(path), handler); }
/** * Listen for HTTP DELETE on the passed path to be used as a routing condition. * Incoming connections will query the internal registry to invoke the matching * handlers. <p> Additional regex matching is available, e.g. "/test/{param}". * Params are resolved using {@link HttpServerRequest#param(CharSequence)} * * @param path The DELETE path used by clients. * @param handler an handler to invoke for the given condition * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes delete(String path, BiFunction<? super HttpServerRequest, ? super HttpServerResponse, ? extends Publisher<Void>> handler) { return route(HttpPredicate.delete(path), handler); }
/** * Listen for HTTP OPTIONS on the passed path to be used as a routing condition. Incoming * connections will query the internal registry to invoke the matching handlers. <p> * Additional regex matching is available e.g. * "/test/{param}". Params are resolved using {@link HttpServerRequest#param(CharSequence)} * * @param path The OPTIONS path used by clients * @param handler an handler to invoke for the given condition * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes options(String path, BiFunction<? super HttpServerRequest, ? super HttpServerResponse, ? extends Publisher<Void>> handler) { return route(HttpPredicate.options(path), handler); }
/** * Listen for HTTP POST on the passed path to be used as a routing condition. Incoming * connections will query the internal registry to invoke the matching handlers. <p> * Additional regex matching is available e.g. * "/test/{param}". Params are resolved using {@link HttpServerRequest#param(CharSequence)} * * @param path The POST path used by clients * @param handler an handler to invoke for the given condition * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes post(String path, BiFunction<? super HttpServerRequest, ? super HttpServerResponse, ? extends Publisher<Void>> handler) { return route(HttpPredicate.post(path), handler); }
/** * Listen for HTTP GET on the passed path to be used as a routing condition. Incoming * connections will query the internal registry to invoke the matching handlers. <p> * Additional regex matching is available e.g. * "/test/{param}". Params are resolved using {@link HttpServerRequest#param(CharSequence)} * * @param path The GET path used by clients * @param handler an handler to invoke for the given condition * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes get(String path, BiFunction<? super HttpServerRequest, ? super HttpServerResponse, ? extends Publisher<Void>> handler) { return route(HttpPredicate.get(path), handler); }
/** * Listen for HTTP HEAD on the passed path to be used as a routing condition. Incoming * connections will query the internal registry to invoke the matching handlers. <p> * Additional regex matching is available e.g. * "/test/{param}". Params are resolved using {@link HttpServerRequest#param(CharSequence)} * * @param path The HEAD path used by clients * @param handler an handler to invoke for the given condition * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes head(String path, BiFunction<? super HttpServerRequest, ? super HttpServerResponse, ? extends Publisher<Void>> handler) { return route(HttpPredicate.head(path), handler); }
/** * Listen for HTTP PUT on the passed path to be used as a routing condition. Incoming * connections will query the internal registry to invoke the matching handlers. <p> * Additional regex matching is available e.g. * "/test/{param}". Params are resolved using {@link HttpServerRequest#param(CharSequence)} * * @param path The PUT path used by clients * @param handler an handler to invoke for the given condition * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes put(String path, BiFunction<? super HttpServerRequest, ? super HttpServerResponse, ? extends Publisher<Void>> handler) { return route(HttpPredicate.put(path), handler); }
/** * Listen for HTTP DELETE on the passed path to be used as a routing condition. * Incoming connections will query the internal registry to invoke the matching * handlers. <p> Additional regex matching is available, e.g. "/test/{param}". * Params are resolved using {@link HttpServerRequest#param(CharSequence)} * * @param path The DELETE path used by clients. * @param handler an handler to invoke for the given condition * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes delete(String path, BiFunction<? super HttpServerRequest, ? super HttpServerResponse, ? extends Publisher<Void>> handler) { return route(HttpPredicate.delete(path), handler); }
/** * Listen for HTTP OPTIONS on the passed path to be used as a routing condition. Incoming * connections will query the internal registry to invoke the matching handlers. <p> * Additional regex matching is available e.g. * "/test/{param}". Params are resolved using {@link HttpServerRequest#param(CharSequence)} * * @param path The OPTIONS path used by clients * @param handler an handler to invoke for the given condition * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes options(String path, BiFunction<? super HttpServerRequest, ? super HttpServerResponse, ? extends Publisher<Void>> handler) { return route(HttpPredicate.options(path), handler); }
/** * Listen for HTTP POST on the passed path to be used as a routing condition. Incoming * connections will query the internal registry to invoke the matching handlers. <p> * Additional regex matching is available e.g. * "/test/{param}". Params are resolved using {@link HttpServerRequest#param(CharSequence)} * * @param path The POST path used by clients * @param handler an handler to invoke for the given condition * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes post(String path, BiFunction<? super HttpServerRequest, ? super HttpServerResponse, ? extends Publisher<Void>> handler) { return route(HttpPredicate.post(path), handler); }
/** * An alias for {@link HttpPredicate#http}. * <p> * Creates a {@link Predicate} based on a URI template filtering . * <p> * This will listen for DELETE Method. * * @param uri The string to compile into a URI template and use for matching * * @return The new {@link Predicate}. * * @see Predicate */ public static Predicate<HttpServerRequest> delete(String uri) { return http(uri, null, HttpMethod.DELETE); }
/** * Listen for HTTP GET on the passed path to be used as a routing condition. The * provided {@link java.io.File} will be served. * <p> * Additional regex matching is available, e.g. "/test/{param}". Params are resolved * using {@link HttpServerRequest#param(CharSequence)} * * @param uri The GET path used by clients * @param path the resource Path to serve * * @return this {@link HttpServerRoutes} */ default HttpServerRoutes file(String uri, Path path) { return file(HttpPredicate.get(uri), path, null); }
/** * An alias for {@link HttpPredicate#get} prefix ([prefix]/**), useful for file system * mapping. * <p> * Creates a {@link Predicate} based on a URI template filtering . * <p> * This will listen for WebSocket Method. * * @return The new {@link Predicate}. * * @see Predicate */ public static Predicate<HttpServerRequest> prefix(String prefix) { return prefix(prefix, HttpMethod.GET); }
/** * Creates a {@link Predicate} based on a URI template. * This will listen for all Methods. * * @param uri The string to compile into a URI template and use for matching * * @return The new {@link HttpPredicate}. * * @see Predicate */ public static Predicate<HttpServerRequest> http(String uri, @Nullable HttpVersion protocol, HttpMethod method) { if (null == uri) { return null; } return new HttpPredicate(uri, protocol, method); }
/** * An alias for {@link HttpPredicate#http}. * <p> * Creates a {@link Predicate} based on a URI template filtering . * <p> * This will listen for PUT Method. * * @param uri The string to compile into a URI template and use for matching * * @return The new {@link Predicate}. * * @see Predicate */ public static Predicate<HttpServerRequest> put(String uri) { return http(uri, null, HttpMethod.PUT); }