|
|
# Setting up Your development environment for the Webapp
|
|
|
|
|
|
The webbapplication running at [sdc.leibniz-kis.de](sdc.leibniz-kis.de) is built using Java, JavaBeans, Javascript and Jquery. The app runs on a tomcat 8.5 server. To further develop the app you need to get:
|
|
|
1. [Java Eclipse Enterprise Edition](https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2019-12/R/eclipse-jee-2019-12-R-linux-gtk-x86_64.tar.gz)
|
|
|
2. [A Java SDK]()
|
|
|
3. A binary of the tomcat sever for testing the application |
|
|
The web application running at [sdc.leibniz-kis.de](sdc.leibniz-kis.de) is built using Java, JavaBeans, Javascript and Jquery. The app runs on a tomcat 8.5 server. To further develop the app you need to get:
|
|
|
1. [Java Eclipse Enterprise Edition](https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2019-12/R/eclipse-jee-2019-12-R-linux-gtk-x86_64.tar.gz)
|
|
|
2. [Apache Tomcat 8.5](https://tomcat.apache.org/download-80.cgi) Install this locally somewhere where eclipse can find it. Using eclipse's internal server installation environment didn't work as expected. This server is only necessary for development purposes and has nothing to do with the production environment.
|
|
|
3. A Java Runtime Environment e.g. 1.8.0_212-b04
|
|
|
|
|
|
### Setting up the project
|
|
|
In Eclipse use: File -> Import -> Git -> Projects from Git -> Clone URI
|
|
|
Fill the Dialog:
|
|
|
|
|
|
![image](uploads/80d1acf1545c3b3fbbfbe436d2dc383b/image.png)
|
|
|
|
|
|
Follow the wizard:
|
|
|
1. Select any git branches you want
|
|
|
1. Choose the directory where you want the project stored
|
|
|
1. Wait for clone and finish wizard
|
|
|
|
|
|
The project should appear in your workspace:
|
|
|
|
|
|
![image](uploads/a3667336a808c8cf912c97b205be782d/image.png)
|
|
|
|
|
|
|
|
|
### Setting up tomcat Server
|
|
|
|
|
|
|
|
|
# Tomcat Web App Development
|
|
|
Use `eclipse` to deve
|
|
|
* Java programs: entweder server pages, servlets, java beans
|
|
|
* JAVA Bean class only has SET and GET methods
|
|
|
* Observation bean Basic
|
|
|
* Observation bean spezifisches Instrument
|
|
|
* Servlet läuft auf dem Server ist in Java Geschrieben
|
|
|
* Bearbeitet GET und POST
|
|
|
* Java Server Page: HTML mit kleinen Code Blöcken
|
|
|
* JSTL: Java Style Transform language:
|
|
|
* Uhrzeiten formatieren, Schleifen, merke: MetaHTML
|
|
|
* JQUERY, [SEMANTICUI](https://semantic-ui.com/introduction/getting-started.html)
|
|
|
* Eclipse: **Download Eterprise Edition instead of Basic Edition!**
|
|
|
* New Server/Dynamic Web Project
|
|
|
* Runtime Tomcat 8.5 einstellen
|
|
|
* new servlet: inherits from both http response and http request, has doGet and doPost methods to process requests
|
|
|
* add servlet to server (from eclipse server managment)
|
|
|
* Struktur des Projekts:
|
|
|
* Abhängikeiten werden von Maven gemanaged, legen eine `.pom` datei an
|
|
|
* Servlets in Packages veteilt
|
|
|
* `index.jsp` als einstiegsseite, hier wird der Code aus den Servlets eingebunden, dieses File implementiert die [Such-Seite](sdc.leibniz-kis.de). hat matomo und cookie stuff und das große HTML formular
|
|
|
* Result catalog servlet ist die landeseite für sdc anfragen
|
|
|
* Servlet Context speichert die verbindung zur Datenbank. Der Context Läuft sobald der Server da ist
|
|
|
* DBFilterBuilder klasse baut MongoDB query
|
|
|
* DBObservationDAO baut Java beans und hat Attribute die Informationen zu einem gewissen Filter abbilden
|
|
|
* ObservationConverter: baut MongoDB Dokumente in Java beans um
|
|
|
* Pro neuem Instrument muss man ein DAO und eine Observation bauen
|
|
|
* GrisGatalogServlet baut die Listenseite und liest die Beans aus de DAO objekt aus
|
|
|
* Alles was ich vom Browser aus sehe hat ein Servlet und eine `.jsp` seit so sind Logik und Präsentation getrennt (Logik im Servlet, Optik imn der `.jsp`)
|
|
|
|
|
|
|
|
|
## Deploying updated Version of the Webapp
|
|
|
Deploying is the process of updating the webapp version runnning on the main *production* server. In our case it's done by uploading a web archive (.war) file to the [managment web interface of the tomcat server](sdc.leibniz-kis.de:8080/manager). The login user is called `tomcat`, the password is the standard one used for anything related to the SDC web project. If you don't know the password but have access to the machine via ssh you can find the list of users, roles and passwords in the conf file for the webserver (tomcat/conf).
|
|
|
To deploy the project, perform the following steps:
|
|
|
|
|
|
1. Right click the project in Eclipse and choose Export -> WAR file. Make sure your output file is called `ROOT.war`
|
|
|
2. login to the [managment web interface of the tomcat server](sdc.leibniz-kis.de:8080/manager)
|
|
|
3. Undeploy the running SDC version by hitting the `undeploy` button for the sdc application.
|
|
|
4. Browse to the new file in the `deploy` section and hit the `deploy` button
|
|
|
|
|
|
## Tomcat
|
|
|
|
|
|
* Führt `.jar` aus läuft unter SDC
|
|
|
* Version 8.5
|
|
|
* tar runterladen, extrahieren
|
|
|
* dabei auf Ordner achten: am besten im home ordner oder iwo anders wo man als Nutzer die richtigen Rechte hat
|
|
|
* im `bin` ordner gibt es ein `startup.sh` und `shutdown.sh`
|
|
|
* offene ports: 8080, 8443 wenn ssl/https (noch nicht implementiert)
|
|
|
* [manager](sdc.leibniz-kis.de:8080/manager) (login u:tomcat;pw:sdc_standard) rollen/user file liegt in tomcat/conf
|
|
|
* lässt einzlene applications neu starten ausschalten etc
|
|
|
* man kann einzelne sessions verwalten
|
|
|
* manama: dev server Thomas Hederer
|
|
|
* `.WAR` aus eclipse exportieren und deployen von tomcat manager aus aussuchen unter deploy
|
|
|
* tomcat `folder/webapps/ROOT.WAR`
|
|
|
* zugriffe auf sdc.leibniz-kid.de werden auf port 8080 umgeleitet weitere anhängsel der URL nicht
|
|
|
* [Website Statistik](sdc.leibniz-kis.de/piwik) login admin, pw wie immer
|
|
|
* tracking code liegt auf jeder seite, dait funktioniert die statistik |
|
|
\ No newline at end of file |