Hi Alex,

adding some contexobject is IMHO not hidding anything. There are cases
where you would want to have the context for creation of a model (or any
other adaptable) - so at construction time which disqualifieds some method
to be called afterwards.
What't the issue with someresource.adaptTo(MyClass.class, request)  (or as
bertrand mentioned any other payload) which could be used by the
AdapterFactory?
In case of Scripting languages as sightly we cannot easily create wrapper
objects that are used for adaption that could hold the real adaptable and
the additional context object(s). Therefore I would love to have this
option and extend the Sightly use to be able to hand over an additional
object and/or by default trying to add the request object if adapted from a
model. The Sling Model or adaptable could then utilize this request object
or simply ignore it where not necessary.

Best regards
Dominik

On Thu, Oct 23, 2014 at 10:50 PM, Alexander Klimetschek <aklim...@adobe.com>
wrote:

> On 23.10.2014, at 01:04, Dominik Süß <dominik.su...@gmail.com> wrote:
> >
> > While request.adaptTo(Target.class) would enable an AdapterFactory to get
> > hold of the currentResource there is no chance to get the the custom
> > resource.
>
> Why not have a setter?
>
> MyModel model = resource.adaptTo(MyModel.class)'
> model.setRequest(slingRequest);
>
> or just pass it along with the methods you call, if you only need it in
> some calls:
>
> model.doSomething("foo", slingRequest);
>
>
> IMO it is very important that devs using code are aware that they are
> using the request object and are in a request scope or not, so hiding it is
> not something you want to strive for.
>
> Cheers,
> Alex
>
>

Reply via email to