Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.tectonica.gae;
PhaseListener to ensure the HttpSession data is written to the datastore.

To use, add the following to your faces-config.xml:

If properly configured, an application deployed on GAE platform can leverage HttpSessions to store data between requests. Session data is stored in the datastore and memcache is also used for speed. Session data is persisted at the end of the request.

The App Engine session implementation will not recognize if properties of objects stored in the session are changed which is why we have this PhaseListener which will modify a session attribute with the current date and time (in milliseconds) at the end of every phase.

See also:
public class GaePhaseListener implements PhaseListener
	private static final long serialVersionUID = 1L;
	public void afterPhase(PhaseEvent event)
		FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("CURRENT_TIME", System.currentTimeMillis());
	public void beforePhase(PhaseEvent event)
	public PhaseId getPhaseId()
New to GrepCode? Check out our FAQ X