/jpages

Experimental Java OOP Web Framework

Primary LanguageJavaMIT LicenseMIT

logo

EO principles respected here We recommend IntelliJ IDEA

mvn License Hits-of-Code

jPages is an experimental prototype of a web framework, which respects all possible principles of true object-oriented design. More about it in this blog post and in this webinar.

This is how you start a web app:

Thread thread = new Thread(
  () -> {
    App app = new App(
      new Page() {
        @Override
        public Page with(String name, String value) {
            if (value.equals("/")) {
              return new TextPage("Hello, world!");
            }
            return new TextPage("Not found!");
        }
        @Override
        public Output via(Output output) {
          return output.with("X-Body", "Not found");
        }
      }
    );
    try {
      app.start(8080);
    } catch (Exception ex) {
      System.out.println(ex.getMessage());
      throw new IllegalStateException(ex);
    }
  }
);
thread.setDaemon(true);
thread.start();

This repository is read-only now. Check yegor256/takes instead, it's in active development.