isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Haywood <...@haywood-associates.co.uk>
Subject Re: GSOC2013 - ISIS-371 (an android viewer)
Date Sat, 13 Apr 2013 07:25:15 GMT
Hi Upeksha,
Sorry not to reply sooner; I'll answer your posts in order...

On 11 April 2013 18:06, DImuthu Upeksha <dimuthu.upeksha2@gmail.com> wrote:

>
> I went through several several REST api tutorials. The first thing I
> understood is that REST is almost similar to HTTP (Isn't it?).
>

Hmm.  That's a bit simplistic, but I understand why you might say it.  It's
probably better to say that REST is a description of the architecture of
the web, with HTTP and HTML being two technologies that implement the REST
constraints [1][2] (uniform access, hypermedia, etc)



> In sample application I had some experiences with restful object
> viewer. I'm really impressed the way it provide all data through JSON.
> However as always I have several problems.
>
> 1. At the very beginning I went to the url -
> http://localhost:8080/restful/ It gave following output.
>
> {
> links: [
> {
> rel: "self",
> href: "http://localhost:8080/restful/",
> method: "GET",
> type: "application/json;profile="urn:org.restfulobjects/homepage""
> },
> {
> rel: "user",
> href: "http://localhost:8080/restful/user",
> method: "GET",
> type: "application/json;profile="urn:org.restfulobjects/user""
> },
> {
> rel: "services",
> href: "http://localhost:8080/restful/services",
> method: "GET",
> type: "application/json;profile="urn:org.restfulobjects/list""
> },
> {
> rel: "version",
> href: "http://localhost:8080/restful/version",
> method: "GET",
> type: "application/json;profile="urn:org.restfulobjects/version""
> },
> {
> rel: "types",
> href: "http://localhost:8080/restful/domainTypes",
> method: "GET",
> type: "application/json;profile="urn:org.restfulobjects/typelist""
> }
> ],
> extensions: { }
> }
>
>
> I'm completely ok with the content of the output. But the thing I need
> to clarify is from where did this json object come from.


In implementation terms, it is constructed by the RO viewer (the
DomainServiceResourceServerside, if you want to look at the code).  The
structure is as defined by the RO spec [3]



> And can we
> change the content of this output. (As an example:  can we remove
> domainTypes link from this JSON object?). If so how?
>

No.  And you shouldn't; the spec says it should be there.  If you don't
need the "domainTypes" link, then ignore it.  (Just like if you browse a
website as a human; you follow the links you care about, ignore the others).



>
> 2. I consist of a link - "http://localhost:8080/restful/domainTypes"
> but all we need is "http://localhost:8080/restful/services" because at
> gui level we interact with those Services (am I correct?)


Generally, yes... the services link is the most commonly traversed one.



> not with
> those domainTypes. If so what is the use of domain types to gui level?
>
>
The domainTypes link is access into the metamodel.  It describes the
structure of the classes.  You can think of it as equivalent to
java.lang.Class, whereas services takes you into the domain objects
themselves (java.lang.Object).




> 3. If I speak straight, is the purpose of project to map these json
> objects details to android gui?
>
>
One reason you might need it is to discover whether an object of one type
is type compatible with a parameter or property.  For these you would use
isSubtypeOf, isSupertype (section 27 of the spec).  But I can imagine
viewers that might traverse the domain types and cache them, eg in order to
use them to lookup templates for rendering.



HTH
Dan

[1]
https://en.wikipedia.org/wiki/Representational_state_transfer#Constraints
[2] http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
[3] http://restfulobjects.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message