dimanche 1 mars 2015

Spring REST representation class

I'm reading the two introductory articles about bulding and consuming Spring Rest web services.


What's weird - they're creating a Greeting representation class in the client app (second link ref) for storing the GET response (the greetingmethod on server side returns a Greeting object). But the Greeting classes on the server and client side are different classes - well, they are two distinct classes with identical names, identical field names and types (client's doesn't have a constructor).


Does it mean I have to similarly rewrite the class from stratch when building the client app? In order to do that, I'd need specs on what are the fields' types of JSON-packed objects passed by server's app. A server serializes the object of class ABCClass to JSON and sends it to client. Even if some field called 'abc' has value 10, it doesn't make it an integer. Next time it might contain a string.


My question is - how much information from server app's devs do I need in order to create a client application? How is it usually done?


Aucun commentaire:

Enregistrer un commentaire