/** * 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); }
/** * 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 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 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); }
/** * 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 WebSocket 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)} * They are not accessible in the handler provided as parameter. * * @param path The websocket path used by clients * @param handler an handler to invoke for the given condition * @param protocols sub-protocol to use in WS handshake signature * * @return a new handler */ @SuppressWarnings("unchecked") default HttpServerRoutes ws(String path, BiFunction<? super WebsocketInbound, ? super WebsocketOutbound, ? extends Publisher<Void>> handler, @Nullable String protocols) { return ws(HttpPredicate.get(path), handler, protocols); }
/** * 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 WebSocket 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)} * They are not accessible in the handler provided as parameter. * * @param path The websocket path used by clients * @param handler an handler to invoke for the given condition * @param protocols sub-protocol to use in WS handshake signature * * @return a new handler */ @SuppressWarnings("unchecked") default HttpServerRoutes ws(String path, BiFunction<? super WebsocketInbound, ? super WebsocketOutbound, ? extends Publisher<Void>> handler, @Nullable String protocols) { return ws(HttpPredicate.get(path), handler, protocols); }