I wonder why this is so a big problem. On bookmarkable Webpages (e.g.
Productpages) the user dont need to login and the session can destroyed
via timeout. Each Ajax-Request throw would throw a PageExpiredException.
This is the worst thing in wicket, IMHO.
My tryout was the following in a quickstart-project:
I modified the Homepage:
public class HomePage extends WebPage {
private static final long serialVersionUID = 1L;
// TODO Add any page properties or variables here
private int i = 0;
/**
* Constructor that is invoked when page is invoked without a session.
*
* @param parameters
* Page parameters
*/
public HomePage(final PageParameters parameters) {
// Add the simplest type of label
final Label label = new Label("message", "If you see this message
wicket is properly configured and running" + i);
label.setOutputMarkupId(true);
add(label);
setStatelessHint(true);
setVersioned(false);
AjaxEventBehavior ajaxEventBehavior = new AjaxEventBehavior("onclick") {
@Override
protected CharSequence getCallbackScript() {
return super.getCallbackScript() + ";return false;";
}
@Override
protected void onEvent(AjaxRequestTarget target) {
i++;
target.addComponent(label);
}
};
BookmarkablePageLink<Void> link = new
BookmarkablePageLink<Void>("link", this.getPageClass());
link.add(ajaxEventBehavior);
add(link);
}
@Override
public boolean isBookmarkable() {
return true;
}
@Override
public boolean isVersioned() {
return false;
}
@Override
public boolean isPageStateless() {
return true;
}
and overide the resolveRenderedPage() -Method of
WebRequestCycleProcessor to handle the case, if the page is null. I just
create a Page and call beforeRender on it. So the hierachie was build.
The Ajax-request found a component and it work ! The State is coded in
URL at bookmarkable pages, so who cares about lost state, just create a
new one. This could also work for stateless pages, for which i overide
isPageStateless. The component-hierachie must not be scaned and you can
use ajax.
Alternative: Maybe you can create a new RequestCycle to handle ajaxcalls
without creating the hole hierarchie. Just create the panel with the
state coded in the URL?
What are the reasons for not doing it ?
After login you can use the intercepting mechanism. But is the best why
to intercept multiple times and return to the originals step by step
(like stack-beheaviour) ?
Martin
Christopher L Merrill schrieb:
> I've changed out PageExpiredErrorPage to be the login page for our app.
> Does wicket have any support built-in to help return the user to where
> they were after re-authenticating?
>
> From my modest understanding of Wicket, it would need to be a
> bookmarkable
> page, which will be ok for a good percentage of the pages in our system.
>
> Any suggestions?
> TIA!
> Chris
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]