You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Francesco Chicchiriccò <il...@apache.org> on 2011/10/08 13:02:22 UTC

Re: cocoon 3: Javascript in jars

On 14/09/2011 14:28, Andre Juffer wrote:
> On 14/09/11 15:13, Francesco Chicchiriccò wrote:
>> On 14/09/2011 13:58, Andre Juffer wrote:
>>> On 14/09/11 14:35, Javier Puerto wrote:
>>>> [...]
>>>> AFAIK, Resource protocol is not yet implemented in Cocoon 3.
>>>
>>> There may be another way. It is possibly called differently? I tried 
>>> "classpath://...", but didn't work either. E.g. Spring uses this 
>>> protocol as well to load configuration located in jars. Very convenient.
>>
>> I did this in another (Cocoon3-based) project: It should be enough to 
>> add a class like [1], then add a bean like as
>>
>> <!-- Using classpath: resources -->
>> <bean 
>> class="org.onehippo.forge.hct.cocoon.internal.ClasspathURLStreamHandlerFactory"/>
>>
>> in one of spring's XMLs.
>
> Yes, this looks promising. So, this would mean that the following 
> would work?
>
> <map:match pattern="dojoroot/**">
> <map:read src="classpath://dojoroot/{1}" />
> </map:match>
>
> I will try this (later today).

Hei, I am curious: did this work at the end?

Regads.

> Thanks,
> André
>
>
>>
>> Regards.
>>
>> [1] 
>> https://forge.onehippo.org/svn/hct/trunk/core/src/main/java/org/onehippo/forge/hct/cocoon/internal/ClasspathURLStreamHandlerFactory.java
-- 
Francesco Chicchiriccò

Apache Cocoon Committer and PMC Member
http://people.apache.org/~ilgrosso/


Re: cocoon 3: Javascript in jars

Posted by Andre Juffer <an...@oulu.fi>.
On 08/10/11 14:02, Francesco Chicchiriccò wrote:
>>> I did this in another (Cocoon3-based) project: It should be enough 
>>> to add a class like [1], then add a bean like as
>>>
>>> <!-- Using classpath: resources -->
>>> <bean 
>>> class="org.onehippo.forge.hct.cocoon.internal.ClasspathURLStreamHandlerFactory"/>
>>>
>>> in one of spring's XMLs.
>>
>> Yes, this looks promising. So, this would mean that the following 
>> would work?
>>
>> <map:match pattern="dojoroot/**">
>> <map:read src="classpath://dojoroot/{1}" />
>> </map:match>
>>
>> I will try this (later today).
>
>
> Hei, I am curious: did this work at the end?

Actually, looking through the code of cocoon 3, it was not clear to me 
how this would work. But I will have another look to see how this work 
for other readers.

In the mean time, I have looked for an alternative solution and found 
one from the Dojo website at

http://dojotoolkit.org/documentation/tutorials/1.6/cdn/

So, dojo itself is stored elsewhere (some CDN) and I allow the 
application to load Javascript specific to the application by defining a 
module path, so that I can do for instance

dojo.require("my.appl.main")

and a main.js is loaded from the specified module path at, say, 
"dojo/js/my/appl.main.js" where "dojo/js" is the module path relative to 
the context. So, for now my problem is solved.


>
> Regads.
>
>> Thanks,
>> André
>>
>>
>>>
>>> Regards.
>>>
>>> [1] 
>>> https://forge.onehippo.org/svn/hct/trunk/core/src/main/java/org/onehippo/forge/hct/cocoon/internal/ClasspathURLStreamHandlerFactory.java
> -- 
> Francesco Chicchiriccò
>
> Apache Cocoon Committer and PMC Member
> http://people.apache.org/~ilgrosso/


-- 
Andre H. Juffer              | Phone: +358-8-553 1161
Biocenter Oulu and           | Fax: +358-8-553-1141
Department of Biochemistry   | Email: andre.juffer@oulu.fi
University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/
StrucBioCat                  | WWW: www.strucbiocat.oulu.fi
Triacle Biocomputing         | WWW: www.triacle-bc.com


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