You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andrea Chiumenti <ki...@gmail.com> on 2009/03/09 14:20:17 UTC

external libraries an assets

Hello I'm having the follogin problem.

I've created this Annotation for my library
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface DojoInitialization {
    String dojoSource() default
"asset:../assets/dojot5/dojotoolkit/dojo-${dojo-release-version}/dojo/dojo.js";
    String djConfig() default "parseOnLoad: true";
}

the server returns:

Could not convert
'asset:../assets/dojot5/dojotoolkit/1.0-SNAPSHOT/dojo/dojo.js' into a
component parameter binding: Unable to locate asset
'classpath:net/sourceforge/tapestryjfly/dojotapestry5demo/assets/dojot5/dojotoolkit/1.0-SNAPSHOT/dojo/dojo.js'
(the file does not exist).

into the jar the resource is located at:
net/sourceforge/tapestryjfly/dojotapestry5/dojo-1.2.3/dojo/dojo.js

and into the library module I have :
public static void contributeClasspathAssetAliasManager(
            MappedConfiguration<String, String> configuration)
    {
        configuration.add("dojot5/dojotoolkit/1.0-SNAPSHOT",
"net/sourceforge/tapestryjfly/dojotapestry5/dojo-1.2.3");
        configuration.add("dojot5/integration/1.0-SNAPSHOT",
"net/sourceforge/tapestryjfly/dojotapestry5/integration");
    }

How the dojoSource default should be ?

Thanks in advance,
kiuma

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


Re: external libraries an assets

Posted by Andrea Chiumenti <ki...@gmail.com>.
np, found solution using AssetSource service

On Mon, Mar 9, 2009 at 2:44 PM, Andrea Chiumenti <ki...@gmail.com> wrote:
> ok got this, but then how the following methos should be modified?
>
> public String getDojoSource(Page page) {
>        if (this.dojoInitialization == null) {
>            return null;
>        } else {
>            Binding b = bindingSource.newBinding("dojo binding
> source", page.getRootComponent().getComponentResources(),
> BindingConstants.ASSET, this.dojoInitialization.getDojoSource());
>            if (b.getBindingType().equals(Asset.class)) {
>                return ((Asset) b.get()).toClientURL();
>            } else if (b.getBindingType().equals(String.class)) {
> //assume it's an external URI
>                return b.get().toString();
>            } else { // ?
>                throw new RuntimeException("Unable to parse
> dojoSource: \"" + this.dojoInitialization.getDojoSource() + "\"");
>            }
>        }
>    }
>
> On Mon, Mar 9, 2009 at 2:41 PM, Thiago H. de Paula Figueiredo
> <th...@gmail.com> wrote:
>> On Mon, Mar 9, 2009 at 10:32 AM, Andrea Chiumenti <ki...@gmail.com> wrote:
>>> no, or I haven't understood:
>>
>> I messed up. You shouldn't use asset: in an Asset annotation, obviously.
>>
>>> Shoud I really use (and only this) instead?
>>> "classpath:net/sourceforge/tapestryjfly/dojotapestry5/dojo-1.2.3/dojo/dojo.js"
>>
>> I guess it should be classpath:/net .... (note the slash), so you
>> don't have problems with relative paths.
>>
>> --
>> Thiago
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>

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


Re: external libraries an assets

Posted by Andrea Chiumenti <ki...@gmail.com>.
ok got this, but then how the following methos should be modified?

public String getDojoSource(Page page) {
        if (this.dojoInitialization == null) {
            return null;
        } else {
            Binding b = bindingSource.newBinding("dojo binding
source", page.getRootComponent().getComponentResources(),
BindingConstants.ASSET, this.dojoInitialization.getDojoSource());
            if (b.getBindingType().equals(Asset.class)) {
                return ((Asset) b.get()).toClientURL();
            } else if (b.getBindingType().equals(String.class)) {
//assume it's an external URI
                return b.get().toString();
            } else { // ?
                throw new RuntimeException("Unable to parse
dojoSource: \"" + this.dojoInitialization.getDojoSource() + "\"");
            }
        }
    }

On Mon, Mar 9, 2009 at 2:41 PM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> On Mon, Mar 9, 2009 at 10:32 AM, Andrea Chiumenti <ki...@gmail.com> wrote:
>> no, or I haven't understood:
>
> I messed up. You shouldn't use asset: in an Asset annotation, obviously.
>
>> Shoud I really use (and only this) instead?
>> "classpath:net/sourceforge/tapestryjfly/dojotapestry5/dojo-1.2.3/dojo/dojo.js"
>
> I guess it should be classpath:/net .... (note the slash), so you
> don't have problems with relative paths.
>
> --
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: external libraries an assets

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, Mar 9, 2009 at 10:32 AM, Andrea Chiumenti <ki...@gmail.com> wrote:
> no, or I haven't understood:

I messed up. You shouldn't use asset: in an Asset annotation, obviously.

> Shoud I really use (and only this) instead?
> "classpath:net/sourceforge/tapestryjfly/dojotapestry5/dojo-1.2.3/dojo/dojo.js"

I guess it should be classpath:/net .... (note the slash), so you
don't have problems with relative paths.

-- 
Thiago

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


Re: external libraries an assets

Posted by Andrea Chiumenti <ki...@gmail.com>.
no, or I haven't understood:

"asset:classpath/net/sourceforge/tapestryjfly/dojotapestry5/dojo-${dojo-release-version}/dojo/dojo.js"
gives

Could not convert
'asset:classpath/net/sourceforge/tapestryjfly/dojotapestry5/dojo-1.2.3/dojo/dojo.js'
into a component parameter binding: Unable to locate asset
'classpath:net/sourceforge/tapestryjfly/dojotapestry5demo/pages/classpath/net/sourceforge/tapestryjfly/dojotapestry5/dojo-1.2.3/dojo/dojo.js

Shoud I really use (and only this) instead?
"classpath:net/sourceforge/tapestryjfly/dojotapestry5/dojo-1.2.3/dojo/dojo.js"



On Mon, Mar 9, 2009 at 2:24 PM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> On Mon, Mar 9, 2009 at 10:20 AM, Andrea Chiumenti <ki...@gmail.com> wrote:
>>    String dojoSource() default
>> "asset:../assets/dojot5/dojotoolkit/dojo-${dojo-release-version}/dojo/dojo.js";
>>    String djConfig() default "parseOnLoad: true";
>> }
>
> Try "asset:classpath/net/sourceforge....
>
> --
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: external libraries an assets

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, Mar 9, 2009 at 10:20 AM, Andrea Chiumenti <ki...@gmail.com> wrote:
>    String dojoSource() default
> "asset:../assets/dojot5/dojotoolkit/dojo-${dojo-release-version}/dojo/dojo.js";
>    String djConfig() default "parseOnLoad: true";
> }

Try "asset:classpath/net/sourceforge....

-- 
Thiago

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