d2wContext in non-d2w components
d2wContext in non-d2w components
- Subject: d2wContext in non-d2w components
- From: Mark Wardle <email@hidden>
- Date: Sun, 1 Nov 2009 20:27:02 +0000
Anything dodgy about doing this in my PageWrapper class? It seems to work...
/**
* Returns the current D2W context, creating one if it doesn't already exist...
* @return
*/
public D2WContext d2wContext() {
NSSelector<Void> sel = new NSSelector<Void>("d2wContext");
if(sel.implementedByObject(context().page())) {
return (D2WContext) context().page().valueForKey("d2wContext");
}
if (context().hasSession()) {
return new D2WContext(context().session());
}
return new D2WContext();
}
I'm creating a D2W context if there isn't already one provided by the page.
I think this is the only way I can make non-D2W components aware of
the D2W rules?
Thanks,
Mark
--
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden