@Override public boolean rawInvocation(Http.Request request, Http.Response response) throws Exception { // Mark an evolution as resolved if (Play.mode.isDev() && request.method.equals("POST") && request.url.matches("^/@evolutions/force/[0-9]+$")) { int revision = Integer.parseInt(request.url.substring(request.url.lastIndexOf("/") + 1)); resolve(revision); new Redirect("/").apply(request, response); return true; } // Apply the current evolution script if (Play.mode.isDev() && request.method.equals("POST") && request.url.equals("/@evolutions/apply")) { applyScript(true); new Redirect("/").apply(request, response); return true; } return super.rawInvocation(request, response); }
@Override public boolean rawInvocation(Request request, Response response) throws Exception { // Mark an evolution as resolved if (Play.mode.isDev() && request.method.equals("POST") && request.url.matches("^/@evolutions/force/[0-9]+$")) { int revision = Integer.parseInt(request.url.substring(request.url.lastIndexOf("/") + 1)); resolve(revision); new Redirect("/").apply(request, response); return true; } // Apply the current evolution script if (Play.mode.isDev() && request.method.equals("POST") && request.url.equals("/@evolutions/apply")) { applyScript(true); new Redirect("/").apply(request, response); return true; } return super.rawInvocation(request, response); }
/** * Send a Redirect response. * @param url The Location to redirect * @param permanent true -> 301, false -> 302 */ protected static void redirect(String url, boolean permanent) { if (url.matches("^([^./]+[.]?)+$")) { // fix Java ! redirect(url, permanent, new Object[0]); } throw new Redirect(url, permanent); }
@Test public void redirectsToLocaleDefaultHomePage() { Play.configuration.setProperty("web.ru.home", "/retail/ru"); Redirect redirect = new Web().locale("ru"); assertEquals("/retail/ru", redirect.getUrl()); }
@Test public void usesDefaultLanguage_if_unknownLocaleIsGiven() { Play.configuration.setProperty("web.ru.home", "/retail/ru"); Play.langs = asList("ru", "en"); Redirect redirect = new Web().locale("x<qss>\""); assertEquals("/retail/ru", redirect.getUrl()); }
/** * First step of the OAuth2 process: redirects the user to the authorization page * * @param callbackURL */ public void retrieveVerificationCode(String callbackURL) { throw new Redirect(authorizationURL + "?client_id=" + clientid + "&redirect_uri=" + callbackURL); }