Exemple #1
0
public class Application extends Controller {

  @AnonymousCheck
  public static Result index() {
    return ok(index.render(UserApp.currentUser()));
  }

  public static Result removeTrailer(String paths) {
    String path = request().path();
    if (path.charAt(path.length() - 1) == '/') {
      path = path.substring(0, path.length() - 1);
    } else {
      Logger.error("Unexpected url call : " + request().path());
      return notFound(notfound_default.render("error.notfound"));
    }
    Logger.debug("Trailing slash removed and redirected: " + request().path() + " to " + path);
    return redirect(path);
  }

  public static Result init() {
    makeTestRepository();
    return redirect(routes.Application.index());
  }

  static final JsMessages messages = JsMessages.create(play.Play.application());

  public static Result jsMessages() {
    return ok(messages.generate("Messages")).as("application/javascript");
  }

  private static void makeTestRepository() {
    for (Project project : Project.find.all()) {
      Logger.debug("makeTestRepository: " + project.name);
      try {
        RepositoryService.createRepository(project);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }

  public static Result navi() {
    return ok(index.render(UserApp.currentUser()));
  }

  public static Result UIKit() {
    return ok(views.html.help.UIKit.render());
  }

  public static Result fake() {
    // Do not call this.
    return badRequest();
  }
}
Exemple #2
0
 public static Result jsMessages() {
   return ok(messages.generate("Messages")).as("application/javascript");
 }