-
1. Re: Custom PhaseListener timing
gavin.king Apr 26, 2006 1:56 AM (in response to rdewell)Perhaps if you have your phase listener extend the Seam phase listener?
-
2. Re: Custom PhaseListener timing
rdewell Apr 26, 2006 10:44 AM (in response to rdewell)Between the phases listened to, and the ordering of the phase listeners in the faces-config, I should be able to have them fire in whatever order I need without extending Seam's phase listener.
What is the earliest phase point (before/after) where I should be able to start accessing Seam managed components, especially a Seam managed extended persistence context?
Ryan -
3. Re: Custom PhaseListener timing
gavin.king Apr 26, 2006 1:34 PM (in response to rdewell)"rdewell" wrote:
Between the phases listened to, and the ordering of the phase listeners in the faces-config, I should be able to have them fire in whatever order I need without extending Seam's phase listener.
Well, if you say so - then why do you need my help for?
If you know how to go about freely ordering phaselisteners (according to the JSF spec), Just Do It. -
4. Re: Custom PhaseListener timing
rdewell Apr 26, 2006 2:23 PM (in response to rdewell)I need to be able to use Seam components during createView of a ViewHandler (at least). This was working in beta 1, and we need to be to get back to that ability to upgrade.
The problem with using Seam components then is that there is no conversation until you get to afterPhase RESTORE_VIEW leading to "conversation context not active" if you try to access them in createView.
So I've hacked around this by trying to startup conversations in beforePhase RESTORE_VIEW:
- Extending SeamExtendedManagedPersistencePhaseListener
- Then:public void beforePhase(PhaseEvent arg0) { super.beforePhase(arg0); if (arg0.getPhaseId().equals(PhaseId.RESTORE_VIEW)){ ExternalContext ec = arg0.getFacesContext().getExternalContext(); Manager.instance().restoreConversation( ec.getRequestParameterMap() ); Lifecycle.resumeConversation(ec); Manager.instance().handleConversationPropagation(ec.getRequestParameterMap() ); } }
That gets things a little further along... however now I appear to be running into http://jira.jboss.com/jira/browse/EJBTHREE-540:11:02:43,668 ERROR [STDERR] org.hibernate.TransactionException: could not register synchronization with JTA TransactionManager at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:174) at org.hibernate.impl.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:1824)
So I have no idea (yet) if setting up the conversation in beforePhase RESTORE_VIEW is actually a workaround to using Seam components at that time.
What I'm ultimately looking for is a valid way to start using Seam components, conversation scoped at least, when createView of a ViewHandler is called. -
5. Re: Custom PhaseListener timing
rdewell Apr 27, 2006 12:30 PM (in response to rdewell)We built our application using Seam (beta 1) as an integral part. To that end, Seam participates fully in translating URLs into view selection / creation during GET requests.
For example, translating the URL:
/articles/db-driven-title.html
To perform this URL to view translation / setup, we access Seam components (including a managed persistence context) to determine what view to display (if any), and what to display in it.
Another example:
/action/do-something/
where "do-something" gets translated into a method call on a Seam component. This method call's outcome is then used to drive the view displayed for the GET request using regular NavigationHandler semantics.
There are really two points to perform this view selection in JSF. PhaseListeners as mentioned previously, OR more appropriate to the specification, a ViewHandler (createView).
Either way, the latest version of Seam does not appear to be "ready" to participate in translating custom URLs into views. For example, the conversation context is not setup until after createView is called.
In my previous post I hacked around SeamExtendedManagedPersistencePhaseListener to get it to startup a conversation before createView is called. But, this lead to other problems.
Should it be reasonable to consider that Seam components can participate in view selection / setup (createView)? We have some big decisions to make if not, because a great deal of our code is built around the Seam beta 1 notion of having components available earlier.
Ryan -
6. Re: Custom PhaseListener timing
gavin.king Apr 27, 2006 12:40 PM (in response to rdewell)Isn't it best to use page actions for this?
-
7. Re: Custom PhaseListener timing
rdewell Apr 27, 2006 2:06 PM (in response to rdewell)Hmm... I didn't realize the scope of the page actions framework. Maybe something like view-id="*" might work. Let me play around with that.
Ryan