@@ -2487,132 +2487,6 @@ public Route.Definition head(final @Nonnull String path, final @Nonnull Route.Ha
24872487 return this ;
24882488 }
24892489
2490- /**
2491- * Redirect to the given url with status code defaulting to {@link Status#FOUND}.
2492- *
2493- * <pre>
2494- * rsp.redirect("/foo/bar");
2495- * rsp.redirect("http://example.com");
2496- * rsp.redirect("http://example.com");
2497- * rsp.redirect("../login");
2498- * </pre>
2499- *
2500- * Redirects can be a fully qualified URI for redirecting to a different site:
2501- *
2502- * <pre>
2503- * rsp.redirect("http://google.com");
2504- * </pre>
2505- *
2506- * Redirects can be relative to the root of the host name. For example, if you were
2507- * on <code>http://example.com/admin/post/new</code>, the following redirect to /admin would
2508- * land you at <code>http://example.com/admin</code>:
2509- *
2510- * <pre>
2511- * rsp.redirect("/admin");
2512- * </pre>
2513- *
2514- * Redirects can be relative to the current URL. A redirection of post/new, from
2515- * <code>http://example.com/blog/admin/</code> (notice the trailing slash), would give you
2516- * <code>http://example.com/blog/admin/post/new.</code>
2517- *
2518- * <pre>
2519- * rsp.redirect("post/new");
2520- * </pre>
2521- *
2522- * Redirecting to post/new from <code>http://example.com/blog/admin</code> (no trailing slash),
2523- * will take you to <code>http://example.com/blog/post/new</code>.
2524- *
2525- * <p>
2526- * If you found the above behavior confusing, think of path segments as directories (have trailing
2527- * slashes) and files, it will start to make sense.
2528- * </p>
2529- *
2530- * Pathname relative redirects are also possible. If you were on
2531- * <code>http://example.com/admin/post/new</code>, the following redirect would land you at
2532- * <code>http//example.com/admin</code>:
2533- *
2534- * <pre>
2535- * rsp.redirect("..");
2536- * </pre>
2537- *
2538- * A back redirection will redirect the request back to the <code>Referer</code>, defaulting to
2539- * <code>/</code> when missing.
2540- *
2541- * <pre>
2542- * rsp.redirect("back");
2543- * </pre>
2544- *
2545- * @param location Either a relative or absolute location.
2546- * @return A route handler.
2547- */
2548- public Route .Handler redirect (final String location ) {
2549- return redirect (Status .FOUND , location );
2550- }
2551-
2552- /**
2553- * Redirect to the given url with status code defaulting to {@link Status#FOUND}.
2554- *
2555- * <pre>
2556- * rsp.redirect("/foo/bar");
2557- * rsp.redirect("http://example.com");
2558- * rsp.redirect("http://example.com");
2559- * rsp.redirect("../login");
2560- * </pre>
2561- *
2562- * Redirects can be a fully qualified URI for redirecting to a different site:
2563- *
2564- * <pre>
2565- * rsp.redirect("http://google.com");
2566- * </pre>
2567- *
2568- * Redirects can be relative to the root of the host name. For example, if you were
2569- * on <code>http://example.com/admin/post/new</code>, the following redirect to /admin would
2570- * land you at <code>http://example.com/admin</code>:
2571- *
2572- * <pre>
2573- * rsp.redirect("/admin");
2574- * </pre>
2575- *
2576- * Redirects can be relative to the current URL. A redirection of post/new, from
2577- * <code>http://example.com/blog/admin/</code> (notice the trailing slash), would give you
2578- * <code>http://example.com/blog/admin/post/new.</code>
2579- *
2580- * <pre>
2581- * rsp.redirect("post/new");
2582- * </pre>
2583- *
2584- * Redirecting to post/new from <code>http://example.com/blog/admin</code> (no trailing slash),
2585- * will take you to <code>http://example.com/blog/post/new</code>.
2586- *
2587- * <p>
2588- * If you found the above behavior confusing, think of path segments as directories (have trailing
2589- * slashes) and files, it will start to make sense.
2590- * </p>
2591- *
2592- * Pathname relative redirects are also possible. If you were on
2593- * <code>http://example.com/admin/post/new</code>, the following redirect would land you at
2594- * <code>http//example.com/admin</code>:
2595- *
2596- * <pre>
2597- * rsp.redirect("..");
2598- * </pre>
2599- *
2600- * A back redirection will redirect the request back to the <code>Referer</code>, defaulting to
2601- * <code>/</code> when missing.
2602- *
2603- * <pre>
2604- * rsp.redirect("back");
2605- * </pre>
2606- *
2607- * @param status A redirect status.
2608- * @param location Either a relative or absolute location.
2609- * @return A route handler.
2610- */
2611- public Route .Handler redirect (final Status status , final String location ) {
2612- requireNonNull (location , "A location is required." );
2613- return (req , rsp ) -> rsp .redirect (status , location );
2614- }
2615-
26162490 /**
26172491 * Keep track of routes in the order user define them.
26182492 *
0 commit comments