Skip to content

Backend in Java EE

Sven Loesekann edited this page Dec 17, 2016 · 6 revisions

The backend is the Java EE part of the application. It serves the Angular 2 UI and provides the rest services.

The web module provides the rest services with the classes CrDetailResource/CrTableResource. The Jax-Rs Annotations are used to get the rest service. The DisableCaching Annotation sets the NoCache flag in the http header(Browser caching). Both rest services add CORS header flags for requests from "http://localhost". The flags are needed to because the UI is served by Angular-Cli and the services are provided by the Java EE servicer. By default an app in the browser can only access services of the server it came from. In development cors needs to be disabled. To access the ejbs for the data they are injected.

The ejb modules provides the ejbs that access the data that is served. The data is accessed in 2 ways. On a Wildfly app server the data is imported in the H2 in memory db and then accessed with Jpa. The data is in the import.sql and the setup is in the persistence.xml. The entity bean are in the model package and are converted in the Jaxb dtos with the Converter class. On other app servers the data is provided with a singleton bean that serves the data. The data is put in the classes in the dto package. These dtos are converted by Jaxb in Json format for the browser.

Clone this wiki locally