You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Felix Meschberger <fm...@gmail.com> on 2007/10/15 14:47:41 UTC

Re: [microsling] Resource interface (was: microsling script resolution rewritten)

Am Montag, den 15.10.2007, 14:14 +0200 schrieb Bertrand Delacretaz:
> On 10/14/07, Felix Meschberger <fm...@gmail.com> wrote:
> 
> > ...Regarding the resource: I think, we should provide the JCR item to which
> > the request URL resolved with a proper method, such as "Item getItem();"
> > and leave the "Object getDate();" method to the object mapping. ..
> 
> Fine with me, although this makes the Resource more JCR-specific. But
> I think we're fine with that.

The problem is, that we might want both, the JCR item and the mapped
object. If the getData method would return either of both, how would we
access the other ?

> > ...In
> > addition, I would provide the selectors, extension and suffix in the
> > Resource, too, as proposed on the Wiki page...
> 
> I don't like this - I'd much prefer a ParsedRequestPath object, stored
> in the SlingRequestContext, that's initialized when the Resource is
> resolved.
> 
> I don't think extension, selectors and the like belong in the
> Resource. They describe how the request path was parsed to find the
> Resource, but they are definitely not part of the resource itself.
> 
> And I feel it important to keep the Resource interface as small as
> possible, as it's a central part of microsling - keeping it small
> helps people focus on what's important.

Agreed. I just put them in the resource because the somewhat fit neatly.
But they might as well be put in the request context.

> What do you think? Could we put this info somewhere else?
> 
> > ...Providing the JCR Item and mapped object in the Resource interface
> > itself would of course stipulate, that microsling (and hence Sling, see
> > my other posting in this thread) would be based on the repository and/or
> > mapping and there would be no other source such as the filesystem etc....
> 
> Using other data sources would still be possible, in which case
> Resource.getItem() returns null and Resource.getData() returns the
> File or whatever object. But I think we all agree that that's not our
> focus.

Exactly.

Regards
Felix


Re: [microsling] Resource interface (was: microsling script resolution rewritten)

Posted by Bertrand Delacretaz <bd...@apache.org>.
On 10/15/07, Felix Meschberger <fm...@gmail.com> wrote:
> ...The problem is, that we might want both, the JCR item and the mapped
> object. If the getData method would return either of both, how would we
> access the other ?...

You're right, we need both getData() and getItem() in the resource.

-Bertrand