Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rest-tutoriel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maxence Devigne
rest-tutoriel
Commits
c648cf1e
Commit
c648cf1e
authored
4 years ago
by
Yvan Peter
Browse files
Options
Downloads
Patches
Plain Diff
resultat en JSON/DTO
parent
f79e29bd
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+15
-1
15 additions, 1 deletion
README.md
with
15 additions
and
1 deletion
README.md
+
15
−
1
View file @
c648cf1e
...
@@ -195,7 +195,7 @@ public class InfoTaux {
...
@@ -195,7 +195,7 @@ public class InfoTaux {
}
}
~~~
~~~
Nous pouvons maintenant utiliser ce DTO pour renvoyer la liste des taux existant au client :
Nous pouvons maintenant utiliser ce DTO pour renvoyer la liste des taux existant
s
au client :
~~~
java
~~~
java
@GET
@GET
...
@@ -209,3 +209,17 @@ public List<InfoTaux> getInfoTaux() {
...
@@ -209,3 +209,17 @@ public List<InfoTaux> getInfoTaux() {
}
}
~~~
~~~
Un test de cette nouvelle méthode devrait renvoyer le résultat suivant :
~~~
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 135
[{"label":"NORMAL","taux":20.0},{"label":"INTERMEDIAIRE","taux":10.0},{"label":"REDUIT","taux":5.5},{"label":"PARTICULIER","taux":2.1}]
~~~
On peut observer que :
-
pour chaque propriété de la classe
`InfoTaux`
, on a une propriété équivalente dans les objets JSON
-
la liste renvoyée en Java a été convertie en tableau d'objets JSON
-
Jersey a choisi le type MIME le plus adapté pour le résultat renvoyé dans le corps de la réponse :
`Content-Type: application/json`
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment