Java 类play.mvc.results.Redirect 实例源码

项目:play-evolve    文件:Evolve.java   
@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);
}
项目:restcommander    文件:Evolutions.java   
@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);
}
项目:restcommander    文件:Controller.java   
/**
 * 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);
}
项目:play-web    文件:WebTest.java   
@Test
public void redirectsToLocaleDefaultHomePage() {
  Play.configuration.setProperty("web.ru.home", "/retail/ru");

  Redirect redirect = new Web().locale("ru");

  assertEquals("/retail/ru", redirect.getUrl());
}
项目:play-web    文件:WebTest.java   
@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());
}
项目:restcommander    文件:OAuth2.java   
/**
 * 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);
}