pRESTPeter Rybár, Elastic Solutions & Technologies

pREST web

pREST web is a Java MVC framework designed for responsive web application, RIA, web services and data/application integration development by REST architectural style. It focuses on simplicity and high productivity in development, scalability and high performance.

Features

  1. Modularity - modular framework architecture
  2. Extensibility - easy to extend and integrate by any other technologies
  3. Departed development of application logic, presentation and data layer
  4. Horizontal application development - developer does not need to be skilledin all technologies through the application
  5. Minimal time to learn and shallow learning curve
  6. Development of RIA web applications and REST services the same way
  7. Minimal other technology dependencies and their loose coupling- easy to maintain for a long time
  8. Platform independence - Java 7 or higher

References

... (NDA)
Game server and related applications
Softec
Intranet applications
SPP
Service vehicles (1200) monitoring and navigation, interactive maps
Allianz
B2B application for frequent insurance services customer (Slovak army)
VolksBank
Business Process Management engine REST service API, data integration
Telekom
REST web services.
Orange
Intranet and retail center applications, internal systems monitoring and operation
Pelikantravel
Flight ticket and insurance reservation web portal and backend office

Architecture

pREST web architecture

pREST web controller

Project structure

Maven project

Cerate application using maven archetype:

mvn archetype:generate \
    -DarchetypeCatalog=http://prest-tech.appspot.com/maven2/ \
    -DarchetypeGroupId=prest-archetypes \
    -DarchetypeArtifactId=prest-webappl-archetype \
    -DgroupId=webappl \
    -DartifactId=prest-webappl \
    -Dversion=0.1

Build and run web application:

cd prest-webappl
mvn package jetty:run

Open application URL in web browser:

http://localhost:8080

Ant project

prest_web_project
|
|-- docs
|-- lib
|   `-- prest.jar
|-- src
|   `-- demo
|       |-- App.java
|       `-- controllers
|           `-- CarController.java
|-- web
|   |-- META-INF
|   |-- WEB-INF
|   |   |-- templates
|   |   |   `-- cars.jsp
|   |   `-- web.xml
|   `-- index.html
|-- build.properties
`-- build.xml

Code examples

Application code example

public class App extends Application {
     
    @Override
    public void initialize() throws ApplicationException {
        initDatabase();
        initAccessManager();
        mount("/car", new CarController());
    }
     
    @Override
    public void destroy() {
    }
    ...
}

Controller code example

@Doc(value = "Example Car controller")
@FormAuth @RBAC(roles = {Roles.USER, Roles.ADMIN})
public class CarController extends WebController {
     
    @Action(method = GET)
    @Doc("Cars list page")
    @View(template = "cars.jsp")
    public CarsData get(@Key("filter") String filter) {
        Cars cars = App.selectCars(filter);
        CarsData carsData = new CarsData();
        carsData.setCars(cars);
        return carsData;
    }
     
    @Action(method = POST)
    @Doc("Car post form")
    @View(template = "cars.jsp")
    public CarsData post(CarForm carForm) {
        CarsData carsData = new CarsData();
        if (carForm.isSubmitted()) {
            if (carForm.isValid()) {
                Car car = carForm.getCar();
                App.insertCar(car);
            }
        } else {
            carForm = new CarForm();
        }
        Cars cars = App.selectCars(filter);
        carsData.setCars(cars);
        carsData.setCarForm(carForm);
        return carsData;
    }
     
    @Action(name = "json", method = GET)
    @Doc("Cars list in JSON format")
    @JSON
    public Cars get(@Key("filter") String filter) {
        Cars cars = App.selectCars(filter);
        return cars;
    }
     
    ...
}

Tutorials

pREST web tutorials

Authors

Peter Rybár
Project leader, architect, developer
Daniel Buchta
Main developer for server side project components