Summary
Frameworks voor serverapplicaties - Samenvatting
Een cursus met alle info uit de slides en extra notities. Gemakkelijk om in te zoeken voor het openboek deel.
[Show more]
Preview 4 out of 132 pages
Uploaded on
January 13, 2022
Number of pages
132
Written in
2021/2022
Type
Summary
frameworks
industrieel
ingenieur
informatica
cursus
slides
samenvatting
Institution
Universiteit Gent (UGent)
Education
Industrieel Ingenieur Informatica
Course
Frameworks Voor Serverapplicaties
All documents for this subject (2)
By: matteoholvoet • 1 year ago
$6.33
100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached
FRAMEWORKS VOOR
SERVERAPPLICATIES
FRAMEWORKS VOOR SERVERAPPLICATIES..................................................................................... 1
HOOFDSTUK 1: REST WEBSERVICES ................................................................................................ 6
1.1. HERHALING HTTP .................................................................................................................... 6
1.2. REST WEBSERVICES .................................................................................................................. 7
ARCHITECTURALE BEPERKINGEN .................................................................................................................... 7
VOORBEELD .............................................................................................................................................. 8
URI ......................................................................................................................................................... 9
GLORY OF REST ......................................................................................................................................... 9
1.3. REST WEBSERVICES IN JAVA ......................................................................................................10
ARCHITECTUUR REST API IN SPRING ........................................................................................................... 10
VOORBEELD ............................................................................................................................................ 11
HTTP-aanvragen afbeelden op methodes RestController ................................................................... 11
Parameters in pad................................................................................................................................ 13
Data uit body HTTP-bericht ophalen ................................................................................................... 13
ANTWOORDSTATUS BEPALEN ..................................................................................................................... 14
URI’S IN ANTWOORD ................................................................................................................................ 15
1.4. WEBSERVICES TESTEN...............................................................................................................15
MANUEEL (ALGEMEEN) ............................................................................................................................. 15
HERHALING JUNIT (JAVA) .......................................................................................................................... 16
WEBTESTCLIENT (JAVA – SPRING) .............................................................................................................. 18
1.5. BEVEILIGEN VAN WEBSERVICES ...................................................................................................19
HOOFDSTUK 2: ORM .....................................................................................................................22
2.1. ORM – OBJECT RELATIONAL MAPPING .......................................................................................22
VERSCHIL OO-CONCEPTEN EN RELATIONELE DATABANKEN: TYPES « TABELLEN .................................................. 22
IDENTITEIT .............................................................................................................................................. 22
ORM JAVA ............................................................................................................................................ 23
2.2. JPA IN SPRING........................................................................................................................24
2.3. OVERERVING ORM .................................................................................................................26
TABEL PER KLASSENHIËRARCHIE = DEFAULT ................................................................................................... 26
ELKE KLASSE NAAR EEN TABEL = VERTICALE MAPPING ...................................................................................... 26
ELKE CONCRETE KLASSE NAAR EIGEN TABEL: HORIZONTALE MAPPING ................................................................. 27
2.4. ASSOCIATIES – VALUEOBJECTEN ..................................................................................................27
1
,ENTITEITEN EN VALUE-OBJECTEN ................................................................................................................. 28
VALUE-OBJECTEN (EMBEDDED) ................................................................................................................... 28
2.5. ORM ASSOCIATIES: RELATIES (DEEL 2 EIGENLIJK ASSOCIATIES) ...........................................................30
1-VEEL ................................................................................................................................................... 31
Unidirectioneel .................................................................................................................................... 31
bidirectioneel ....................................................................................................................................... 31
VEEL-VEEL ............................................................................................................................................... 32
Unidirectioneel .................................................................................................................................... 32
1-1 ........................................................................................................................................................ 32
unidirectioneel ..................................................................................................................................... 32
Bidirectioneel ....................................................................................................................................... 33
2.6. WERKING ..............................................................................................................................34
WERKEN MET OBJECTEN ............................................................................................................................ 35
Toestanden van een object.................................................................................................................. 35
Objecten persistent maken.................................................................................................................. 35
Objecten opvragen .............................................................................................................................. 36
Objecten verwijderen .......................................................................................................................... 37
Objecten wijzigen ................................................................................................................................ 37
2.7. JPA – QUERY .........................................................................................................................39
Java Persistence Query Language à zoeken in objecten .................................................................... 39
SQL à zoeken in db ............................................................................................................................. 41
HOOFDSTUK 3: NODE.JS ................................................................................................................42
3.1. NODE.JS EN NPM.....................................................................................................................42
3.2. HTTP-SERVER ........................................................................................................................43
3.3. ROUTING ...............................................................................................................................45
VOORBEELD ............................................................................................................................................. 45
3.4. NODE.JS « THREADS...............................................................................................................46
3.5. EXPRESS ................................................................................................................................48
INLEIDING ............................................................................................................................................... 48
APP.JS .................................................................................................................................................... 49
ROUTING ................................................................................................................................................ 50
samenvatting routing........................................................................................................................... 53
VIEWS .................................................................................................................................................... 53
HOOFDSTUK 4 – WEBSOCKETS ......................................................................................................55
INLEIDING ........................................................................................................................................55
WAT ZIJN WEBSOCKETS? ........................................................................................................................... 55
ARCHITECTUUR ........................................................................................................................................ 55
PROTOCOL............................................................................................................................................... 55
API ................................................................................................................................................56
SERVER ...........................................................................................................................................57
2
,VOORDELEN WEBSOCKETS .......................................................................................................................... 57
HOOFDSTUK 5 – JDBC....................................................................................................................59
5.1. INLEIDING ..............................................................................................................................59
JDBC = JAVA DATABASE CONNECTIVITY API ................................................................................................. 59
JDBC DRIVERS – TYPES .............................................................................................................................. 59
5.2. BASISWERKING: STATEMENTS ....................................................................................................60
STAPPENPLAN .......................................................................................................................................... 60
CONFIGURATIEGEGEVENS INLEZEN............................................................................................................... 61
DRIVERKLASSE LADEN ................................................................................................................................ 62
VERBINDING MAKEN MET DB ...................................................................................................................... 62
STATEMENT MAKEN .................................................................................................................................. 63
STATEMENT UITVOEREN ............................................................................................................................ 63
5.3. BASISWERKING: PREPAREDSTATEMENTS ......................................................................................65
VOORBEELD ............................................................................................................................................. 65
WANNEER GEBRUIKEN?............................................................................................................................. 66
5.4. BASISWERKING: CALLABLESTATEMENTS .......................................................................................67
VOORBEELD ............................................................................................................................................. 68
5.5. BASISWERKING: TRANSACTIES ....................................................................................................68
VOORBEELD ............................................................................................................................................. 69
5.6. UITGEBREID: DATASOURCE ........................................................................................................69
5.7. UITGEBREID: SCROLLABLERESULTSETS .........................................................................................70
VOORBEELD ............................................................................................................................................. 70
VOORWAARDEN ZOEKOPDRACHT ................................................................................................................. 71
5.8. UITGEBREID: ROWSETS ............................................................................................................71
VOORBEELD ............................................................................................................................................. 72
CACHEDROWSET...................................................................................................................................... 72
JOINROWSET........................................................................................................................................... 73
FILTEREDROWSET .................................................................................................................................... 73
5.9. UITGEBREID: SQL3-GEGEVENSTYPES ...........................................................................................75
5.10. ORM « JDBC ....................................................................................................................75
HOOFDSTUK 6 – ADO.NET .............................................................................................................76
6.1. INLEIDING ..............................................................................................................................76
6.2. DATASET ...............................................................................................................................77
VOORBEELD ............................................................................................................................................. 77
6.3. DATAPROVIDER ......................................................................................................................78
6.4. BASISWERKING .......................................................................................................................79
VOORBEELD & JDBC « ADO.NET ............................................................................................................ 79
STAPPENPLAN .......................................................................................................................................... 79
SAMENGEVAT .......................................................................................................................................... 82
3
, HOOFDSTUK 7: REST-SERVICES IN .NET: WEB API ..........................................................................83
7.1. INLEIDING .................................................................................................................................83
WAT IS WEB API? .................................................................................................................................... 83
EEN NIEUW PROJECT ................................................................................................................................. 83
7.2. BASISWERKING...........................................................................................................................84
VOORBEELD ............................................................................................................................................ 84
Model: ToDoItems ............................................................................................................................... 84
Controller ............................................................................................................................................. 86
HOOFDSTUK 8: OPENAPI SPECIFICATIE ..........................................................................................90
8.1. WAT IS OPENAPI SPECIFICATIE? .................................................................................................90
GEGENEERDE JSON .................................................................................................................................. 91
OPENAPI SPECIFICATIE .............................................................................................................................. 93
SWAGGER UI ........................................................................................................................................... 93
8.2. OPENAPI SPECIFICATIE STRUCTUUR............................................. FOUT! BLADWIJZER NIET GEDEFINIEERD.
8.3. OPENAPI SPECIFICATIE STRUCTUUR IN .NET ................................. FOUT! BLADWIJZER NIET GEDEFINIEERD.
HOOFDSTUK 9: ASP.NET CORE MVC ..............................................................................................98
9.1. MVC IN WEBAPPLICATIES .............................................................................................................98
9.2. VOORBEELD...............................................................................................................................99
9.3. ROUTING ..................................................................................................................................99
9.4. MODEL EN CONTROLLER ............................................................................................................. 101
9.5. VIEW ..................................................................................................................................... 102
9.6. DATA VAN CONTROLLER NAAR VIEW ............................................................................................. 104
9.7. DATA VAN CLIENT NAAR DE SERVER............................................................................................... 105
PARAMETERS IN URL .............................................................................................................................. 106
FORMULIER ........................................................................................................................................... 107
9.8. DEPENCENCY INJECTION ............................................................................................................. 109
9.9. VALIDATIE ............................................................................................................................... 109
9.10. OVERPOSTING EN XSRF ........................................................................................................... 112
9.11. GLOBALISATION & LOCALISATION............................................................................................... 114
MAAK INHOUD AANPASBAAR ................................................................................................................... 114
VOORZIE INHOUDE PER TAAL EN CULTUUR ................................................................................................... 116
9.12. AUTHENTICATIE EN AUTHORISATIE .............................................................................................. 117
AUTHENTICATIE ...................................................................................................................................... 118
AUTHORISATIE ....................................................................................................................................... 119
HOOFDSTUK 10: BEVEILIGING ..................................................................................................... 121
10.1. WEBAPPLICATIE: AUTHENTICATIE ............................................................................................... 121
AUTHENTICATIE COOKIES EN TOKENS ......................................................................................................... 121
4