On Dec 3, 2009, at 3:53 PM, Santiago Pericas-Geertsen wrote:
>
> On Dec 3, 2009, at 7:12 AM, Paul Sandoz wrote:
>
>> How do you think this would look if one were not proxy to resources
>> but to links of representations (be it headers or in the content)?
>> i.e. the client side does not use @Path as the links are declared
>> by server in the returned representations.
>
> Using links in representations seems definitely more RESTy.
>
Yes, i think restfulie-java is very interesting.
>>
>> Warning brain dump mode...
>>
>> WebResource r = ...
>> Purchase b = r.get(Purchase.class)
>
> s/b/p right?
>
Yes.
>>
>> OrderType ot = ...
>> Order o = p.purchase(ot); // This performs a post on an
>> appropriate URI declared
>> // in representation
>> returned from initial GET request
>>
>> o.update(ot);
>> WebResource or = o.getResource();
>> or.delete();
>>
>>
>> Purchase is not a JAXB bean but a proxy that knows about possible
>> link types returned in the representation of r. Thus Purchase may
>> be defined in terms of link types and maybe XPath expressions.
>
> Just to make sure I understand it, you mean Purchase is an interface
> implemented by a dynamically generated proxy class of which 'p' is
> an instance?
Yes.
> If so, even though the proxy class can be generated dynamically, the
> interface Purchase must be known statically in Java.
>
Yes. Or maybe this is the wrong way to go about it and Purchase should
be a concrete class, i am not really sure. But in any case i think
some form of code generation can be application in such cases to ease
the development.
> Is there a bootstrap process in your brain that you can dump?
>
Imagine you have one bootstrap URI. And then you could drive all
interactions by the client receiving links (and instructions how to
construct new links e.g. think HTML forms) from the representations
returned by the server. When a client traverses to a new link it makes
a state transition to a new application state. The server defines the
set of possible state transitions as links in the representations it
returns. The client can choose to transition based on the type of the
link (and perhaps additional meta-data in the representation
associated with the link).
So it s really a state-based machine. And what we want to proxy or
encapsulate is, given a representation, one or more typed link to
execute state transitions.
And it is not just the client-side but also the server-side in the
production of links and state management.
Does that help?
Paul.