[Engine-devel] REST API calls from the GUI
Michael Pasternak
mpastern at redhat.com
Sun Feb 24 08:05:13 UTC 2013
On 02/21/2013 03:30 PM, Vojtech Szocs wrote:
> Hi guys,
>
>>>>>> >>> > > We can't directly use the restapi models in the client side, as
>>>>>> >>> > > they have lot of xml and annotations stuff involved which will not
>>>>>> >>> > > be compatible with GWT.
>>>> >> >
>>>> >> > why? they only have jaxb annotations which are 'must' for
>>>> >> > serialization & talking with api.
> Actually, we *can* use JAXB-generated REST API Java types with GWT, since GWT compiler simply ignores annotations in Java sources during compilation to JavaScript.
>
> The only problem I see is REST API Java types using stuff like javax.xml.datatype.XMLGregorianCalendar - we'd have to emulate it in GWT (shouldn't be an issue).
>
> Other than that, I'd recommend using JAXB-generated REST API Java types, as they always match current REST API schema (api.xsd).
>
> As for the marshalling layer, we can't use JAXB (REST API Java SDK) with GWT, but we can still write deferred binding generator to generate mappers for XML <--> Rest API Java type conversion.
>
>> > if you not using JAXB, you should make sure calling variables in the classes that will be marshalled to XML
>> > as they are defined in the api schema and not using Java naming convention (as XJC does),
> Yeah, with XML representation we would have to do this ourselves.
>
> On the other hand, things would be much simpler if REST API supported JSON, which is something we should consider (wait for JSON support? work with XML?)
not sure we will support JSON in near future as we're blocked by underlying provider.
>
>>>>>> >>> > > It would be better if We can come up with a "GWT REST API SDK",
>>>>>> >>> > > which is analogous Java SDK.
> I'd rather have JavaScript REST API SDK which we could use with GWT, this would open up new possibilities for web clients.
>
> Vojtech
--
Michael Pasternak
RedHat, ENG-Virtualization R&D
More information about the Devel
mailing list