Garantie de satisfaction à 100% Disponible immédiatement après paiement En ligne et en PDF Tu n'es attaché à rien 4.2 TrustPilot
logo-home
Resume

Samenvatting Java Advanced (Theorie)

Note
-
Vendu
1
Pages
16
Publié le
13-07-2021
Écrit en
2019/2020

Samenvatting van Java Advanced dat in het 2e jaar Applicatieontwikkeling en AI wordt gegeven.











Oups ! Impossible de charger votre document. Réessayez ou contactez le support.

Infos sur le Document

Publié le
13 juillet 2021
Nombre de pages
16
Écrit en
2019/2020
Type
Resume

Aperçu du contenu

Les 1: MVC met Spring Boot en Thymeleaf
MVC staat voor Model-View-Controller = een patroon dat ervoor zorgt dat programma’s
in 3 lagen worden opgebouwd met het oog op de leesbaarheid, onderhoudbaarheid en
uitbreidbaarheid van programma’s.

De 3 lagen binnen het MVC-patroon:

• In de ‘back-end’ bevindt zich de ‘Model’-laag: deze laag is opgevuld met
zelfgemaakte klassen die gebruikt zullen worden om gegevens in te plaatsen
(attributen) en functionaliteiten uit te voeren (methoden)
• De ‘Controller’-laag = de ‘tussenlaag’ of middle-tier: hierin zitten de klassen die de
communicatie tussen de view en de model regelt
• De ‘front-end’ of de ‘View’-laag regelt de interface voor de gebruiker. In een
webapplicatie bestaat deze laag uit webpagina’s waarin html-, css-, afbeeldingen
enz… gezet worden.

Thymeleaf is een server-side Java template engine

• Stelt een aantal extra attributen (th:) ter beschikking om te gebruiken in HTML-
pagina’s
• Samen met data uit het model gaan deze tags dan dynamisch inhoud aanvullen of
weglaten uit de HTML-pagina
• Worden door de compiler geïnterpreteerd en omgezet naar échte HTML-pagina’s




Spring Framework

• one of the most widely used JEE-frameworks for building applications for the java
platform
• It aims to simplify the JEE development and helps developers be more productive
at work
• focuses on several areas of an application and provides a wide range of features
• One of the major features is the dependency injection. It helps make things
simpler by allowing us to develop loosely coupled applications

Spring Boot

• While the spring framework focuses on providing flexibility to you, spring
boot aims to shorten the code length and provide you with the easiest way to
develop a web application

• It helps create a stand-alone application with less or almost zero-configuration

• Autoconfiguration is a special feature in spring boot. It automatically
configures a class based on that requirements

• Dependency resolution

• Minimum configuration

• Embedded server for testing



JDK 2020 1

, • Bean auto scan

• Heath metrics

Spring Framework & Spring Boot werken met @annotaties

Controller in Spring Boot:

• er is geen extra code nodig om van een klasse een controller te maken en om de
inhoud van de HTTP-request’s te controleren. Dit wordt gedaan door de annotaties.
Elk http-request MOET nu wel via de Controller passeren.
• Is een klasse @Controller
o Bij het opstarten van de applicatie wordt automatisch een object van de
klasse MainController gemaakt waarmee het request kan opgevangen worden
o Request opvangen met @RequestMapping
o Om een gegeven door te sturen van een webpagina heb je Model klasse
nodig
o Model.addAttribute() voegt een gegeven toe aan het model object
o Met @{..} kan je naar een URL verwijzen
o Je kan interessante methoden gebruiken om datums, getallen, Strings enz…
op te maken door “Expression Utility Objects” van Thymeleaf te gebruiken. Dit
doe je met het prefix #

Les 2: REST

REST = Representational State Transfer

Something that allows one piece of software to talk to another piece of software over the
HTTP protocol.

REST requires that a client makes a request to the server in order to retrieve or modify data
on the server. A request generally consists of:

• HTTP verb (get, put, post, delete)
• Header which allows the client to pass along information about the request
• Path to a resource

Rest: SEPARATION OF CLIENT AND SERVER

• In the REST architectural style, the implementation of the client and the
implementation of the server can be done independently without each knowing about
the other. This means that the code on the client side can be changed at any time
without affecting the operation of the server, and the code on the server side can be
changed without affecting the operation of the client.

• As long as each side knows what format of messages to send to the other, they can
be kept modular and separate. Separating the user interface concerns from the data
storage concerns, we improve the flexibility of the interface across platforms and
improve scalability by simplifying the server components. Additionally, the separation
allows each component the ability to evolve independently.




JDK 2020 2

, • By using a REST interface, different clients hit the same REST endpoints, perform the
same actions, and receive the same responses.

Rest: stateless

• Systems that follow the REST paradigm are stateless, meaning that the server does
not need to know anything about what state the client is in and vice versa. In this
way, both the server and the client can understand any message received, even
without seeing previous messages. This constraint of statelessness is enforced
through the use of resources, rather than commands. Resources are the nouns of the
Web - they describe any object, document, or thing that you may need to store or
send to other services.

• These constraints help RESTful applications achieve reliability, quick performance,
and scalability, as components that can be managed, updated, and reused without
affecting the system as a whole, even during operation of the system.

@RestController is an annotation for creating Restful controllers. It is autodetected through
classpath scanning. It converts the response to JSON or XML. It is typically used in
combination with annotated handler methods based on the @RequestMapping annotation
(@GetMapping, @PostMapping, @PutMapping, @DeleteMapping).

JSON format?

• JavaScript Object Notation

• a lightweight format for storing and transporting data

• is often used when data is sent from a server to a web page

• Standard for NoSQL databases like MongoDB

• "self-describing" and easy to understand

A POST request to /opleidingen adds the new opleiding-object that is
delivered with the request, and then returns the saved opleiding-object for
the user to view

@RequestBody

Says that the body of the incoming POST request is an Opleiding object




JDK 2020 3
€8,49
Accéder à l'intégralité du document:

Garantie de satisfaction à 100%
Disponible immédiatement après paiement
En ligne et en PDF
Tu n'es attaché à rien

Faites connaissance avec le vendeur

Seller avatar
Les scores de réputation sont basés sur le nombre de documents qu'un vendeur a vendus contre paiement ainsi que sur les avis qu'il a reçu pour ces documents. Il y a trois niveaux: Bronze, Argent et Or. Plus la réputation est bonne, plus vous pouvez faire confiance sur la qualité du travail des vendeurs.
GraduateITF Thomas More Hogeschool
Voir profil
S'abonner Vous devez être connecté afin de suivre les étudiants ou les cours
Vendu
20
Membre depuis
4 année
Nombre de followers
9
Documents
16
Dernière vente
1 mois de cela

3,0

1 revues

5
0
4
0
3
1
2
0
1
0

Récemment consulté par vous

Pourquoi les étudiants choisissent Stuvia

Créé par d'autres étudiants, vérifié par les avis

Une qualité sur laquelle compter : rédigé par des étudiants qui ont réussi et évalué par d'autres qui ont utilisé ce document.

Le document ne convient pas ? Choisis un autre document

Aucun souci ! Tu peux sélectionner directement un autre document qui correspond mieux à ce que tu cherches.

Paye comme tu veux, apprends aussitôt

Aucun abonnement, aucun engagement. Paye selon tes habitudes par carte de crédit et télécharge ton document PDF instantanément.

Student with book image

“Acheté, téléchargé et réussi. C'est aussi simple que ça.”

Alisha Student

Foire aux questions