Return-Path: X-Original-To: apmail-cocoon-users-archive@www.apache.org Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 93AD47F9A for ; Wed, 14 Sep 2011 11:35:26 +0000 (UTC) Received: (qmail 47936 invoked by uid 500); 14 Sep 2011 11:35:26 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 47888 invoked by uid 500); 14 Sep 2011 11:35:26 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 47879 invoked by uid 99); 14 Sep 2011 11:35:26 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Sep 2011 11:35:26 +0000 Received: from localhost (HELO mail-vw0-f47.google.com) (127.0.0.1) (smtp-auth username javier, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Sep 2011 11:35:25 +0000 Received: by vwe42 with SMTP id 42so2831068vwe.6 for ; Wed, 14 Sep 2011 04:35:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.92.236 with SMTP id cp12mr4367305vdb.200.1316000124700; Wed, 14 Sep 2011 04:35:24 -0700 (PDT) Received: by 10.52.160.67 with HTTP; Wed, 14 Sep 2011 04:35:24 -0700 (PDT) In-Reply-To: <4E708734.5080504@oulu.fi> References: <4E7076D2.1050605@cc.oulu.fi> <4E708734.5080504@oulu.fi> Date: Wed, 14 Sep 2011 13:35:24 +0200 Message-ID: Subject: Re: cocoon 3: Javascript in jars From: Javier Puerto To: users@cocoon.apache.org Content-Type: multipart/alternative; boundary=20cf307f32aaf5094304ace527ee --20cf307f32aaf5094304ace527ee Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 2011/9/14 Andre Juffer > ** > Hi Javier, > > Thanks for your reply. > > Yes, your suggestion probably would work, but seems more cumbersome. > Response returned from another block must be XML, right? > No, you can access resources from other blocks with this protocol. blockcontext:/[block-name]/[resource-path] ex. blockcontext:/my-dojo-block/dojo/dojo.js > That is, the requested javascript has to be inserted into XML with at lea= st > one containing element before it is send to the requesting block. > Subsequently, the requesting block would need to create a text/javascript > response that is send to the client. The latter can be accomplish with a > TextSerializer. More importantly, every cocoon-based web application must > have a block specifically for this particular purpose, which would mean m= ore > overhead for maintaining the software. Finally, the block serving the > javascript would need to access javascript as well, which have to be stor= ed > in a directory, as indicated in my original email. I would like to avoid = all > of this, and simply read javascript from a jar (maintained centrally as a > maven project). > Yeah, with blockcontext protocol you must define a cocoon block so this solution will not work for you if you want to get the javascript from a jar= . > > Could the developers possibly confirm that there is in fact no resource > protocol in cocoon 3. And if so, would there be any chance for having thi= s > feature available in next release of cocoon 3. At least to me, this would= be > extremely useful. > AFAIK, Resource protocol is not yet implemented in Cocoon 3. > > Thanks, > Andr=E9 > Salu2. > > > > > On 14/09/11 13:06, Javier Puerto wrote: > > Hi Andre, > > 2011/9/14 Andre Juffer > >> Hi, >> >> with cocoon 2.2 one can read javascript resources residing in separate >> jars like: >> >> >> >> >> >> (the above is for loading javascript from the dojotoolkit. I made a >> separate maven project for Dojo, and make a cocoon-based project dependi= ng >> on it. I have different maven projects for different versions of Dojo.) >> >> >> It seems that cocoon 3 is currently not supporting the resource protocol= ? >> A solution would be to physically have all the Dojo javascript located i= n a >> subdirectory dojoroot (for example), and in the sitemap have something l= ike >> >> >> >> >> >> (as in the example web application) >> >> However, this is inconvenient, as one would need to copy dojo to a >> subdirectory for each project that requires dojo. The maven way is much = more >> easier and certainly more elegant, as all projects requiring dojo are >> updated automatically. >> >> My question is now: If there is no resource protocol, how can one achiev= e >> the above? >> > > I can't found in 3.0 documentation , but you can try blockcontext:/ > protocol that's available on 2.2. > > http://cocoon.apache.org/2.2/1291_1_1.html > > Salu2 > > >> >> Thanks, >> >> -- >> 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/ >> StruBioCat | WWW: www.strubiocat.oulu.fi >> NordProt | WWW: www.nordprot.org >> 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 >> >> > > > -- > 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 > > --20cf307f32aaf5094304ace527ee Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

2011/9/14 Andre Juffer <andre.juffer@oulu.fi>
=20 =20 =20 =20
Hi Javier,

Thanks for your reply.

Yes, your suggestion probably would work, but seems more cumbersome. Response returned from another block must be XML, right?

No, you can access resources from other blocks with this proto= col.

blockcontext:/[block-name]/[resource-path]

ex.
blockc= ontext:/my-dojo-block/dojo/dojo.js

=A0
That is, the requested javascript has to be inserted into XML with at least one containing element before it is send to the requesting block. Subsequently, the requesting block would need to create a text/javascript response that is send to the client. The latter can be accomplish with a TextSerializer. More importantly, every cocoon-based web application must have a block specifically for this particular purpose, which would mean more overhead for maintaining the software. Finally, the block serving the javascript would need to access javascript as well, which have to be stored in a directory, as indicated in my original email. I would like to avoid all of this, and simply read javascript from a jar (maintained centrally as a maven project).

Yeah, wit= h blockcontext protocol you must define a cocoon block so this solution wil= l not work for you if you want to get the javascript from a jar.
=A0

Could the developers possibly confirm that there is in fact no resource protocol in cocoon 3. And if so, would there be any chance for having this feature available in next release of cocoon 3. At least to me, this would be extremely useful.

AFAIK, Resource protocol is not yet implemented in Cocoon 3.
=A0

Thanks,
Andr=E9

Salu2.
=A0




On 14/09/11 13:06, Javier Puerto wrote:
Hi Andre,

2011/9/14 Andre Juffer &= lt;ajuffer@cc.oulu.= fi>
Hi,

with cocoon 2.2 one can read javascript resources residing in separate jars like:

<map:match pattern=3D"dojoroot/**">
=A0<map:read src=3D"resource://dojoroot/{1}" = />
</map:match>

(the above is for loading javascript from the dojotoolkit. I made a separate maven project for Dojo, and make a cocoon-based project depending on it. I have different maven projects for different versions of Dojo.)


It seems that cocoon 3 is currently not supporting the resource protocol? A solution would be to physically have all the Dojo javascript located in a subdirectory dojoroot (for example), and in the sitemap have something like

<map:match pattern=3D"dojoroot/**">
=A0<map:read src=3D"dojoroot/{1}" mime-type=3D"text/javascript"/>
</map:match>

(as in the example web application)

However, this is inconvenient, as one would need to copy dojo to a subdirectory for each project that requires dojo. The maven way is much more easier and certainly more elegant, as all projects requiring dojo are updated automatically.

My question is now: If there is no resource protocol, how can one achieve the above?

I can't found in 3.0 documentation , but you can try blockcontext:/ protocol that's available on 2.2.

http://cocoon.apache.org/2.2/1291_1_1.html

Salu2
=A0

Thanks,

--
Andre H. Juffer =A0 =A0 =A0 =A0 =A0 =A0 =A0| Phone: +358-8-553 = 1161
Biocenter Oulu and =A0 =A0 =A0 =A0 =A0 | Fax: +358-8-553-1141=
Department of Biochemistry =A0 | Email: andre.juffer@oulu.fi
University of Oulu, Finland =A0| WWW: www.biochem.oulu.fi/Biocomputin= g/
StruBioCat =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | WWW: www.strubiocat.oulu.fi=
NordProt =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | WWW: www.nordprot.org
Triacle Biocomputing =A0 =A0 =A0 =A0 | WWW: www.triacle-bc.com

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




--=20 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

--20cf307f32aaf5094304ace527ee--