[JIRA] (COMETD-375) Improved support to load Dojo from CDN, but CometD locally

9 views
Skip to first unread message

Simone Bordet (Created) (JIRA)

unread,
May 29, 2012, 4:02:25 AM5/29/12
to comet...@googlegroups.com
Improved support to load Dojo from CDN, but CometD locally
----------------------------------------------------------

Key: COMETD-375
URL: http://bugs.cometd.org/browse/COMETD-375
Project: CometD
Issue Type: Improvement
Components: javascript-dojo
Affects Versions: 2.5.0-beta1
Reporter: Simone Bordet
Assignee: Simone Bordet
Fix For: 2.5.0


If Dojo is loaded from a CDN, then loading CometD becomes more difficult, because we need to remap the whole {{dojox}} directory locally.

We should be able to load the whole Dojo from the CDN, and only CometD from local.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: http://bugs.cometd.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


bwa (Commented) (JIRA)

unread,
May 29, 2012, 5:07:26 AM5/29/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10903#comment-10903 ]

bwa commented on COMETD-375:
----------------------------




I have updated the package ref to /dojox/cometd, and have only dojox/cometd (and org) locally. But now I miss two files ... :

"NetworkError: 404 Not Found - https://localhost:9451/MyApp/js/dojox/cometd/main.js"
"NetworkError: 404 Not Found - https://localhost:9451/MyApp/js/org/cometd.js"

I don't understand where these references come from....


Here is tiny a sample app



<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>

<script data-dojo-config="async:true, tlmSiblingOfDojo: true"
src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.js"></script>
<script>
require(
{
packages: [{
name: 'dojox/cometd',
location: '/MyApp/js/dojox/cometd'
},{
name: 'org',
location: '/MyApp/js/org'
}]
},
["dojo", "dojox/cometd", "dojox/cometd/timestamp", "dojox/cometd/ack", "dojox/cometd/reload"],
function(dojo, cometd)
{
console.log("> loaded !");
});
</script>
</head>
<body>
<div id="schedul1">Starting ..........</div>
</body>
</html>

> Improve support to load Dojo from CDN, but CometD locally
> ---------------------------------------------------------
>

Simone Bordet (Commented) (JIRA)

unread,
May 29, 2012, 7:16:25 AM5/29/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10904#comment-10904 ]

Simone Bordet commented on COMETD-375:
--------------------------------------

So, the first 404 is now fixed.

The second 404 I think it's caused by a misconfiguration on your part.
Can you actually hit https://localhost:9451/MyApp/js/org/cometd.js and download the file ?

With the current HEAD, your example should work just fine, and it is equivalent to the Dojo reload example.
Follow instructions here: http://cometd.org/documentation/building to build HEAD.

> Improve support to load Dojo from CDN, but CometD locally
> ---------------------------------------------------------
>

Simone Bordet (Resolved) (JIRA)

unread,
May 29, 2012, 7:20:25 AM5/29/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Bordet resolved COMETD-375.
----------------------------------

Resolution: Fixed

Fixed.
Now the CometD Dojo binding is present in both {{dojox/cometd.js}} and in {{dojox/cometd/main.js}}, the latter to load CometD when Dojo is loaded through CDN.

The configuration for the CDN case should be:

{code:javascript}
require({
packages: [
{name: 'dojox/cometd', location: '/myapp/dojox/cometd},
{name: 'org', location: '/myapp/org'}
]
},
['dojox/cometd'],
function(cometd)
{
...
}
);
{code}

> Improve support to load Dojo from CDN, but CometD locally
> ---------------------------------------------------------
>

bwa (Commented) (JIRA)

unread,
Jun 5, 2012, 3:15:25 AM6/5/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10907#comment-10907 ]

bwa commented on COMETD-375:
----------------------------

Now it works better, but the maven build fails:

....
[INFO] Reactor Summary:
[INFO]
[INFO] CometD :: JavaScript .............................. SUCCESS [0.480s]
[INFO] CometD :: JavaScript :: Common .................... SUCCESS [1.452s]
[INFO] CometD :: JavaScript :: Dojo ...................... SUCCESS [27.807s]
[INFO] CometD :: JavaScript :: jQuery .................... SUCCESS [0.442s]
[INFO] CometD :: JavaScript :: Common Test ............... FAILURE [0.152s]
[INFO] CometD :: JavaScript :: Examples Dojo ............. SKIPPED
[INFO] CometD :: JavaScript :: Examples JQuery ........... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.984s
[INFO] Finished at: Tue Jun 05 08:59:00 CEST 2012
[INFO] Final Memory: 27M/442M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project cometd-javascript-common-test: Could not resolve dependencies for project org.
cometd.javascript:cometd-javascript-common-test:jar:2.5.0-SNAPSHOT: Could not find artifact org.cometd.java:cometd-webso
cket-jetty:jar:2.5.0-SNAPSHOT -> [Help 1]


But for my project I only need (my guess) Common and Dojo, so I'll try to continue.

But I'm a little confused about which files to copy out to my /cometd and /dojox local application folders ?

I have copied:
cometd-javascript\dojo\target\cometd-javascript-dojo-2.5.0-SNAPSHOT\dojox\cometd to /ASAPTrigger/dojox/cometd
cometd-javascript\dojo\target\cometd-javascript-dojo-2.5.0-SNAPSHOT\dojox\cometd.js to /ASAPTrigger/dojox/cometd.js
cometd-javascript\dojo\target\cometd-javascript-dojo-2.5.0-SNAPSHOT\org\ to /ASAPTrigger/org

The application actually load, but it seems to use websockets, I need to use Bayeux protocol. How do I do that ?


> Improve support to load Dojo from CDN, but CometD locally
> ---------------------------------------------------------
>

Simone Bordet (Commented) (JIRA)

unread,
Jun 5, 2012, 3:18:25 AM6/5/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10908#comment-10908 ]

Simone Bordet commented on COMETD-375:
--------------------------------------

You should build from the root directory, not from {{/cometd-javascript}}.

> Improve support to load Dojo from CDN, but CometD locally
> ---------------------------------------------------------
>

bwa (Commented) (JIRA)

unread,
Jun 5, 2012, 3:28:25 AM6/5/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10909#comment-10909 ]

bwa commented on COMETD-375:
----------------------------

Initially I did that, but that build also failed. But a new try to build from root worked fine. So that seems to be Ok. How Do I swith to Bayeux ? Running against a WebSphere server ...

> Improve support to load Dojo from CDN, but CometD locally
> ---------------------------------------------------------
>

Simone Bordet (Commented) (JIRA)

unread,
Jun 5, 2012, 3:33:25 AM6/5/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10910#comment-10910 ]

Simone Bordet commented on COMETD-375:
--------------------------------------

Please use the mailing list. You're hijacking this bug :)

> Improve support to load Dojo from CDN, but CometD locally
> ---------------------------------------------------------
>

bwa (Commented) (JIRA)

unread,
Jun 5, 2012, 3:45:25 AM6/5/12
to comet...@googlegroups.com

[ http://bugs.cometd.org/browse/COMETD-375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10911#comment-10911 ]

bwa commented on COMETD-375:
----------------------------

Shure, admit it's off topic.

> Improve support to load Dojo from CDN, but CometD locally
> ---------------------------------------------------------
>
Reply all
Reply to author
Forward
0 new messages