Hi!

This is my very first post here, so I'm going to introduce my self briefly. My name is Pablo Cabezas, and I work in San sebastián (Spain). This list is very helpful and the atmosphere very pleasant. I hope to be of some aid (if not  by now, at least in the future near ;-) ).

I have to develop a web application using Wicket and Osgi, so my first battle is against the famous "signin" example.

I have simply created two web pages (modifying the example and pasting the classes in my own project). These classes are WebPageLogin and WebPageMain. The first class extends from a WebPage (typical from Wicket), while the second one extends from an AuthenticatedWebPage (as in the signin example figures).

The problem is in this piece of code, located at the WebApplication class:

protected void init()
    {
        getSecuritySettings().setAuthorizationStrategy(new IAuthorizationStrategy()
        {
            public boolean isActionAuthorized(Component component, Action action)
            {
                return true;
            }
 
            public boolean isInstantiationAuthorized(Class componentClass)
            {
                if (AuthenticatedWebPage.class.isAssignableFrom(componentClass))
                {
                    // Is user signed in?
                    if (((SignInSession)Session.get()).isSignedIn())
                    {
                        // okay to proceed
                        return true;
                    }
 
                    // Force sign in
                    throw new RestartResponseAtInterceptPageException(WebPageLogin.class);
                }
                return true;
            }
        });
    }


and exactly in the    "if (((SignInSession)Session.get()).isSignedIn())" line. If I comment this line the browser shows the WebPageMain without any problem. The error that appears with this condition is:


UnexpectedRuntimeException	
     ...

WicketMessage: Can't instantiate page using constructor public es.ceit.wicket.iFusionWebApp.view.pages.WebPageMain(wicket.PageParameters) and argument

Root cause:

java.lang.ClassCastException : wicket.protocol.http.WebSession
at es.ceit.wicket.iFusionWebApp.view.FusionApplication$1.isInstantiationAuthorized(FusionApplication.java:71)
at wicket.Application$1.onInstantiation(Application.java:243)
at wicket.Application.notifyComponentInstantiationListeners(Application.java:775)
at wicket.Component.<init>(Component.java:577)
at wicket.MarkupContainer.<init>(MarkupContainer.java:123)
at wicket.Page.<init>(Page.java:208)

...



The code is practically a copy-paste from the example, so I feel I'm missing something... Anybody could tell me something to go around?


Thank you very much!
Pablo Cabezas
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to