You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Erik de Hair <er...@pocos.nl> on 2014/05/12 17:32:30 UTC

new Wicket pagetypes

Hi,

Is it possible to add pagetypes (that bypass security and have access to the Isis context) or is there some reason why the number of page types is limited right now?

I tried to extend the PageClassRegistry and PageType enum. This kind of works only without access to the Isis context.

I need some pages for users self service (forgotten passwords etc.).

Thanks,
Erik



Re: new Wicket pagetypes

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Erik,

To help support this requirement (for custom pages), I've just implemented
ISIS-793 [1], which simply "opens up" IsisWicketApplication so that it's a
bit easier to override the various stuff that gets set up in init().
 That's not to say we won't do something more formal in the future, but
wanted to make it easier for you to explore and experiment right now.

Cheers
Dan


[1] https://issues.apache.org/jira/browse/ISIS-793


On 19 May 2014 12:32, Erik de Hair <er...@pocos.nl> wrote:

> Hi Dan,
>
> I've been trying do start a anonymous session but the Page still complains
> about not having a session.
>
> Will try to do this later. It's too complex for me right now.
>
> Erik
>
> On 05/13/2014 05:08 PM, Dan Haywood wrote:
>
> I meant WebRequestCycleForIsis; sorry for the confusion.
>
> Just looking at the code, think what we'll need to do is set up an
> "anonymous" authentication session, such that onBeginRequest initializes.
>  However, I don't think it's a particularly easy refactoring... eg
> IsisWicketApplication#init(...) new's up the WebRequestCycleForIsis
> directly, there is no convenient factory method to override.
>
> Also, if there was a dummy session, then as things stand I suspect that the
> Wicket viewer would simply let the user through to the the entity pages.
> We use Wicket's @AuthorizeInstantiation annotation as the way to know if
> the user has been authorized, see for example EntityPage or
> StandaloneCollectionPage.  The role mentioned in that annotation is set up
> in the AuthenticatedWebSessionForIsis.
>
> So one possibility might be to define a new ANONYMOUS role and have the
> anonymous session be granted that role.  Then the new
> UserAccountConfirmationPage would be annotated with that role instead.
>
> So; doable, I think, just not trivial....
>
> Dan
>
>
>
>
> On 13 May 2014 15:34, Erik de Hair <er...@pocos.nl>
> wrote:
>
>
>
> Did you mean WebRequestCycleForIsis or WicketRequestCycleForIsis. The
> former does get hit because it shows up in the last line of the full stack
> trace:
>
> 16:26:17,378  [WebRequestCycleForIsis http-bio-8081-exec-1 WARN ]  Unable
> to obtain exceptionRecognizers (no session), will be treated as
> unrecognized exception
>
> I can't get WicketRequestCycleForIsis be resolved/found.
>
> The page's URI is /portal/wicket/UserAccountConfirmationPage/ (mount in
> IsisWicketApplication)
>
> Erik
>
> On 05/13/2014 04:10 PM, Dan Haywood wrote:
>
> Does WicketRequestCycleForIsis get hit when you access the page?  It'll
> depend on what URL it's mapped to, I think.
>
> Cheers
> Dan
>
>
>
> On 13 May 2014 13:41, Erik de Hair <er...@pocos.nl><mailto:erik@pocos.nl
> ><ma...@pocos.nl>
> wrote:
>
>
>
> What I did until so far:
>
> - Extended PageType enum with my new pagetype
> - Extended PageClassListDefault with my new pageclasstype and getter for
> the pageclass and registered this list in the application configuration:
> bind(PageClassList.class).to(PortalPageClassList.class);
> - Created a pageclass 'WicketActivateUserAccountPage' extending
> PageAbstract
>
> The result is a stacktrace ;-)
>
> java.lang.IllegalStateException: No Session opened for this thread
>     at
>
>
> org.apache.isis.core.runtime.system.context.IsisContext.getSession(IsisContext.java:421)
>     at
>
>
> org.apache.isis.core.runtime.system.context.IsisContext.getPersistenceSession(IsisContext.java:449)
>     at
>
>
> org.apache.isis.viewer.wicket.model.models.ModelAbstract.getServiceAdapters(ModelAbstract.java:55)
>     at
>
>
> org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:37)
>     at
>
>
> org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:30)
>     at
>
>
> org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:121)
>     at
>
>
> org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.buildMenu(AppActionsCssMenuFactory.java:101)
>     at
>
>
> org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.createComponent(AppActionsCssMenuFactory.java:96)
>     at
>
>
> org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract.createComponent(ComponentFactoryAbstract.java:98)
>     at
>
>
> org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.createComponent(ComponentFactoryRegistryDefault.java:122)
>     at
>
>
> org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.addOrReplaceComponent(ComponentFactoryRegistryDefault.java:107)
>     at
>
>
> org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addComponent(PageAbstract.java:361)
>     at
>
>
> org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addApplicationActions(PageAbstract.java:337)
>     at
>
>
> org.apache.isis.viewer.wicket.ui.pages.PageAbstract.<init>(PageAbstract.java:178)
>     at
>
>
> webapp.wicket.ui.pages.users.activate.WicketActivateUserAccountPage.<init>(WicketActivateUserAccountPage.java:82)
>
> The last line references my PageClass.
>
> Where to manage the session injection?
>
> Erik
>
>
> On 05/13/2014 08:10 AM, Dan Haywood wrote:
>
> On 12 May 2014 16:32, Erik de Hair <er...@pocos.nl><mailto:erik@pocos.nl
> ><mailto:erik@pocos.nl
>
>
> <ma...@pocos.nl><mailto:
> erik@pocos.nl>
>
>
> wrote:
>
>
>
> Hi,
>
> Is it possible to add pagetypes (that bypass security and have access to
> the Isis context) or is there some reason why the number of page types is
> limited right now?
>
>
>
>
> As you've probably figured out, its currently fixed to those in the
> PageType enum.
>
> Why? Only that there's been no need to make this extensible before now.
>  The different page types form a close loop; we only ever have to render
> those different sorts.
>
>
>
>
>
>
>
> I tried to extend the PageClassRegistry and PageType enum. This kind of
> works only without access to the Isis context.
>
>
>
>
> I'm looking at the code at it would seem that I don't correctly use the
> PageType or PageClassRegistry mechanism everywhere.  For example, the
> ActionResultResponseType class simply new's up the next page to traverse
> to.
>
> Ignoring that inconsistency for a minute, I do think that it might me that
> if you subclass from PageAbstract (as the other pages all do), then you
> should have all the usual menus etc.
>
> In terms of the Isis context etc, that is setup through the WicketFilter
> calling WebRequestCycleForIsis's onBeginRequest and onEndRequest.  This is
> configured as a callback by IsisWicketApplication when first started.
>
>
>
>
>
> I need some pages for users self service (forgotten passwords etc.).
>
>
>
>
> If you manage to get something working, this would be a nice contribution
> :-)
>
> Cheers
> Dan
>
>
>
>
>
> Thanks,
> Erik
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Re: new Wicket pagetypes

Posted by Erik de Hair <er...@pocos.nl>.
Hi Dan,

I've been trying do start a anonymous session but the Page still complains about not having a session.

Will try to do this later. It's too complex for me right now.

Erik

On 05/13/2014 05:08 PM, Dan Haywood wrote:

I meant WebRequestCycleForIsis; sorry for the confusion.

Just looking at the code, think what we'll need to do is set up an
"anonymous" authentication session, such that onBeginRequest initializes.
 However, I don't think it's a particularly easy refactoring... eg
IsisWicketApplication#init(...) new's up the WebRequestCycleForIsis
directly, there is no convenient factory method to override.

Also, if there was a dummy session, then as things stand I suspect that the
Wicket viewer would simply let the user through to the the entity pages.
We use Wicket's @AuthorizeInstantiation annotation as the way to know if
the user has been authorized, see for example EntityPage or
StandaloneCollectionPage.  The role mentioned in that annotation is set up
in the AuthenticatedWebSessionForIsis.

So one possibility might be to define a new ANONYMOUS role and have the
anonymous session be granted that role.  Then the new
UserAccountConfirmationPage would be annotated with that role instead.

So; doable, I think, just not trivial....

Dan




On 13 May 2014 15:34, Erik de Hair <er...@pocos.nl> wrote:



Did you mean WebRequestCycleForIsis or WicketRequestCycleForIsis. The
former does get hit because it shows up in the last line of the full stack
trace:

16:26:17,378  [WebRequestCycleForIsis http-bio-8081-exec-1 WARN ]  Unable
to obtain exceptionRecognizers (no session), will be treated as
unrecognized exception

I can't get WicketRequestCycleForIsis be resolved/found.

The page's URI is /portal/wicket/UserAccountConfirmationPage/ (mount in
IsisWicketApplication)

Erik

On 05/13/2014 04:10 PM, Dan Haywood wrote:

Does WicketRequestCycleForIsis get hit when you access the page?  It'll
depend on what URL it's mapped to, I think.

Cheers
Dan



On 13 May 2014 13:41, Erik de Hair <er...@pocos.nl>
wrote:



What I did until so far:

- Extended PageType enum with my new pagetype
- Extended PageClassListDefault with my new pageclasstype and getter for
the pageclass and registered this list in the application configuration:
bind(PageClassList.class).to(PortalPageClassList.class);
- Created a pageclass 'WicketActivateUserAccountPage' extending
PageAbstract

The result is a stacktrace ;-)

java.lang.IllegalStateException: No Session opened for this thread
    at

org.apache.isis.core.runtime.system.context.IsisContext.getSession(IsisContext.java:421)
    at

org.apache.isis.core.runtime.system.context.IsisContext.getPersistenceSession(IsisContext.java:449)
    at

org.apache.isis.viewer.wicket.model.models.ModelAbstract.getServiceAdapters(ModelAbstract.java:55)
    at

org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:37)
    at

org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:30)
    at

org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:121)
    at

org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.buildMenu(AppActionsCssMenuFactory.java:101)
    at

org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.createComponent(AppActionsCssMenuFactory.java:96)
    at

org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract.createComponent(ComponentFactoryAbstract.java:98)
    at

org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.createComponent(ComponentFactoryRegistryDefault.java:122)
    at

org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.addOrReplaceComponent(ComponentFactoryRegistryDefault.java:107)
    at

org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addComponent(PageAbstract.java:361)
    at

org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addApplicationActions(PageAbstract.java:337)
    at

org.apache.isis.viewer.wicket.ui.pages.PageAbstract.<init>(PageAbstract.java:178)
    at

webapp.wicket.ui.pages.users.activate.WicketActivateUserAccountPage.<init>(WicketActivateUserAccountPage.java:82)

The last line references my PageClass.

Where to manage the session injection?

Erik


On 05/13/2014 08:10 AM, Dan Haywood wrote:

On 12 May 2014 16:32, Erik de Hair <er...@pocos.nl><mailto:erik@pocos.nl


<ma...@pocos.nl>


wrote:



Hi,

Is it possible to add pagetypes (that bypass security and have access to
the Isis context) or is there some reason why the number of page types is
limited right now?




As you've probably figured out, its currently fixed to those in the
PageType enum.

Why? Only that there's been no need to make this extensible before now.
 The different page types form a close loop; we only ever have to render
those different sorts.







I tried to extend the PageClassRegistry and PageType enum. This kind of
works only without access to the Isis context.




I'm looking at the code at it would seem that I don't correctly use the
PageType or PageClassRegistry mechanism everywhere.  For example, the
ActionResultResponseType class simply new's up the next page to traverse
to.

Ignoring that inconsistency for a minute, I do think that it might me that
if you subclass from PageAbstract (as the other pages all do), then you
should have all the usual menus etc.

In terms of the Isis context etc, that is setup through the WicketFilter
calling WebRequestCycleForIsis's onBeginRequest and onEndRequest.  This is
configured as a callback by IsisWicketApplication when first started.





I need some pages for users self service (forgotten passwords etc.).




If you manage to get something working, this would be a nice contribution
:-)

Cheers
Dan





Thanks,
Erik





















Re: new Wicket pagetypes

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
I meant WebRequestCycleForIsis; sorry for the confusion.

Just looking at the code, think what we'll need to do is set up an
"anonymous" authentication session, such that onBeginRequest initializes.
 However, I don't think it's a particularly easy refactoring... eg
IsisWicketApplication#init(...) new's up the WebRequestCycleForIsis
directly, there is no convenient factory method to override.

Also, if there was a dummy session, then as things stand I suspect that the
Wicket viewer would simply let the user through to the the entity pages.
We use Wicket's @AuthorizeInstantiation annotation as the way to know if
the user has been authorized, see for example EntityPage or
StandaloneCollectionPage.  The role mentioned in that annotation is set up
in the AuthenticatedWebSessionForIsis.

So one possibility might be to define a new ANONYMOUS role and have the
anonymous session be granted that role.  Then the new
UserAccountConfirmationPage would be annotated with that role instead.

So; doable, I think, just not trivial....

Dan




On 13 May 2014 15:34, Erik de Hair <er...@pocos.nl> wrote:

> Did you mean WebRequestCycleForIsis or WicketRequestCycleForIsis. The
> former does get hit because it shows up in the last line of the full stack
> trace:
>
> 16:26:17,378  [WebRequestCycleForIsis http-bio-8081-exec-1 WARN ]  Unable
> to obtain exceptionRecognizers (no session), will be treated as
> unrecognized exception
>
> I can't get WicketRequestCycleForIsis be resolved/found.
>
> The page's URI is /portal/wicket/UserAccountConfirmationPage/ (mount in
> IsisWicketApplication)
>
> Erik
>
> On 05/13/2014 04:10 PM, Dan Haywood wrote:
>
> Does WicketRequestCycleForIsis get hit when you access the page?  It'll
> depend on what URL it's mapped to, I think.
>
> Cheers
> Dan
>
>
>
> On 13 May 2014 13:41, Erik de Hair <er...@pocos.nl>
> wrote:
>
>
>
> What I did until so far:
>
> - Extended PageType enum with my new pagetype
> - Extended PageClassListDefault with my new pageclasstype and getter for
> the pageclass and registered this list in the application configuration:
> bind(PageClassList.class).to(PortalPageClassList.class);
> - Created a pageclass 'WicketActivateUserAccountPage' extending
> PageAbstract
>
> The result is a stacktrace ;-)
>
> java.lang.IllegalStateException: No Session opened for this thread
>     at
>
> org.apache.isis.core.runtime.system.context.IsisContext.getSession(IsisContext.java:421)
>     at
>
> org.apache.isis.core.runtime.system.context.IsisContext.getPersistenceSession(IsisContext.java:449)
>     at
>
> org.apache.isis.viewer.wicket.model.models.ModelAbstract.getServiceAdapters(ModelAbstract.java:55)
>     at
>
> org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:37)
>     at
>
> org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:30)
>     at
>
> org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:121)
>     at
>
> org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.buildMenu(AppActionsCssMenuFactory.java:101)
>     at
>
> org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.createComponent(AppActionsCssMenuFactory.java:96)
>     at
>
> org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract.createComponent(ComponentFactoryAbstract.java:98)
>     at
>
> org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.createComponent(ComponentFactoryRegistryDefault.java:122)
>     at
>
> org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.addOrReplaceComponent(ComponentFactoryRegistryDefault.java:107)
>     at
>
> org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addComponent(PageAbstract.java:361)
>     at
>
> org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addApplicationActions(PageAbstract.java:337)
>     at
>
> org.apache.isis.viewer.wicket.ui.pages.PageAbstract.<init>(PageAbstract.java:178)
>     at
>
> webapp.wicket.ui.pages.users.activate.WicketActivateUserAccountPage.<init>(WicketActivateUserAccountPage.java:82)
>
> The last line references my PageClass.
>
> Where to manage the session injection?
>
> Erik
>
>
> On 05/13/2014 08:10 AM, Dan Haywood wrote:
>
> On 12 May 2014 16:32, Erik de Hair <er...@pocos.nl><mailto:erik@pocos.nl
> ><ma...@pocos.nl>
> wrote:
>
>
>
> Hi,
>
> Is it possible to add pagetypes (that bypass security and have access to
> the Isis context) or is there some reason why the number of page types is
> limited right now?
>
>
>
>
> As you've probably figured out, its currently fixed to those in the
> PageType enum.
>
> Why? Only that there's been no need to make this extensible before now.
>  The different page types form a close loop; we only ever have to render
> those different sorts.
>
>
>
>
>
>
>
> I tried to extend the PageClassRegistry and PageType enum. This kind of
> works only without access to the Isis context.
>
>
>
>
> I'm looking at the code at it would seem that I don't correctly use the
> PageType or PageClassRegistry mechanism everywhere.  For example, the
> ActionResultResponseType class simply new's up the next page to traverse
> to.
>
> Ignoring that inconsistency for a minute, I do think that it might me that
> if you subclass from PageAbstract (as the other pages all do), then you
> should have all the usual menus etc.
>
> In terms of the Isis context etc, that is setup through the WicketFilter
> calling WebRequestCycleForIsis's onBeginRequest and onEndRequest.  This is
> configured as a callback by IsisWicketApplication when first started.
>
>
>
>
>
> I need some pages for users self service (forgotten passwords etc.).
>
>
>
>
> If you manage to get something working, this would be a nice contribution
> :-)
>
> Cheers
> Dan
>
>
>
>
>
> Thanks,
> Erik
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Re: new Wicket pagetypes

Posted by Erik de Hair <er...@pocos.nl>.
Did you mean WebRequestCycleForIsis or WicketRequestCycleForIsis. The former does get hit because it shows up in the last line of the full stack trace:

16:26:17,378  [WebRequestCycleForIsis http-bio-8081-exec-1 WARN ]  Unable to obtain exceptionRecognizers (no session), will be treated as unrecognized exception

I can't get WicketRequestCycleForIsis be resolved/found.

The page's URI is /portal/wicket/UserAccountConfirmationPage/ (mount in IsisWicketApplication)

Erik

On 05/13/2014 04:10 PM, Dan Haywood wrote:

Does WicketRequestCycleForIsis get hit when you access the page?  It'll
depend on what URL it's mapped to, I think.

Cheers
Dan



On 13 May 2014 13:41, Erik de Hair <er...@pocos.nl> wrote:



What I did until so far:

- Extended PageType enum with my new pagetype
- Extended PageClassListDefault with my new pageclasstype and getter for
the pageclass and registered this list in the application configuration:
bind(PageClassList.class).to(PortalPageClassList.class);
- Created a pageclass 'WicketActivateUserAccountPage' extending
PageAbstract

The result is a stacktrace ;-)

java.lang.IllegalStateException: No Session opened for this thread
    at
org.apache.isis.core.runtime.system.context.IsisContext.getSession(IsisContext.java:421)
    at
org.apache.isis.core.runtime.system.context.IsisContext.getPersistenceSession(IsisContext.java:449)
    at
org.apache.isis.viewer.wicket.model.models.ModelAbstract.getServiceAdapters(ModelAbstract.java:55)
    at
org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:37)
    at
org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:30)
    at
org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:121)
    at
org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.buildMenu(AppActionsCssMenuFactory.java:101)
    at
org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.createComponent(AppActionsCssMenuFactory.java:96)
    at
org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract.createComponent(ComponentFactoryAbstract.java:98)
    at
org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.createComponent(ComponentFactoryRegistryDefault.java:122)
    at
org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.addOrReplaceComponent(ComponentFactoryRegistryDefault.java:107)
    at
org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addComponent(PageAbstract.java:361)
    at
org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addApplicationActions(PageAbstract.java:337)
    at
org.apache.isis.viewer.wicket.ui.pages.PageAbstract.<init>(PageAbstract.java:178)
    at
webapp.wicket.ui.pages.users.activate.WicketActivateUserAccountPage.<init>(WicketActivateUserAccountPage.java:82)

The last line references my PageClass.

Where to manage the session injection?

Erik


On 05/13/2014 08:10 AM, Dan Haywood wrote:

On 12 May 2014 16:32, Erik de Hair <er...@pocos.nl>
wrote:



Hi,

Is it possible to add pagetypes (that bypass security and have access to
the Isis context) or is there some reason why the number of page types is
limited right now?




As you've probably figured out, its currently fixed to those in the
PageType enum.

Why? Only that there's been no need to make this extensible before now.
 The different page types form a close loop; we only ever have to render
those different sorts.







I tried to extend the PageClassRegistry and PageType enum. This kind of
works only without access to the Isis context.




I'm looking at the code at it would seem that I don't correctly use the
PageType or PageClassRegistry mechanism everywhere.  For example, the
ActionResultResponseType class simply new's up the next page to traverse
to.

Ignoring that inconsistency for a minute, I do think that it might me that
if you subclass from PageAbstract (as the other pages all do), then you
should have all the usual menus etc.

In terms of the Isis context etc, that is setup through the WicketFilter
calling WebRequestCycleForIsis's onBeginRequest and onEndRequest.  This is
configured as a callback by IsisWicketApplication when first started.





I need some pages for users self service (forgotten passwords etc.).




If you manage to get something working, this would be a nice contribution
:-)

Cheers
Dan





Thanks,
Erik















Re: new Wicket pagetypes

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Does WicketRequestCycleForIsis get hit when you access the page?  It'll
depend on what URL it's mapped to, I think.

Cheers
Dan



On 13 May 2014 13:41, Erik de Hair <er...@pocos.nl> wrote:

> What I did until so far:
>
> - Extended PageType enum with my new pagetype
> - Extended PageClassListDefault with my new pageclasstype and getter for
> the pageclass and registered this list in the application configuration:
> bind(PageClassList.class).to(PortalPageClassList.class);
> - Created a pageclass 'WicketActivateUserAccountPage' extending
> PageAbstract
>
> The result is a stacktrace ;-)
>
> java.lang.IllegalStateException: No Session opened for this thread
>     at
> org.apache.isis.core.runtime.system.context.IsisContext.getSession(IsisContext.java:421)
>     at
> org.apache.isis.core.runtime.system.context.IsisContext.getPersistenceSession(IsisContext.java:449)
>     at
> org.apache.isis.viewer.wicket.model.models.ModelAbstract.getServiceAdapters(ModelAbstract.java:55)
>     at
> org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:37)
>     at
> org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:30)
>     at
> org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:121)
>     at
> org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.buildMenu(AppActionsCssMenuFactory.java:101)
>     at
> org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.createComponent(AppActionsCssMenuFactory.java:96)
>     at
> org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract.createComponent(ComponentFactoryAbstract.java:98)
>     at
> org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.createComponent(ComponentFactoryRegistryDefault.java:122)
>     at
> org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.addOrReplaceComponent(ComponentFactoryRegistryDefault.java:107)
>     at
> org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addComponent(PageAbstract.java:361)
>     at
> org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addApplicationActions(PageAbstract.java:337)
>     at
> org.apache.isis.viewer.wicket.ui.pages.PageAbstract.<init>(PageAbstract.java:178)
>     at
> webapp.wicket.ui.pages.users.activate.WicketActivateUserAccountPage.<init>(WicketActivateUserAccountPage.java:82)
>
> The last line references my PageClass.
>
> Where to manage the session injection?
>
> Erik
>
>
> On 05/13/2014 08:10 AM, Dan Haywood wrote:
>
> On 12 May 2014 16:32, Erik de Hair <er...@pocos.nl>
> wrote:
>
>
>
> Hi,
>
> Is it possible to add pagetypes (that bypass security and have access to
> the Isis context) or is there some reason why the number of page types is
> limited right now?
>
>
>
>
> As you've probably figured out, its currently fixed to those in the
> PageType enum.
>
> Why? Only that there's been no need to make this extensible before now.
>  The different page types form a close loop; we only ever have to render
> those different sorts.
>
>
>
>
>
>
>
> I tried to extend the PageClassRegistry and PageType enum. This kind of
> works only without access to the Isis context.
>
>
>
>
> I'm looking at the code at it would seem that I don't correctly use the
> PageType or PageClassRegistry mechanism everywhere.  For example, the
> ActionResultResponseType class simply new's up the next page to traverse
> to.
>
> Ignoring that inconsistency for a minute, I do think that it might me that
> if you subclass from PageAbstract (as the other pages all do), then you
> should have all the usual menus etc.
>
> In terms of the Isis context etc, that is setup through the WicketFilter
> calling WebRequestCycleForIsis's onBeginRequest and onEndRequest.  This is
> configured as a callback by IsisWicketApplication when first started.
>
>
>
>
>
> I need some pages for users self service (forgotten passwords etc.).
>
>
>
>
> If you manage to get something working, this would be a nice contribution
> :-)
>
> Cheers
> Dan
>
>
>
>
>
> Thanks,
> Erik
>
>
>
>
>
>
>
>
>

Re: new Wicket pagetypes

Posted by Erik de Hair <er...@pocos.nl>.
What I did until so far:

- Extended PageType enum with my new pagetype
- Extended PageClassListDefault with my new pageclasstype and getter for the pageclass and registered this list in the application configuration: bind(PageClassList.class).to(PortalPageClassList.class);
- Created a pageclass 'WicketActivateUserAccountPage' extending PageAbstract

The result is a stacktrace ;-)

java.lang.IllegalStateException: No Session opened for this thread
    at org.apache.isis.core.runtime.system.context.IsisContext.getSession(IsisContext.java:421)
    at org.apache.isis.core.runtime.system.context.IsisContext.getPersistenceSession(IsisContext.java:449)
    at org.apache.isis.viewer.wicket.model.models.ModelAbstract.getServiceAdapters(ModelAbstract.java:55)
    at org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:37)
    at org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel.load(ApplicationActionsModel.java:30)
    at org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:121)
    at org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.buildMenu(AppActionsCssMenuFactory.java:101)
    at org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActionsCssMenuFactory.createComponent(AppActionsCssMenuFactory.java:96)
    at org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract.createComponent(ComponentFactoryAbstract.java:98)
    at org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.createComponent(ComponentFactoryRegistryDefault.java:122)
    at org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.addOrReplaceComponent(ComponentFactoryRegistryDefault.java:107)
    at org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addComponent(PageAbstract.java:361)
    at org.apache.isis.viewer.wicket.ui.pages.PageAbstract.addApplicationActions(PageAbstract.java:337)
    at org.apache.isis.viewer.wicket.ui.pages.PageAbstract.<init>(PageAbstract.java:178)
    at webapp.wicket.ui.pages.users.activate.WicketActivateUserAccountPage.<init>(WicketActivateUserAccountPage.java:82)

The last line references my PageClass.

Where to manage the session injection?

Erik


On 05/13/2014 08:10 AM, Dan Haywood wrote:

On 12 May 2014 16:32, Erik de Hair <er...@pocos.nl> wrote:



Hi,

Is it possible to add pagetypes (that bypass security and have access to
the Isis context) or is there some reason why the number of page types is
limited right now?




As you've probably figured out, its currently fixed to those in the
PageType enum.

Why? Only that there's been no need to make this extensible before now.
 The different page types form a close loop; we only ever have to render
those different sorts.







I tried to extend the PageClassRegistry and PageType enum. This kind of
works only without access to the Isis context.




I'm looking at the code at it would seem that I don't correctly use the
PageType or PageClassRegistry mechanism everywhere.  For example, the
ActionResultResponseType class simply new's up the next page to traverse
to.

Ignoring that inconsistency for a minute, I do think that it might me that
if you subclass from PageAbstract (as the other pages all do), then you
should have all the usual menus etc.

In terms of the Isis context etc, that is setup through the WicketFilter
calling WebRequestCycleForIsis's onBeginRequest and onEndRequest.  This is
configured as a callback by IsisWicketApplication when first started.





I need some pages for users self service (forgotten passwords etc.).




If you manage to get something working, this would be a nice contribution
:-)

Cheers
Dan





Thanks,
Erik









Re: new Wicket pagetypes

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 12 May 2014 16:32, Erik de Hair <er...@pocos.nl> wrote:

> Hi,
>
> Is it possible to add pagetypes (that bypass security and have access to
> the Isis context) or is there some reason why the number of page types is
> limited right now?
>

As you've probably figured out, its currently fixed to those in the
PageType enum.

Why? Only that there's been no need to make this extensible before now.
 The different page types form a close loop; we only ever have to render
those different sorts.




>
> I tried to extend the PageClassRegistry and PageType enum. This kind of
> works only without access to the Isis context.
>
>
I'm looking at the code at it would seem that I don't correctly use the
PageType or PageClassRegistry mechanism everywhere.  For example, the
ActionResultResponseType class simply new's up the next page to traverse
to.

Ignoring that inconsistency for a minute, I do think that it might me that
if you subclass from PageAbstract (as the other pages all do), then you
should have all the usual menus etc.

In terms of the Isis context etc, that is setup through the WicketFilter
calling WebRequestCycleForIsis's onBeginRequest and onEndRequest.  This is
configured as a callback by IsisWicketApplication when first started.



> I need some pages for users self service (forgotten passwords etc.).
>
>
If you manage to get something working, this would be a nice contribution
:-)

Cheers
Dan



> Thanks,
> Erik
>
>
>