>
>
> On the server you would have this:
> public static class RootResource
> extends ContextResource
> {
> public void commandwithvalue( TestCommand command )
> throws Throwable
> {
> rootContext().**commandWithValue( command );
> }
>
> public Links commandwithvalue()
> {
> return new LinksBuilder(module).
> command( "commandwithvalue" ).
> addLink( "Command ABC","right" ).
> addLink( "Command XYZ", "wrong" ).newLinks();
> }
> }
>
How would that work in the html client, having a command and a query with
the same name? Wouldn't it create identical links for both methods?
> crc.onResource( new ResultHandler<Resource>()
> {
> // On refresh, first query "commandwithvalue" to get the list
> // of possible links, each of which represents a selection
>
> @Override
> public void handleResult( Resource result, ContextResourceClient client
> )
> {
> client.query( "commandwithvalue" );
>
So because the initial crc.refresh() has discovered the query
"commandwithvalue" and command "commandwithvalue", we can do the
client.query( "commandwithvalue" ). The name refers to the "rel" attribute
of the discovered operations, right? As I understand it there is no
modifying urls anywhere.
> [SNIP]
> .onQuery( "commandwithvalue", Links.class, new ResultHandler<Links>()
> {
> // Select a link from the list and invoke it
> @Override
> public void handleResult( Links result, ContextResourceClient client )
> {
> Link link = LinksUtil.withId( "right", result);
>
> client.command( link );
> }
>
How is the input parameter for the command handled? The commandwithvalue
needs a TestCommand as input.
I'm not sure I understand the analogy that a resource (i.e. ending with "/")
is a use case. To me it makes more sense that commands or queries are use
cases. Resources are merely containers of use cases - in what resource the
use case is located is not relevant for the client.
Regards,
Mads
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev