Thanks...that was really an easy one :)
But while playing around with this topic I do have a few other questions:
Within the wicket signin example I have to provide a method called
newSession( Request request, Response response ) within my
TestApplication.java file. So if I call /test/* and this URL is mapped with
TestApplication.java I would assume the first time I get a new session.
Afterwards I don't, right?
So to access the test page you have to be logged in. You can achieve this by
clicking on the link and log in and you will get forwarded to the page.
Fine. But the second opportunity I want to provide is via a seperate login
page. So that the user can log in before he access the test page. After
logged in via the login page and calling the test page you shouldn't get a
redirect to the login page again.
And now I get some problems. Within the onSubmit() method of my Login.java
file there is the following code
---------------------------
public final void onSubmit() {
SignInSession session = (SignInSession) getSession();
if ( !session.isSignedIn() ){
ValueMap values = getModelObject();
if ( session.authenticate( (String) values.get( "Username" ),
(String)
values.get( "Password" ) ) ) {
if ( !continueToOriginalDestination() ) {
setResponsePage( getApplication().getHomePage()
);
}
}
else {
info( "error" );
}
}
else{
setResponsePage( getApplication().getHomePage() );
}
}
---------------------------
But within my LoginApplication.java file I don't have a method newSession(
Request request, Response response ). Because I don't want to create for
every xxxApplication.java file a new Session. I want to share one sessions
for all xxxApplication.java files. So if I access the login page directly
and submit the form I get an exception because I cannot cast to
SignInSession because I only have (per default) a WebSession.
I could create a new SignInSession but the constructor of this class need a
Request object which I don't have within my onSubmit method. And even if I
would have the Request object how can I ensure that my new createt
SignInSession object get's shared by all other classes. I would expect even
if I create such a new session object and would call TestApplication.java a
new SignInSession object get's created, isn't it?
Hopefully I get the problem across to you?! Otherwise just let me know and I
try to explain it in a better way...
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/dynamic-navigation-side-content-depending-on-login-status-tp3384641p3384920.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]