Actually i just realized it has something to do with a stateless form. Maybe
you can tell me if this is a bug or not. I am pasting the code below, but
let me first explain. I basically have a LoginPanel that is included on all
non-bookmarkable and bookmarkable pages. My LoginPanel is using a
StatelessForm. I want this stateless form because generating a Session for
every request for simple login form is a crazy idea to me (especially in a
clustered session environment).
The problem is that it seems you cannot set objects in the session from
within the Stateless form. Although i implemented a work around by getting
the Page from within the stateless form and setting the User object on the
session from the Page itself. When I do so this User object is not in the
session on the non-bookmarkable pages I click on.
Here are the snippets of code (LoginPanel.java and WebPageTemplate.java)
public LoginPanel(String id)
{
Form f = new StatelessForm("lFrm")
{
@Override
protected void onSubmit()
{
try
{
User u = AuthenticationService.login(getUserName(), getPassword());
if (u == null)
{
feedback.error("Invalid login");
return;
}
feedback.info("You are now logged in. Welcome.");
((WebPageTemplate) getPage()).setUserInSession(u);
setResponsePage(getPage().getClass());
}
catch (AuthenticationException ae)
{
error("There was a problem logging in. Please try again later");
se.printStackTrace();
}
}
};
WebPageTemplate.java snippet:
public void setUserInSession(User u)
{
MediumSession session = (MediumSession) getSession();
session.setUser(u);
}
Matej Knopp-2 wrote:
>
> We can't help you with this if you don't post any code. The session
> object should of course be available for bookmarkable and
> non-bookmarkable objects.
>
> -Matej
>
> On 9/7/07, Chris Lintz <[EMAIL PROTECTED]> wrote:
>>
>> Hi all,
>> This seems like a bug to me but I am hoping some one can lead me the
>> right
>> way to a solution. I basically have non-bookmarkable page that puts the
>> a
>> User object in the session. After this, if i click on a bookmarkable
>> page
>> link, that page does not have the user in the session. If I go back to
>> my
>> non-bookmarkable page, the user is there.
>>
>> How can i get this bookmarkable page to see the same session object?
>> Maybe this has something to do with Pagemaps. But in any case, the same
>> session object should be available to bookmarkable and non-bookmarkable
>> pages correct?
>>
>>
>> thanks in advance
>> --
>> View this message in context:
>> http://www.nabble.com/Bookmarkable-page-and-session-object-problem--%281.3-beta3%29-tf4403473.html#a12562289
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Bookmarkable-page-and-session-object-problem--%281.3-beta3%29-tf4403473.html#a12563267
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]