I've dropped the @Import and tried many things inspired by Thiago and Lenny's 
source (thanks guys), but the module is still not found. 

Does the URL of the module look right?

        http://gc1.local:8080/myapp/asset.gz/module/pages/stuff.js

My WAR has META-INF/ at the top level alongside WEB-INF/ and legacy directories 
like js/ . To be clear, stuff.js is at META-INF/modules/pages/stuff.js . That's 
right isn't it? The legacy directories won't mess up asset resolution of the 
module will they?

Cheers,

Geoff

On 03/10/2013, at 4:29 AM, Thiago H de Paula Figueiredo wrote:

> Hi, Geoff!
> 
> As Lance said, with JavaScriptSupport.require(), you shouldn't use @Import in 
> the same file, because require() already does that.
> 
> Check these examples from tapestry-wymeditor:
> 
> https://github.com/thiagohp/tapestry-wymeditor/blob/master/src/main/java/br/com/arsmachina/tapestry_wymeditor/mixins/Wymeditor.java
> 
> https://github.com/thiagohp/tapestry-wymeditor/blob/master/src/main/resources/META-INF/modules/wymeditor/wymeditor.js
> 
> On Wed, 02 Oct 2013 11:16:00 -0300, Geoff Callender 
> <geoff.callender.jumpst...@gmail.com> wrote:
> 
>> Thanks, Lance, but no cigar. If I leave out the @Import line then I don't 
>> get the good news message. If I leave out the jsSupport.require line then I 
>> don't get the bad news message (and of course the javascript still doesn't 
>> run).
>> 
>> BTW, notice that the URLs of the two messages differ. The first one includes 
>> the checksum that we probably want.
>> 
>> On 02/10/2013, at 11:30 PM, Lance Java wrote:
>> 
>>> You are trying to import stuff.js twice. Once via require.js and once via
>>> @Import. I get the feeling it's the @Import that's failing.
>>> On 2 Oct 2013 14:13, "Geoff Callender" <geoff.callender.jumpst...@gmail.com>
>>> wrote:
>>> 
>>>> I'm desperately seeking an up-to-date example of custom javascript,
>>>> because nothing I've tried works.  Here's one attempt that failed...
>>>> 
>>>> package myapp.pages;
>>>> 
>>>> import javax.inject.Inject;
>>>> 
>>>> import org.apache.tapestry5.annotations.Import;
>>>> import org.apache.tapestry5.json.JSONObject;
>>>> import org.apache.tapestry5.services.javascript.JavaScriptSupport;
>>>> 
>>>> @Import(stack = { "core" }, library = { "stuff.js" })
>>>> public class Index2 {
>>>> 
>>>>       @Inject
>>>>       private JavaScriptSupport jsSupport;
>>>> 
>>>>       void afterRender() {
>>>>               JSONObject params = new JSONObject();
>>>>               jsSupport.require("pages/stuff").with(params);
>>>>       }
>>>> 
>>>> }
>>>> 
>>>> ...In my WAR is /META-INF/modules/pages/stuff.js...
>>>> 
>>>> define(["jquery", "t5/core/console"], function($, console) {
>>>>       return function(params) {
>>>>               console.warn("jQuery version: " + $().jquery);
>>>>       };
>>>> });
>>>> 
>>>> ...The javascript console shows good news...
>>>> 
>>>> Loading library /myapp/asset.gz/app/495033b1/pages/stuff.js
>>>> 
>>>> ...followed by bad news...
>>>> 
>>>> Failed to load resource: the server responded with a status of 404 (Not
>>>> Found) http://gc1.local:8080/myapp/asset.gz/module/pages/stuff.js
>>>> 
>>>> Cheers,
>>>> 
>>>> Geoff
>>>> 
>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
> 
> 
> -- 
> Thiago H. de Paula Figueiredo
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to