You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kshitiz <k....@gmail.com> on 2012/06/09 11:40:39 UTC

Back button is troubling session management...

Hi,

After I log in that application, I am not suppose to see login page of the
app when I press back button. Though I am not able to go to login url as I
am checking user session in login page and redirects him to home page if the
session is present. But, when back button is pressed, that logic is skipped
and login pageis displayed. How to handle this issue? How can I reload login
page after pressing back button?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Back-button-is-troubling-session-management-tp4649793.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Back button is troubling session management...

Posted by Martin Grigorov <mg...@apache.org>.
On Sat, Jun 9, 2012 at 7:53 PM, kshitiz <k....@gmail.com> wrote:
> I used the same logic in onBeforeRender and it is working...

Right!
Page constructor is executed only once.
Page#onConfigure/onBeforeRender() are executed for every rendering of
the page.

>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Re-Back-button-is-troubling-session-management-tp4649801p4649805.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Back button is troubling session management...

Posted by kshitiz <k....@gmail.com>.
I used the same logic in onBeforeRender and it is working...

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Re-Back-button-is-troubling-session-management-tp4649801p4649805.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Back button is troubling session management...

Posted by kshitiz <k....@gmail.com>.
Hi, 

My code to check user session is:


		if (UserSession.get().checkUserSession()) {
				// redirecting user to home page
				setResponsePage(Home.class, new PageParameters());
}

*	UserSession is*

public class UserSession extends WebSession {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public UserSession(Request request) {
		super(request);
		// TODO Auto-generated constructor stub
	}

	private Object myObject;
	
	// if you use java >= 1.5 you can make use of covariant return types
	public static UserSession get() {
		return (UserSession)Session.get();
	}

	
	public boolean checkUserSession()
	{
		if(myObject==null) return false;
		else return true;
	}
	
	public void logout()
	{
	    get().invalidate();
		myObject = null;
	}


	public Object getMyObject() {
		return myObject;
	}


	public void setMyObject(Object myObject) {
		this.myObject = myObject;
	}
	
	
	
	

}


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Re-Back-button-is-troubling-session-management-tp4649801p4649804.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Back button is troubling session management...

Posted by Andrea Del Bene <an...@gmail.com>.
Hi,

where did you pu the logic to check if user has already signed in 
(onInitialize, onBeforeRender, etc...)? Could you show your code?
> Hi,
>
> After I log in that application, I am not suppose to see login page of the
> app when I press back button. Though I am not able to go to login url as I
> am checking user session in login page and redirects him to home page if the
> session is present. But, when back button is pressed, that logic is skipped
> and login pageis displayed. How to handle this issue? How can I reload login
> page after pressing back button?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Back-button-is-troubling-session-management-tp4649793.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org