Pages enfant
  • 3.12.1 Ecrire le service REST à exposer

Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

Pour avoir plus d'information sur les annotations JAX-RS Cf.JAX-RS : Understanding the Basics

Exemple d'utilisation

...

Ajout

Bloc de code
curl -X PUT \
     -H 'Content-Type: application/json' \
     -d '{"language":"fr","id":"colmant","displayName":"Y Colmant","informations":[{"informationKey":"TRUC","informationValue":"machin"},{"informationKey":"TRUC2","informationValue":"machin2"}],"admin":false }' \
     http://localhost:8080/cxf/rest/domainService/users

...

Lecture

Bloc de code
langjavascript
curl -X GET \
     -H 'Content-Type: application/json' \
     http://localhost:8080/cxf/rest/domainService/users

Renvoie

Bloc de code
languagejavascript
[
 {
Bloc de code
langjavascript
{
 "language": "fr",
  "id": "colmant",
  "displayName": "Y Colmant",
  "informationsadmin": false,
  "informations": [
    {"id": 22,
     "informationValue": "machin",
     "informationKey": "TRUC"
    },
    {"id": 23,
     "informationValue":53 "machin2",
     "informationKey":"INSERT_DATE",
 "TRUC2"
    },
    {"id": 24,
     "informationValue": "20112013/0603/1001 1217:57:27:01",
     "informationKey": "INSERT_DATE"
    }
  ],
 "admin":false
}}
]

On note que l'on a un item supplémentaire pour informations. C'est le code métier de l'application qui l'a ajouté

Suppression

Bloc de code