Icefaces SessionRenderer in Seam 2.2.0
[Logo]
ICEsoft.org Forums: ICEfaces, ICEmobile, ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icesoft.org  [Login] Login 
Icefaces SessionRenderer in Seam 2.2.0  XML
Forum Index -> JBoss Seam Integration Go to Page: 1, 2 Next 
Author Message
averas

Joined: 17/04/2008 00:00:00
Messages: 11
Offline



Has anyone been successful in using the new Icefaces SessionRenderer API for AJAX Push in Seam?

Is says in the Seam Icefaces guide that it should be working (not only using the old RenderManager) but whatever I do I get no pushed updates in the web client..

-ra
bnsbr

Joined: 19/10/2009 00:00:00
Messages: 9
Offline


Hi averas, what kind of errors are you getting? What is the runtime environment (server)?

I tried it a while ago with ICEFaces 1.8.2 and Seam 2.2.0 on tomcat 6.0.20 and it worked.

Right now, I'm having problems with ajax push with IE8, with firefox 3.5.5 everything works fine, but with IE it has a strange behavior, the first update (ajax-push) works, but the following ones didn't.

I found in the ICEFaces Jira that last year they have developed a version of auctionMonitor with seam (http://jira.icefaces.org/browse/ICE-1676), but I can't find it.

Can anyone of ICEFaces tell us if that sample is still available and where to find if?

Between, have anyone seen problems with ajax-push (Using RenderManager API) and IE8?

Thanks,
Bruno.
averas

Joined: 17/04/2008 00:00:00
Messages: 11
Offline


bnsbr wrote:
Hi averas, what kind of errors are you getting? What is the runtime environment (server)?

I tried it a while ago with ICEFaces 1.8.2 and Seam 2.2.0 on tomcat 6.0.20 and it worked.

Right now, I'm having problems with ajax push with IE8, with firefox 3.5.5 everything works fine, but with IE it has a strange behavior, the first update (ajax-push) works, but the following ones didn't.

I found in the ICEFaces Jira that last year they have developed a version of auctionMonitor with seam (http://jira.icefaces.org/browse/ICE-1676), but I can't find it.

Can anyone of ICEFaces tell us if that sample is still available and where to find if?

Between, have anyone seen problems with ajax-push (Using RenderManager API) and IE8?

Thanks,
Bruno. 


Well.. to be honest.. I'm not 100% sure I've understood the expected behavior. Let me take an example:

If I have a simple page such as:
Code:
<h:outputText value="#{bean.value} />
 <ice:form>
    <ice:commandButton action="#{bean.longSubmit()}" value="Long submit" />
 </ice:form>


And a simple Seam bean such as:

Code:
@Name("bean") @Scope(ScopeType.SESSION)
 public class Bean implements Serializable {
 
 private String value = "";
 
 public void longSubmit() {
 
    SessionRenderer.addCurrentSession("test");
    
    <-- A unit of time consuming work that sets value -->
 
    SessionRenderer.render("test");
 
    <-- Another unit of time consuming work that sets value -->
 
    SessionRenderer.render("test");
 
 }
 
 public String getValue() {
     return value;
 }
 
 }



Would it be true that the outputText on the page would be updated during thread-execution (and not after). The only way I achieved this was by setting the bean to Scope.APPLICATION and have the submit-method being @Asynchronous.. but as you probably understand I can't have that in the application... Is this expected behavior?

-ra
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1202
Offline


The latest example of SessionRenderer with Seam would be the open18ice example. It is hosted on google code (Dan Allen Seam In Action) and reference is made to it in Dan's excellent book about Seam.
http://code.google.com/p/seaminaction/source/browse/trunk/#trunk/prototype/projects/open18ice%3Fstate%3Dclosed

It's a pretty simple api, and I would probably not add the bean in application scope though. If you are using Seam to take advantage of their conversation scope/lazy loading of data, then you would probably be creating (and adding beans to the SessionRenderer groups) from a conversation scope. Where you want to trigger the actual rendering could be anywhere, but it's pretty simple.

For every release of ICEfaces, this api is tested with all IE, FF and Safari (sometimes Chrome as well). As a suggestion, you might clear the browser cache if one browser if giving you difficulty.

averas

Joined: 17/04/2008 00:00:00
Messages: 11
Offline


judy.guglielmin wrote:
The latest example of SessionRenderer with Seam would be the open18ice example. It is hosted on google code (Dan Allen Seam In Action) and reference is made to it in Dan's excellent book about Seam.
http://code.google.com/p/seaminaction/source/browse/trunk/#trunk/prototype/projects/open18ice%3Fstate%3Dclosed

It's a pretty simple api, and I would probably not add the bean in application scope though. If you are using Seam to take advantage of their conversation scope/lazy loading of data, then you would probably be creating (and adding beans to the SessionRenderer groups) from a conversation scope. Where you want to trigger the actual rendering could be anywhere, but it's pretty simple.

For every release of ICEfaces, this api is tested with all IE, FF and Safari (sometimes Chrome as well). As a suggestion, you might clear the browser cache if one browser if giving you difficulty.

 


Thanks Judy! I'll check those examples out.

The Bean above was just an example. In the application we're not using session-scoped beans, but conversations as you pointed out.

However, can you please acknowledge the expected behavior on the example I gave? Will SessionRenderer.render() flush changes to the browser during a method call? I.e. before the thread-execution is complete.

-ra
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1202
Offline


What SessionRenderer does is actually to spin off a new thread (async) of the jsf lifecycle. The RenderHub is responsible for maintaining the queue of "push" threads. If a view (bean that has already been added to the render group) is already in the RenderHub, then it isn't added again.
Hopefully this answers your question.
averas

Joined: 17/04/2008 00:00:00
Messages: 11
Offline


judy.guglielmin wrote:
What SessionRenderer does is actually to spin off a new thread (async) of the jsf lifecycle. The RenderHub is responsible for maintaining the queue of "push" threads. If a view (bean that has already been added to the render group) is already in the RenderHub, then it isn't added again.
Hopefully this answers your question. 


I guess so..

If I understand you correctly I can't use SessionRenderer.render() to trigger pushes to pages that are already waiting for a method call to finish.. (since the view is already in the RenderHub).

How does the progress bar work? I'd guess that's a similar setup.. a long method call with continuos feedback to the page..

That's essentially what I want.

-ra
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1202
Offline


No...actually what I am saying is that SessionRender.addCurrentSession will take care of the business for you. If the view is already in the queue/RenderHub, then the framework will take care that it isn't added again (unnecessarily). You can trigger pushes for the same view as often as you want without worrying about efficiency.

As for progressMonitor, there are examples in component-showcase of a determinate as well as indeterminate thread and the component itself assists in "pushing" the updated value to the view.
averas

Joined: 17/04/2008 00:00:00
Messages: 11
Offline


judy.guglielmin wrote:
No...actually what I am saying is that SessionRender.addCurrentSession will take care of the business for you. If the view is already in the queue/RenderHub, then the framework will take care that it isn't added again (unnecessarily). You can trigger pushes for the same view as often as you want without worrying about efficiency.

As for progressMonitor, there are examples in component-showcase of a determinate as well as indeterminate thread and the component itself assists in "pushing" the updated value to the view. 


Okay.. then I don't understand why my example above doesn't work.

If I invoke the action, i.e. submits, (bean.longSubmit()) in that example I expect the outputText to be updated continuously by my bean as bean.value is set to different values as my method executes.. but it doesn't.

I get no update until the complete method-call has been completed whereas the outputText gets the value of whatever it is when the method call was finished.

Thanks a lot for your clarifications btw.

-ra
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1202
Offline


Could it be due to the fact that your example is a bean in application scope (so when does it change? Are you always calling an application-scoped bean? With Seam, the application-scoped beans are not synchronized, so not sure if this affects it either. Perhaps you might want to check out the open18ice example?
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1202
Offline


You do have the following set in your web.xml, correct?
Code:
   
  <context-param>
         <param-name>com.icesoft.faces.synchronousUpdate</param-name>
         <param-value>false</param-value>
     </context-param>
 
averas

Joined: 17/04/2008 00:00:00
Messages: 11
Offline


judy.guglielmin wrote:
Could it be due to the fact that your example is a bean in application scope (so when does it change? Are you always calling an application-scoped bean? With Seam, the application-scoped beans are not synchronized, so not sure if this affects it either. Perhaps you might want to check out the open18ice example? 


I've tried with different scopes.. and actually, the only way I really got it to work was by setting the bean to SceopType.Application and set the method to @Asynchronous..

Using Session, Page or Converstation Scope doesn't work..

The difference I've seen with other apps using the SessionRenderer, including the one you pointed out (if I didn't misunderstand it) is that SessionRenderer.render()-calls are made at times when there are no specific invocations from the page, rather than during a method-invocation (i.e. a submit of some kind..). Since it DOES work when I set the method to @Asynchronous I sort of figure this is related.. however, I don't want the method to be @Asynchronous, and I definitely don't want the bean to have application scope.

-ra
averas

Joined: 17/04/2008 00:00:00
Messages: 11
Offline


judy.guglielmin wrote:
You do have the following set in your web.xml, correct?
Code:
   
  <context-param>
         <param-name>com.icesoft.faces.synchronousUpdate</param-name>
         <param-value>false</param-value>
     </context-param>
 
 


Yes, of course. :)

-ra
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1202
Offline


For some reason, i thought I read your bean as application-scoped, but now see that it is session-scoped. How about using an @Create method to add your bean and then push it in your method. You might want to trace through at run-time to ensure the bean is added to the render group (specifically the render method of SessionRenderer and ensure that the OnDemandRenderer is not null and the request for render is queued).

averas

Joined: 17/04/2008 00:00:00
Messages: 11
Offline


judy.guglielmin wrote:
For some reason, i thought I read your bean as application-scoped, but now see that it is session-scoped. How about using an @Create method to add your bean and then push it in your method. You might want to trace through at run-time to ensure the bean is added to the render group (specifically the render method of SessionRenderer and ensure that the OnDemandRenderer is not null and the request for render is queued).

 


I ran this through the debugger and it seems to be doing the right thing at the right time.. but no result in the browser..

Any chance you could test this on your end?

-ra
 
Forum Index -> JBoss Seam Integration Go to Page: 1, 2 Next 
Go to:   
Powered by JForum 2.1.7ice © JForum Team