(ignore second copy if this comes doubled...offline Gmail + 2
computers + Gmail was down)

Hi,

2009/2/24 Felix Meschberger <fmesc...@gmail.com>:
> ...SLING-344 [1] added the StarResource [2] to support requests to
> explicitly unknown resources like /* or /*.html. One feature of this
> class is, that it adapts to a "FakeNode"....

Yes, the use case for that is when building a simple CRUD application.

Requesting the StarResource and adapting that to a Node provides you
with empty values for all the node's properties, so if using the
sling.wizard() from sling.js you have no code to write for the Create
action.

The only difference between Create and Update in this case, is that
for Create you retrieve the * resource, whereas for Update you
retrieve the actual resource that was created before.

See my "blog in 46 lines" example at
http://dev.day.com/microsling/content/blogs/main/sling-46-lines-blog.html
for an actual mini-app that uses this feature.

> ...having a
> synthetic resource not backed by a JCR item return a non-null result for
> adaptTo(Node.class) is kind of strange.
>
> For this reason, I suggest remove the Node adapter functionality of the
> StarResource, such that
>
>        StarResource.adaptTo(Node.class) == null...

That would break the above use case.

Although I agree with the intention, I think the "edit the magic star
to create content" use case is a valid one, and we need to provide an
alternative before breaking it.

-Bertrand

Reply via email to