Anyone have DWR3 working on multiple portlets on a single portal page?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Anyone have DWR3 working on multiple portlets on a single portal page?

gregorcok

Hello,

 

Is there anyone out there that has successfully configured their portal (WebSphere, Liferay, etc) to use DWR3 with multiple portlets on a single portal page??    We’re using WebSphere and our home page has over seven portlets.   Up until now we have been using DWR2.0.5 and extracted the served engine.js file to a common location for all portlets to share so that each portlet would not try to include its own engine.js.  Including multiple engine.js files won’t work.   That had been working to the extent that each portlet was able to make DWR calls independent of the other portlets and the calls generally succeeded in completing successfully. 

 

We’re upgrading to DWR3 and I have been struggling to get the same configuration to work.    Do I need to go back to DWR2 or is there any evidence - any example of someone else already successfully using DWR3 in multiple portlets on a single portal page?  

 

I get the feeling that DWR3 is simply not able to handle this scenario.  Both DWR3 and DWR2 work great with a single portlet, but only DWR2 works with multiple portlets.    I’ve been experimenting and struggling for over two weeks trying to upgrade to DWR3 with one roadblock after another.    Is it possible?   Is there any example of this scenario out there for me to review?   DWR3 in multiple portlets on a single portal page.  Each portlet has its own dwr.xml with its own set of interfaces.   Each portlet makes service calls using DWR to populate its content and does so without worrying about other portlets possibly making calls at the same time at startup.   Is this possible?   Is there a single example to verify that this scenario can work?

 

Will greatly appreciate any pointer to that elusive example.

Gregor Okorn,

 

Reply | Threaded
Open this post in threaded view
|

Re: Anyone have DWR3 working on multiple portlets on a single portal page?

david@butterdev.com
What happened when you set overridePath and tried to include one
engine.js from a common location?

On 2015-09-21 06:26, Okorn, Gregor C. wrote:

> Hello,
>
> Is there anyone out there that has successfully configured their
> portal (WebSphere, Liferay, etc) to use DWR3 with multiple portlets on
> a single portal page?? We're using WebSphere and our home page has
> over seven portlets. Up until now we have been using DWR2.0.5 and
> extracted the served engine.js file to a common location for all
> portlets to share so that each portlet would not try to include its
> own engine.js. Including multiple engine.js files won't work. That had
> been working to the extent that each portlet was able to make DWR
> calls independent of the other portlets and the calls generally
> succeeded in completing successfully.
>
> We're upgrading to DWR3 and I have been struggling to get the same
> configuration to work. Do I need to go back to DWR2 or is there any
> evidence - any example of someone else already successfully using DWR3
> in multiple portlets on a single portal page?
>
> I get the feeling that DWR3 is simply not able to handle this
> scenario. Both DWR3 and DWR2 work great with a single portlet, but
> only DWR2 works with multiple portlets. I've been experimenting and
> struggling for over two weeks trying to upgrade to DWR3 with one
> roadblock after another. Is it possible? Is there any example of this
> scenario out there for me to review? DWR3 in multiple portlets on a
> single portal page. Each portlet has its own dwr.xml with its own set
> of interfaces. Each portlet makes service calls using DWR to populate
> its content and does so without worrying about other portlets possibly
> making calls at the same time at startup. Is this possible? Is there a
> single example to verify that this scenario can work?
>
> Will greatly appreciate any pointer to that elusive example.
>
> Gregor Okorn,
Reply | Threaded
Open this post in threaded view
|

Re: Anyone have DWR3 working on multiple portlets on a single portal page?

Mike Wilson
Administrator
In reply to this post by gregorcok
While I don't have any portlet example to prove this point, historically portlet problems have usually revolved around JavaScript collisions. Ie, the different engine.js inclusions overwriting each other. If this is not what you are seeing then ignore the following advice.
 
DWR (2 and 3) supports to have its servlet instantiated multiple times with different configuration and dwr.xml in the same webapp. This is analogous to each portlet having its own DWR servlet.
 
DWR's js-files can then be consumed in a couple of different ways. You can use the standard <script> include but this is limited to connecting to one DWR servlet as it defines objects in the global js namespace that will collide if another engine.js is included this way.
If you instead use the AMD script mechanism (requirejs and similar) there are no global objects defined in JS so you can include any number of DWR servlets' scripts in the same page. You can read up on DWR's AMD integration here: https://directwebremoting.atlassian.net/browse/DWR-515
 
To sum up, I think the problems you are seeing is that your DWR2 workaround is not working in DWR3, but I think you should be able to get things working by using official DWR3 functionality and not using hacks or workarounds. But l could certainly be wrong :-)
 
Best regards
Mike
 
Okorn, Gregor C. wrote:

Hello,

 

Is there anyone out there that has successfully configured their portal (WebSphere, Liferay, etc) to use DWR3 with multiple portlets on a single portal page??    We’re using WebSphere and our home page has over seven portlets.   Up until now we have been using DWR2.0.5 and extracted the served engine.js file to a common location for all portlets to share so that each portlet would not try to include its own engine.js.  Including multiple engine.js files won’t work.   That had been working to the extent that each portlet was able to make DWR calls independent of the other portlets and the calls generally succeeded in completing successfully. 

 

We’re upgrading to DWR3 and I have been struggling to get the same configuration to work.    Do I need to go back to DWR2 or is there any evidence - any example of someone else already successfully using DWR3 in multiple portlets on a single portal page?  

 

I get the feeling that DWR3 is simply not able to handle this scenario.  Both DWR3 and DWR2 work great with a single portlet, but only DWR2 works with multiple portlets.    I’ve been experimenting and struggling for over two weeks trying to upgrade to DWR3 with one roadblock after another.    Is it possible?   Is there any example of this scenario out there for me to review?   DWR3 in multiple portlets on a single portal page.  Each portlet has its own dwr.xml with its own set of interfaces.   Each portlet makes service calls using DWR to populate its content and does so without worrying about other portlets possibly making calls at the same time at startup.   Is this possible?   Is there a single example to verify that this scenario can work?

 

Will greatly appreciate any pointer to that elusive example.

Gregor Okorn,

 

Reply | Threaded
Open this post in threaded view
|

Re: Anyone have DWR3 working on multiple portlets on a single portal page?

gregorcok
In reply to this post by david@butterdev.com
When I set the overridePath from the web.xml files they did not maintain their value for each portlet.  The last one loaded became the value set for all subsequent dwr calls.   The closest success I've had is using a served engine.js that I've copied to a common location, and then following your suggested link that showed how to set the classInterface._path variable to the same DwrServlet path as the one needed for the call like so:

---------------------------------------------
<script type="text/javascript"
        src='<%= renderResponse.encodeURL(renderRequest.getContextPath()
                + "/dwr/interface/EnfAcctValidAnnctFrmMgrBean.js") %>'>
</script>
...
<script>
   EnfAcctValidAnnctFrmMgrBean._path = '<%= renderResponse.encodeURL(renderRequest.getContextPath()+"/dwr")%>';
   EnfAcctValidAnnctFrmMgrBean.getNonvalidatedUserListForApproverDWR("${psb.myUserId}", function(messages){
                        ${psb.namespace}initStore(messages);
        });
...
</script>
---------------------------------------------

so far that works the best.  I'm updating every single dwr call on all the portlets and the multiple portlets that I have on the Home page are calling their respective interfaces.   So far the remaining issue is that I'm still seeing random failures of  "dwr.engine.incompleteReply" "Incomplete reply from server".  Earlier I was seeing this error when I inadvertently had two engine.js files included, but I only have the single common one being included now - so I don't know how to make sense of this error.   Any ideas on what could be causing it?
Thanks again for your help.

Regards,
Gregor Okorn,

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: Monday, September 21, 2015 11:30 AM
To: [hidden email]
Subject: [dwr-users] Re: Anyone have DWR3 working on multiple portlets on a single portal page?

What happened when you set overridePath and tried to include one engine.js from a common location?

On 2015-09-21 06:26, Okorn, Gregor C. wrote:

> Hello,
>
> Is there anyone out there that has successfully configured their
> portal (WebSphere, Liferay, etc) to use DWR3 with multiple portlets on
> a single portal page?? We're using WebSphere and our home page has
> over seven portlets. Up until now we have been using DWR2.0.5 and
> extracted the served engine.js file to a common location for all
> portlets to share so that each portlet would not try to include its
> own engine.js. Including multiple engine.js files won't work. That had
> been working to the extent that each portlet was able to make DWR
> calls independent of the other portlets and the calls generally
> succeeded in completing successfully.
>
> We're upgrading to DWR3 and I have been struggling to get the same
> configuration to work. Do I need to go back to DWR2 or is there any
> evidence - any example of someone else already successfully using DWR3
> in multiple portlets on a single portal page?
>
> I get the feeling that DWR3 is simply not able to handle this
> scenario. Both DWR3 and DWR2 work great with a single portlet, but
> only DWR2 works with multiple portlets. I've been experimenting and
> struggling for over two weeks trying to upgrade to DWR3 with one
> roadblock after another. Is it possible? Is there any example of this
> scenario out there for me to review? DWR3 in multiple portlets on a
> single portal page. Each portlet has its own dwr.xml with its own set
> of interfaces. Each portlet makes service calls using DWR to populate
> its content and does so without worrying about other portlets possibly
> making calls at the same time at startup. Is this possible? Is there a
> single example to verify that this scenario can work?
>
> Will greatly appreciate any pointer to that elusive example.
>
> Gregor Okorn,
Reply | Threaded
Open this post in threaded view
|

Re: Anyone have DWR3 working on multiple portlets on a single portal page?

gregorcok
In reply to this post by Mike Wilson

Wow - great information.  Thank you.  Your link to your AMD implementation looks promising for our project.  Our project has three separate parts, each contained in their own virtual portal, and when we recently started the third part I updated from our older Dojo pre-AMD library to the newer Dojo AMD library, and so should be able to apply the DWR AMD solution in our project’s third part.  The first two parts might still benefit from the pre-AMD Dojo module option for integrating DWR like your link describes.  I’ll investigate these new options and see if it solves our problem.  From what I read from that link so far, I would be able to have each portlet safely include its own proper engine.js along with the interfaces it needs and not have to implement the work-around of extracting out a single engine.js that is shared by multiple portlets.   That will be great if that’s true and if I can get it to work as intended.

 

Thanks!

Gregor Okorn,

 

From: Mike Wilson [mailto:[hidden email]]
Sent: Monday, September 21, 2015 11:39 AM
To: [hidden email]
Subject: [dwr-users] Re: Anyone have DWR3 working on multiple portlets on a single portal page?

 

While I don't have any portlet example to prove this point, historically portlet problems have usually revolved around JavaScript collisions. Ie, the different engine.js inclusions overwriting each other. If this is not what you are seeing then ignore the following advice.

 

DWR (2 and 3) supports to have its servlet instantiated multiple times with different configuration and dwr.xml in the same webapp. This is analogous to each portlet having its own DWR servlet.

 

DWR's js-files can then be consumed in a couple of different ways. You can use the standard <script> include but this is limited to connecting to one DWR servlet as it defines objects in the global js namespace that will collide if another engine.js is included this way.

If you instead use the AMD script mechanism (requirejs and similar) there are no global objects defined in JS so you can include any number of DWR servlets' scripts in the same page. You can read up on DWR's AMD integration here: https://directwebremoting.atlassian.net/browse/DWR-515

 

To sum up, I think the problems you are seeing is that your DWR2 workaround is not working in DWR3, but I think you should be able to get things working by using official DWR3 functionality and not using hacks or workarounds. But l could certainly be wrong :-)

 

Best regards

Mike

 

Okorn, Gregor C. wrote:

Hello,

 

Is there anyone out there that has successfully configured their portal (WebSphere, Liferay, etc) to use DWR3 with multiple portlets on a single portal page??    We’re using WebSphere and our home page has over seven portlets.   Up until now we have been using DWR2.0.5 and extracted the served engine.js file to a common location for all portlets to share so that each portlet would not try to include its own engine.js.  Including multiple engine.js files won’t work.   That had been working to the extent that each portlet was able to make DWR calls independent of the other portlets and the calls generally succeeded in completing successfully. 

 

We’re upgrading to DWR3 and I have been struggling to get the same configuration to work.    Do I need to go back to DWR2 or is there any evidence - any example of someone else already successfully using DWR3 in multiple portlets on a single portal page?  

 

I get the feeling that DWR3 is simply not able to handle this scenario.  Both DWR3 and DWR2 work great with a single portlet, but only DWR2 works with multiple portlets.    I’ve been experimenting and struggling for over two weeks trying to upgrade to DWR3 with one roadblock after another.    Is it possible?   Is there any example of this scenario out there for me to review?   DWR3 in multiple portlets on a single portal page.  Each portlet has its own dwr.xml with its own set of interfaces.   Each portlet makes service calls using DWR to populate its content and does so without worrying about other portlets possibly making calls at the same time at startup.   Is this possible?   Is there a single example to verify that this scenario can work?

 

Will greatly appreciate any pointer to that elusive example.

Gregor Okorn,

 

Reply | Threaded
Open this post in threaded view
|

Re: Anyone have DWR3 working on multiple portlets on a single portal page?

Mike Wilson
Administrator
I hear that you understood this perfectly. Key is not to pollute the global namespace and instead let the AMD module loader map these "anonymous" modules to each other through local variables (function parameters). Then each DWR instance will work in isolation in the browser and will not interfere with the others.
You still need to ensure that script paths published by the different DWR servlets map to the URL space in a managable way (maybe your portlet container rewrites paths for all local servlets?) and that the AMD loader knows about these paths.
Here's a link to discussion where another DWR user successfully set things up in Liferay:
Reading backwards from the linked post may provide useful info.
 
Best regards
Mike
 
Okorn, Gregor C. wrote:

Wow - great information.  Thank you.  Your link to your AMD implementation looks promising for our project.  Our project has three separate parts, each contained in their own virtual portal, and when we recently started the third part I updated from our older Dojo pre-AMD library to the newer Dojo AMD library, and so should be able to apply the DWR AMD solution in our project’s third part.  The first two parts might still benefit from the pre-AMD Dojo module option for integrating DWR like your link describes.  I’ll investigate these new options and see if it solves our problem.  From what I read from that link so far, I would be able to have each portlet safely include its own proper engine.js along with the interfaces it needs and not have to implement the work-around of extracting out a single engine.js that is shared by multiple portlets.   That will be great if that’s true and if I can get it to work as intended.

 

Thanks!

Gregor Okorn,

 

From: Mike Wilson [mailto:[hidden email]]
Sent: Monday, September 21, 2015 11:39 AM
To: [hidden email]
Subject: [dwr-users] Re: Anyone have DWR3 working on multiple portlets on a single portal page?

 

While I don't have any portlet example to prove this point, historically portlet problems have usually revolved around JavaScript collisions. Ie, the different engine.js inclusions overwriting each other. If this is not what you are seeing then ignore the following advice.

 

DWR (2 and 3) supports to have its servlet instantiated multiple times with different configuration and dwr.xml in the same webapp. This is analogous to each portlet having its own DWR servlet.

 

DWR's js-files can then be consumed in a couple of different ways. You can use the standard <script> include but this is limited to connecting to one DWR servlet as it defines objects in the global js namespace that will collide if another engine.js is included this way.

If you instead use the AMD script mechanism (requirejs and similar) there are no global objects defined in JS so you can include any number of DWR servlets' scripts in the same page. You can read up on DWR's AMD integration here: https://directwebremoting.atlassian.net/browse/DWR-515

 

To sum up, I think the problems you are seeing is that your DWR2 workaround is not working in DWR3, but I think you should be able to get things working by using official DWR3 functionality and not using hacks or workarounds. But l could certainly be wrong :-)

 

Best regards

Mike

 

Okorn, Gregor C. wrote:

Hello,

 

Is there anyone out there that has successfully configured their portal (WebSphere, Liferay, etc) to use DWR3 with multiple portlets on a single portal page??    We’re using WebSphere and our home page has over seven portlets.   Up until now we have been using DWR2.0.5 and extracted the served engine.js file to a common location for all portlets to share so that each portlet would not try to include its own engine.js.  Including multiple engine.js files won’t work.   That had been working to the extent that each portlet was able to make DWR calls independent of the other portlets and the calls generally succeeded in completing successfully. 

 

We’re upgrading to DWR3 and I have been struggling to get the same configuration to work.    Do I need to go back to DWR2 or is there any evidence - any example of someone else already successfully using DWR3 in multiple portlets on a single portal page?  

 

I get the feeling that DWR3 is simply not able to handle this scenario.  Both DWR3 and DWR2 work great with a single portlet, but only DWR2 works with multiple portlets.    I’ve been experimenting and struggling for over two weeks trying to upgrade to DWR3 with one roadblock after another.    Is it possible?   Is there any example of this scenario out there for me to review?   DWR3 in multiple portlets on a single portal page.  Each portlet has its own dwr.xml with its own set of interfaces.   Each portlet makes service calls using DWR to populate its content and does so without worrying about other portlets possibly making calls at the same time at startup.   Is this possible?   Is there a single example to verify that this scenario can work?

 

Will greatly appreciate any pointer to that elusive example.

Gregor Okorn,

 

Reply | Threaded
Open this post in threaded view
|

Re: Anyone have DWR3 working on multiple portlets on a single portal page?

gregorcok

I’m reading that additional link and it is useful.  Thanks.  I’ll be implementing this preferred technique in both the AMD and pre-AMD Dojo implementations we have.  Looking forward to it going smoothly and being clean.  Will report my results when it’s ready.  Thanks again.

 

Regards,

Gregor Okorn,

 

From: Mike Wilson [mailto:[hidden email]]
Sent: Monday, September 21, 2015 13:50 PM
To: [hidden email]
Subject: [dwr-users] Re: Anyone have DWR3 working on multiple portlets on a single portal page?

 

I hear that you understood this perfectly. Key is not to pollute the global namespace and instead let the AMD module loader map these "anonymous" modules to each other through local variables (function parameters). Then each DWR instance will work in isolation in the browser and will not interfere with the others.

You still need to ensure that script paths published by the different DWR servlets map to the URL space in a managable way (maybe your portlet container rewrites paths for all local servlets?) and that the AMD loader knows about these paths.

Here's a link to discussion where another DWR user successfully set things up in Liferay:

http://dwr.2114559.n2.nabble.com/About-the-delay-on-the-ScriptSession-addScript-tp6334142p6466106.html

Reading backwards from the linked post may provide useful info.

 

Best regards

Mike

 

Okorn, Gregor C. wrote:

Wow - great information.  Thank you.  Your link to your AMD implementation looks promising for our project.  Our project has three separate parts, each contained in their own virtual portal, and when we recently started the third part I updated from our older Dojo pre-AMD library to the newer Dojo AMD library, and so should be able to apply the DWR AMD solution in our project’s third part.  The first two parts might still benefit from the pre-AMD Dojo module option for integrating DWR like your link describes.  I’ll investigate these new options and see if it solves our problem.  From what I read from that link so far, I would be able to have each portlet safely include its own proper engine.js along with the interfaces it needs and not have to implement the work-around of extracting out a single engine.js that is shared by multiple portlets.   That will be great if that’s true and if I can get it to work as intended.

 

Thanks!

Gregor Okorn,

 

From: Mike Wilson [[hidden email]]
Sent: Monday, September 21, 2015 11:39 AM
To: [hidden email]
Subject: [dwr-users] Re: Anyone have DWR3 working on multiple portlets on a single portal page?

 

While I don't have any portlet example to prove this point, historically portlet problems have usually revolved around JavaScript collisions. Ie, the different engine.js inclusions overwriting each other. If this is not what you are seeing then ignore the following advice.

 

DWR (2 and 3) supports to have its servlet instantiated multiple times with different configuration and dwr.xml in the same webapp. This is analogous to each portlet having its own DWR servlet.

 

DWR's js-files can then be consumed in a couple of different ways. You can use the standard <script> include but this is limited to connecting to one DWR servlet as it defines objects in the global js namespace that will collide if another engine.js is included this way.

If you instead use the AMD script mechanism (requirejs and similar) there are no global objects defined in JS so you can include any number of DWR servlets' scripts in the same page. You can read up on DWR's AMD integration here: https://directwebremoting.atlassian.net/browse/DWR-515

 

To sum up, I think the problems you are seeing is that your DWR2 workaround is not working in DWR3, but I think you should be able to get things working by using official DWR3 functionality and not using hacks or workarounds. But l could certainly be wrong :-)

 

Best regards

Mike

 

Okorn, Gregor C. wrote:

Hello,

 

Is there anyone out there that has successfully configured their portal (WebSphere, Liferay, etc) to use DWR3 with multiple portlets on a single portal page??    We’re using WebSphere and our home page has over seven portlets.   Up until now we have been using DWR2.0.5 and extracted the served engine.js file to a common location for all portlets to share so that each portlet would not try to include its own engine.js.  Including multiple engine.js files won’t work.   That had been working to the extent that each portlet was able to make DWR calls independent of the other portlets and the calls generally succeeded in completing successfully. 

 

We’re upgrading to DWR3 and I have been struggling to get the same configuration to work.    Do I need to go back to DWR2 or is there any evidence - any example of someone else already successfully using DWR3 in multiple portlets on a single portal page?  

 

I get the feeling that DWR3 is simply not able to handle this scenario.  Both DWR3 and DWR2 work great with a single portlet, but only DWR2 works with multiple portlets.    I’ve been experimenting and struggling for over two weeks trying to upgrade to DWR3 with one roadblock after another.    Is it possible?   Is there any example of this scenario out there for me to review?   DWR3 in multiple portlets on a single portal page.  Each portlet has its own dwr.xml with its own set of interfaces.   Each portlet makes service calls using DWR to populate its content and does so without worrying about other portlets possibly making calls at the same time at startup.   Is this possible?   Is there a single example to verify that this scenario can work?

 

Will greatly appreciate any pointer to that elusive example.

Gregor Okorn,

 

Reply | Threaded
Open this post in threaded view
|

Re: Anyone have DWR3 working on multiple portlets on a single portal page?

gregorcok

I started out using this new technique in our Dojo AMD portal where we don’t have multiple portlets on a single page (yet) just to make sure I have the syntax of setting it up correctly before I try it in our pre-AMD multi-portlet-per-page portal, and after a few corrections with my dojoConfig and require declaration, it appears to be working.  I’m now using AMD to include the engine.js and my interface.  Thanks. 

 

I’ve seen it succeed with a couple dwr calls, but on one it throws the “Incomplete reply from server”.  Previously with DWR2 it would sometimes throw the “No data received from server” error, but now it’s saying that the reply is incomplete?   I’ve added a breakpoint to my java side interface and no exception is thrown from there.  I see that the javascript error is happening during the middle of the server side call from my java interface.  I see also that the engine.js explains that the “Incomplete reply from server” is thrown when it doesn’t receive all the responses that were sent during a batch call - but I don’t set up a batch for this dwr call.   I’ve downloaded the DWR3 source code so I can try to debug what is causing this.  Where in the source code should I place a breakpoint for this “Incomplete reply from server” javascript response?

 

Thanks for your help.

 

Gregor Okorn,

 

From: Okorn, Gregor C. [mailto:[hidden email]]
Sent: Monday, September 21, 2015 14:11 PM
To: [hidden email]
Subject: [dwr-users] Re: Anyone have DWR3 working on multiple portlets on a single portal page?

 

I’m reading that additional link and it is useful.  Thanks.  I’ll be implementing this preferred technique in both the AMD and pre-AMD Dojo implementations we have.  Looking forward to it going smoothly and being clean.  Will report my results when it’s ready.  Thanks again.

 

Regards,

Gregor Okorn,

 

From: Mike Wilson [[hidden email]]
Sent: Monday, September 21, 2015 13:50 PM
To: [hidden email]
Subject: [dwr-users] Re: Anyone have DWR3 working on multiple portlets on a single portal page?

 

I hear that you understood this perfectly. Key is not to pollute the global namespace and instead let the AMD module loader map these "anonymous" modules to each other through local variables (function parameters). Then each DWR instance will work in isolation in the browser and will not interfere with the others.

You still need to ensure that script paths published by the different DWR servlets map to the URL space in a managable way (maybe your portlet container rewrites paths for all local servlets?) and that the AMD loader knows about these paths.

Here's a link to discussion where another DWR user successfully set things up in Liferay:

http://dwr.2114559.n2.nabble.com/About-the-delay-on-the-ScriptSession-addScript-tp6334142p6466106.html

Reading backwards from the linked post may provide useful info.

 

Best regards

Mike

 

Okorn, Gregor C. wrote:

Wow - great information.  Thank you.  Your link to your AMD implementation looks promising for our project.  Our project has three separate parts, each contained in their own virtual portal, and when we recently started the third part I updated from our older Dojo pre-AMD library to the newer Dojo AMD library, and so should be able to apply the DWR AMD solution in our project’s third part.  The first two parts might still benefit from the pre-AMD Dojo module option for integrating DWR like your link describes.  I’ll investigate these new options and see if it solves our problem.  From what I read from that link so far, I would be able to have each portlet safely include its own proper engine.js along with the interfaces it needs and not have to implement the work-around of extracting out a single engine.js that is shared by multiple portlets.   That will be great if that’s true and if I can get it to work as intended.

 

Thanks!

Gregor Okorn,

 

From: Mike Wilson [[hidden email]]
Sent: Monday, September 21, 2015 11:39 AM
To: [hidden email]
Subject: [dwr-users] Re: Anyone have DWR3 working on multiple portlets on a single portal page?

 

While I don't have any portlet example to prove this point, historically portlet problems have usually revolved around JavaScript collisions. Ie, the different engine.js inclusions overwriting each other. If this is not what you are seeing then ignore the following advice.

 

DWR (2 and 3) supports to have its servlet instantiated multiple times with different configuration and dwr.xml in the same webapp. This is analogous to each portlet having its own DWR servlet.

 

DWR's js-files can then be consumed in a couple of different ways. You can use the standard <script> include but this is limited to connecting to one DWR servlet as it defines objects in the global js namespace that will collide if another engine.js is included this way.

If you instead use the AMD script mechanism (requirejs and similar) there are no global objects defined in JS so you can include any number of DWR servlets' scripts in the same page. You can read up on DWR's AMD integration here: https://directwebremoting.atlassian.net/browse/DWR-515

 

To sum up, I think the problems you are seeing is that your DWR2 workaround is not working in DWR3, but I think you should be able to get things working by using official DWR3 functionality and not using hacks or workarounds. But l could certainly be wrong :-)

 

Best regards

Mike

 

Okorn, Gregor C. wrote:

Hello,

 

Is there anyone out there that has successfully configured their portal (WebSphere, Liferay, etc) to use DWR3 with multiple portlets on a single portal page??    We’re using WebSphere and our home page has over seven portlets.   Up until now we have been using DWR2.0.5 and extracted the served engine.js file to a common location for all portlets to share so that each portlet would not try to include its own engine.js.  Including multiple engine.js files won’t work.   That had been working to the extent that each portlet was able to make DWR calls independent of the other portlets and the calls generally succeeded in completing successfully. 

 

We’re upgrading to DWR3 and I have been struggling to get the same configuration to work.    Do I need to go back to DWR2 or is there any evidence - any example of someone else already successfully using DWR3 in multiple portlets on a single portal page?  

 

I get the feeling that DWR3 is simply not able to handle this scenario.  Both DWR3 and DWR2 work great with a single portlet, but only DWR2 works with multiple portlets.    I’ve been experimenting and struggling for over two weeks trying to upgrade to DWR3 with one roadblock after another.    Is it possible?   Is there any example of this scenario out there for me to review?   DWR3 in multiple portlets on a single portal page.  Each portlet has its own dwr.xml with its own set of interfaces.   Each portlet makes service calls using DWR to populate its content and does so without worrying about other portlets possibly making calls at the same time at startup.   Is this possible?   Is there a single example to verify that this scenario can work?

 

Will greatly appreciate any pointer to that elusive example.

Gregor Okorn,

 

Reply | Threaded
Open this post in threaded view
|

Re: Anyone have DWR3 working on multiple portlets on a single portal page?

Mike Wilson
Administrator
Technically there is always a batch as DWR creates an implicit batch for you.
There is no need to debug the Java side; most efficient way to see what is happening is to load your site in a browser with Firebug, Developer Tools or similar, open up engine.js in the script pane, search for the "Incomplete" error message and set a JS breakpoint there.
 
Best regards
Mike
 
Okorn, Gregor C. wrote:

I started out using this new technique in our Dojo AMD portal where we don’t have multiple portlets on a single page (yet) just to make sure I have the syntax of setting it up correctly before I try it in our pre-AMD multi-portlet-per-page portal, and after a few corrections with my dojoConfig and require declaration, it appears to be working.  I’m now using AMD to include the engine.js and my interface.  Thanks. 

 

I’ve seen it succeed with a couple dwr calls, but on one it throws the “Incomplete reply from server”.  Previously with DWR2 it would sometimes throw the “No data received from server” error, but now it’s saying that the reply is incomplete?   I’ve added a breakpoint to my java side interface and no exception is thrown from there.  I see that the javascript error is happening during the middle of the server side call from my java interface.  I see also that the engine.js explains that the “Incomplete reply from server” is thrown when it doesn’t receive all the responses that were sent during a batch call - but I don’t set up a batch for this dwr call.   I’ve downloaded the DWR3 source code so I can try to debug what is causing this.  Where in the source code should I place a breakpoint for this “Incomplete reply from server” javascript response?

 

Thanks for your help.

 

Gregor Okorn,

 

From: Okorn, Gregor C. [mailto:[hidden email]]
Sent: Monday, September 21, 2015 14:11 PM
To: [hidden email]
Subject: [dwr-users] Re: Anyone have DWR3 working on multiple portlets on a single portal page?

 

I’m reading that additional link and it is useful.  Thanks.  I’ll be implementing this preferred technique in both the AMD and pre-AMD Dojo implementations we have.  Looking forward to it going smoothly and being clean.  Will report my results when it’s ready.  Thanks again.

 

Regards,

Gregor Okorn,

 

From: Mike Wilson [[hidden email]]
Sent: Monday, September 21, 2015 13:50 PM
To: [hidden email]
Subject: [dwr-users] Re: Anyone have DWR3 working on multiple portlets on a single portal page?

 

I hear that you understood this perfectly. Key is not to pollute the global namespace and instead let the AMD module loader map these "anonymous" modules to each other through local variables (function parameters). Then each DWR instance will work in isolation in the browser and will not interfere with the others.

You still need to ensure that script paths published by the different DWR servlets map to the URL space in a managable way (maybe your portlet container rewrites paths for all local servlets?) and that the AMD loader knows about these paths.

Here's a link to discussion where another DWR user successfully set things up in Liferay:

http://dwr.2114559.n2.nabble.com/About-the-delay-on-the-ScriptSession-addScript-tp6334142p6466106.html

Reading backwards from the linked post may provide useful info.

 

Best regards

Mike

 

Okorn, Gregor C. wrote:

Wow - great information.  Thank you.  Your link to your AMD implementation looks promising for our project.  Our project has three separate parts, each contained in their own virtual portal, and when we recently started the third part I updated from our older Dojo pre-AMD library to the newer Dojo AMD library, and so should be able to apply the DWR AMD solution in our project’s third part.  The first two parts might still benefit from the pre-AMD Dojo module option for integrating DWR like your link describes.  I’ll investigate these new options and see if it solves our problem.  From what I read from that link so far, I would be able to have each portlet safely include its own proper engine.js along with the interfaces it needs and not have to implement the work-around of extracting out a single engine.js that is shared by multiple portlets.   That will be great if that’s true and if I can get it to work as intended.

 

Thanks!

Gregor Okorn,

 

From: Mike Wilson [[hidden email]]
Sent: Monday, September 21, 2015 11:39 AM
To: [hidden email]
Subject: [dwr-users] Re: Anyone have DWR3 working on multiple portlets on a single portal page?

 

While I don't have any portlet example to prove this point, historically portlet problems have usually revolved around JavaScript collisions. Ie, the different engine.js inclusions overwriting each other. If this is not what you are seeing then ignore the following advice.

 

DWR (2 and 3) supports to have its servlet instantiated multiple times with different configuration and dwr.xml in the same webapp. This is analogous to each portlet having its own DWR servlet.

 

DWR's js-files can then be consumed in a couple of different ways. You can use the standard <script> include but this is limited to connecting to one DWR servlet as it defines objects in the global js namespace that will collide if another engine.js is included this way.

If you instead use the AMD script mechanism (requirejs and similar) there are no global objects defined in JS so you can include any number of DWR servlets' scripts in the same page. You can read up on DWR's AMD integration here: https://directwebremoting.atlassian.net/browse/DWR-515

 

To sum up, I think the problems you are seeing is that your DWR2 workaround is not working in DWR3, but I think you should be able to get things working by using official DWR3 functionality and not using hacks or workarounds. But l could certainly be wrong :-)

 

Best regards

Mike

 

Okorn, Gregor C. wrote:

Hello,

 

Is there anyone out there that has successfully configured their portal (WebSphere, Liferay, etc) to use DWR3 with multiple portlets on a single portal page??    We’re using WebSphere and our home page has over seven portlets.   Up until now we have been using DWR2.0.5 and extracted the served engine.js file to a common location for all portlets to share so that each portlet would not try to include its own engine.js.  Including multiple engine.js files won’t work.   That had been working to the extent that each portlet was able to make DWR calls independent of the other portlets and the calls generally succeeded in completing successfully. 

 

We’re upgrading to DWR3 and I have been struggling to get the same configuration to work.    Do I need to go back to DWR2 or is there any evidence - any example of someone else already successfully using DWR3 in multiple portlets on a single portal page?  

 

I get the feeling that DWR3 is simply not able to handle this scenario.  Both DWR3 and DWR2 work great with a single portlet, but only DWR2 works with multiple portlets.    I’ve been experimenting and struggling for over two weeks trying to upgrade to DWR3 with one roadblock after another.    Is it possible?   Is there any example of this scenario out there for me to review?   DWR3 in multiple portlets on a single portal page.  Each portlet has its own dwr.xml with its own set of interfaces.   Each portlet makes service calls using DWR to populate its content and does so without worrying about other portlets possibly making calls at the same time at startup.   Is this possible?   Is there a single example to verify that this scenario can work?

 

Will greatly appreciate any pointer to that elusive example.

Gregor Okorn,

 

Reply | Threaded
Open this post in threaded view
|

Re: Anyone have DWR3 working on multiple portlets on a single portal page?

david@butterdev.com
Mike is right, and I gave you bad advice earlier.  If you put your
breakpoint in validate you can inspect the batch.map and the replies
that have been received.

On 2015-09-23 12:10, Mike Wilson wrote:

> Technically there is always a batch as DWR creates an implicit batch
> for you.
> There is no need to debug the Java side; most efficient way to see
> what is happening is to load your site in a browser with Firebug,
> Developer Tools or similar, open up engine.js in the script pane,
> search for the "Incomplete" error message and set a JS breakpoint
> there.
>
> Best regards
> Mike
>
> Okorn, Gregor C. wrote:
>
> I started out using this new technique in our Dojo AMD portal where we
> don't have multiple portlets on a single page (yet) just to make sure
> I have the syntax of setting it up correctly before I try it in our
> pre-AMD multi-portlet-per-page portal, and after a few corrections
> with my dojoConfig and require declaration, it appears to be working.
> I'm now using AMD to include the engine.js and my interface. Thanks.
>
> I've seen it succeed with a couple dwr calls, but on one it throws the
> "Incomplete reply from server". Previously with DWR2 it would
> sometimes throw the "No data received from server" error, but now it's
> saying that the reply is incomplete? I've added a breakpoint to my
> java side interface and no exception is thrown from there. I see that
> the javascript error is happening during the middle of the server side
> call from my java interface. I see also that the engine.js explains
> that the "Incomplete reply from server" is thrown when it doesn't
> receive all the responses that were sent during a batch call - but I
> don't set up a batch for this dwr call. I've downloaded the DWR3
> source code so I can try to debug what is causing this. Where in the
> source code should I place a breakpoint for this "Incomplete reply
> from server" javascript response?
>
> Thanks for your help.
>
> Gregor Okorn,
>
> FROM: Okorn, Gregor C. [mailto:[hidden email]]
> SENT: Monday, September 21, 2015 14:11 PM
> TO: [hidden email]
> SUBJECT: [dwr-users] Re: Anyone have DWR3 working on multiple portlets
> on a single portal page?
>
> I'm reading that additional link and it is useful. Thanks. I'll be
> implementing this preferred technique in both the AMD and pre-AMD Dojo
> implementations we have. Looking forward to it going smoothly and
> being clean. Will report my results when it's ready. Thanks again.
>
> Regards,
>
> Gregor Okorn,
>
> FROM: Mike Wilson [mailto:[hidden email]]
> SENT: Monday, September 21, 2015 13:50 PM
> TO: [hidden email]
> SUBJECT: [dwr-users] Re: Anyone have DWR3 working on multiple portlets
> on a single portal page?
>
> I hear that you understood this perfectly. Key is not to pollute the
> global namespace and instead let the AMD module loader map these
> "anonymous" modules to each other through local variables (function
> parameters). Then each DWR instance will work in isolation in the
> browser and will not interfere with the others.
>
> You still need to ensure that script paths published by the different
> DWR servlets map to the URL space in a managable way (maybe your
> portlet container rewrites paths for all local servlets?) and that the
> AMD loader knows about these paths.
>
> Here's a link to discussion where another DWR user successfully set
> things up in Liferay:
>
> http://dwr.2114559.n2.nabble.com/About-the-delay-on-the-ScriptSession-addScript-tp6334142p6466106.html
> [1]
>
> Reading backwards from the linked post may provide useful info.
>
> Best regards
>
> Mike
>
> Okorn, Gregor C. wrote:
>
> Wow - great information. Thank you. Your link to your AMD
> implementation looks promising for our project. Our project has three
> separate parts, each contained in their own virtual portal, and when
> we recently started the third part I updated from our older Dojo
> pre-AMD library to the newer Dojo AMD library, and so should be able
> to apply the DWR AMD solution in our project's third part. The first
> two parts might still benefit from the pre-AMD Dojo module option for
> integrating DWR like your link describes. I'll investigate these new
> options and see if it solves our problem. From what I read from that
> link so far, I would be able to have each portlet safely include its
> own proper engine.js along with the interfaces it needs and not have
> to implement the work-around of extracting out a single engine.js that
> is shared by multiple portlets. That will be great if that's true and
> if I can get it to work as intended.
>
> Thanks!
>
> Gregor Okorn,
>
> FROM: Mike Wilson [mailto:[hidden email]]
> SENT: Monday, September 21, 2015 11:39 AM
> TO: [hidden email]
> SUBJECT: [dwr-users] Re: Anyone have DWR3 working on multiple portlets
> on a single portal page?
>
> While I don't have any portlet example to prove this point,
> historically portlet problems have usually revolved around JavaScript
> collisions. Ie, the different engine.js inclusions overwriting each
> other. If this is not what you are seeing then ignore the following
> advice.
>
> DWR (2 and 3) supports to have its servlet instantiated multiple times
> with different configuration and dwr.xml in the same webapp. This is
> analogous to each portlet having its own DWR servlet.
>
> DWR's js-files can then be consumed in a couple of different ways. You
> can use the standard <script> include but this is limited to
> connecting to one DWR servlet as it defines objects in the global js
> namespace that will collide if another engine.js is included this way.
>
>
> If you instead use the AMD script mechanism (requirejs and similar)
> there are no global objects defined in JS so you can include any
> number of DWR servlets' scripts in the same page. You can read up on
> DWR's AMD integration here:
> https://directwebremoting.atlassian.net/browse/DWR-515 [2]
>
> To sum up, I think the problems you are seeing is that your DWR2
> workaround is not working in DWR3, but I think you should be able to
> get things working by using official DWR3 functionality and not using
> hacks or workarounds. But l could certainly be wrong :-)
>
> Best regards
>
> Mike
>
> Okorn, Gregor C. wrote:
>
> Hello,
>
> Is there anyone out there that has successfully configured their
> portal (WebSphere, Liferay, etc) to use DWR3 with multiple portlets on
> a single portal page?? We're using WebSphere and our home page has
> over seven portlets. Up until now we have been using DWR2.0.5 and
> extracted the served engine.js file to a common location for all
> portlets to share so that each portlet would not try to include its
> own engine.js. Including multiple engine.js files won't work. That had
> been working to the extent that each portlet was able to make DWR
> calls independent of the other portlets and the calls generally
> succeeded in completing successfully.
>
> We're upgrading to DWR3 and I have been struggling to get the same
> configuration to work. Do I need to go back to DWR2 or is there any
> evidence - any example of someone else already successfully using DWR3
> in multiple portlets on a single portal page?
>
> I get the feeling that DWR3 is simply not able to handle this
> scenario. Both DWR3 and DWR2 work great with a single portlet, but
> only DWR2 works with multiple portlets. I've been experimenting and
> struggling for over two weeks trying to upgrade to DWR3 with one
> roadblock after another. Is it possible? Is there any example of this
> scenario out there for me to review? DWR3 in multiple portlets on a
> single portal page. Each portlet has its own dwr.xml with its own set
> of interfaces. Each portlet makes service calls using DWR to populate
> its content and does so without worrying about other portlets possibly
> making calls at the same time at startup. Is this possible? Is there a
> single example to verify that this scenario can work?
>
> Will greatly appreciate any pointer to that elusive example.
>
> Gregor Okorn,
>
>
>
> Links:
> ------
> [1]
> http://dwr.2114559.n2.nabble.com/About-the-delay-on-the-ScriptSession-addScript-tp6334142p6466106.html
> [2] https://directwebremoting.atlassian.net/browse/DWR-515