[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3273) @Startup + @Create on session-scoped bean broken in Seam 2.1

Przemyslaw Jaskierski (JIRA) jira-events at lists.jboss.org
Thu Aug 28 03:37:38 EDT 2008

    [ https://jira.jboss.org/jira/browse/JBSEAM-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12427054#action_12427054 ] 

Przemyslaw Jaskierski commented on JBSEAM-3273:


1. The example bean above definitely works in Seam 1.2 - 2.0.3.RCx and builds of Seam 2.1 from +-march. I'm running this code for 1.5+ years. NOTE: this bean is effectively created after accessing any *.xhtml page for the first time (javax.faces.webapp.FacesServlet mapped to *.xhtml, org.jboss.seam.servlet.SeamFilter mapped to /*)

2. Even if it wasn't working this would be a must-to-have feature, because there is no (well I'm not aware of) any other nice way to have this stuff together available in one place:

a. Executed _exactly_once_ at http session creation
b. access to cookies, request parameters etc.
c. Session and other contexts available for setting up beans for every user activity from now on.
d. managed hibernate session available

3. Adding custom session listener here would be IMHO crude because of 2c and 2d.

Having this functionality is IMHO essential for any Seam-driven app, which need's to have per-user customization working right from the first request. I can think of other utilization of this, ex. referrer-based customization (hey, we have (had) a whole Http header info here.)

> @Startup + @Create on session-scoped bean broken in Seam 2.1
> ------------------------------------------------------------
>                 Key: JBSEAM-3273
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3273
>             Project: Seam
>          Issue Type: Bug
>         Environment: clean Tomcat 6.0.16, Seam 2.1 build 281
>            Reporter: Przemyslaw Jaskierski
>            Assignee: Shane Bryzak
>            Priority: Critical
>             Fix For: 2.1.0.BETA2
> In 1.x, 2.x and Seam 2.1 build from ~march 2008 it was possible to access, for example, cookies info or other http request attributes at session creation time. It was extremely useful to fetch f.e. user-specific data from database to create custom view etc, (described f.e. here http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963032). It is not working anymore. Both FacesContext.getCurrentInstance() and ServletContexts.getInstance().getRequest() now return null within @Create method.
> @Name("sessionStateBacker")
> @Scope(ScopeType.SESSION)
> @Startup
> public class UserStateBacker
>     implements Serializable
> {
>     @Create
>     public void sessionCreated()
>     {
> 	FacesContext facesContext =  FacesContext.getCurrentInstance();
> 	if (facesContext == null) {
> 	    System.out.println("FacesContext is null in 2.1.0 but worked fine in 2.0.3");	
> 	}
>         //facesContext.getExternalContext().getRequestCookieMap();
>     }
> }

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list