Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 86827 invoked from network); 4 Jun 2009 20:56:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Jun 2009 20:56:10 -0000 Received: (qmail 6859 invoked by uid 500); 4 Jun 2009 20:56:22 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 6783 invoked by uid 500); 4 Jun 2009 20:56:22 -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 6775 invoked by uid 99); 4 Jun 2009 20:56:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jun 2009 20:56:22 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [82.99.2.81] (HELO mx4.ciber-europe.com) (82.99.2.81) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jun 2009 20:56:10 +0000 Received: from eusex01.sweden.ecsoft ([10.46.0.69]) by mx4.ciber-europe.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 4 Jun 2009 22:55:48 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: RE: RE: classes in block / usage in flowscript Date: Thu, 4 Jun 2009 22:57:59 +0200 Message-ID: <7C655C04B6F59643A1EF66056C0E095E025049D0@eusex01.sweden.ecsoft> In-Reply-To: <20090604140354.259760@gmx.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: RE: RE: classes in block / usage in flowscript Thread-Index: AcnlHgPhidwR5EA/RfyQjgvLkggw8gAOLAgA References: <20090604110915.121530@gmx.net> <7C655C04B6F59643A1EF66056C0E095E025047FB@eusex01.sweden.ecsoft> <20090604131831.259800@gmx.net> <7C655C04B6F59643A1EF66056C0E095E025048D9@eusex01.sweden.ecsoft> <20090604140354.259760@gmx.net> From: "Robby Pelssers" To: X-OriginalArrivalTime: 04 Jun 2009 20:55:48.0951 (UTC) FILETIME=[D6BE3E70:01C9E556] X-Virus-Checked: Checked by ClamAV on apache.org Patrick, I re-read your question again: > So your suggestion would be to include all Classes into Spring to get > access through getComponent("someBean"); !?=20 I do not advise to configure all classes as spring beans of course. = Only the ones which have a more static behavior. A good use case can be found on my blog: http://robbypelssers.blogspot.com/2009/06/cocoon-22-block-handling-all-fi= le.html Cheers, Robby -----Original Message----- From: Patrick Heiden [mailto:patrickheiden@gmx.de]=20 Sent: Thursday, June 04, 2009 4:04 PM To: users@cocoon.apache.org Subject: Re: RE: RE: classes in block / usage in flowscript Thanks Robby, that was much of help to me! Cheers and a nice day, Patrick -------- Original-Nachricht -------- > Datum: Thu, 4 Jun 2009 15:28:58 +0200 > Von: "Robby Pelssers" > An: users@cocoon.apache.org > Betreff: RE: RE: classes in block / usage in flowscript > Hi Patrick, >=20 > If I'm not mistaken I think that some packages of the jdk are imported = by > default so you don't need to explicitly import. >=20 > http://cocoon.apache.org/2.1/userdocs/flow/java.html >=20 > But my advise is to import the ones you need explicitly. >=20 > Cheers, > Robby >=20 > -----Original Message----- > From: Patrick Heiden [mailto:patrickheiden@gmx.de]=20 > Sent: Thursday, June 04, 2009 3:19 PM > To: users@cocoon.apache.org > Subject: Re: RE: classes in block / usage in flowscript >=20 > Hello Robby, >=20 > thx for the fast reply! > ... >=20 > > The proper way to access java from flowscript is to import the = classes > > at the top: > >=20 > > importClass(Packages.com.mycompany.util.MyClass); >=20 > alright, i can get with that, but all i've done was >=20 > importPackage(Packages.some.package.inside.blockStructure); >=20 > and your following statement was also working! >=20 > >=20 > >=20 > > then you can do this: > > var myclass =3D new MyClass(); > >=20 > > This should work if at least that package is included in the = classpath. >=20 > .. the confusing thing to me is, that it is possible to get new = Objects > like java.io.ByteArrayOutputStream WITHOUT importing that class / = package! > So why it is not possible with classes defined inside my block? >=20 > >=20 > > And if you want to access beans, you should not use this = construction, > > neither is importing the class needed. > >=20 > > Then you just do: > > var mybean =3D cocoon.getComponent("nameOfBean"); >=20 > So your suggestion would be to include all Classes into Spring to get > access through getComponent("someBean"); !? I could go with that too, = even if > my beans would have prototype scope, no problem - but my question = remains: > WHY ist isn't possible to instantiate the classes inside block like = other > classes inside my classpath? >=20 > Cheers and much thanks, > Patrick >=20 > >=20 > > Cheers, > > Robby > >=20 > > -----Original Message----- > > From: Patrick Heiden [mailto:patrickheiden@gmx.de]=20 > > Sent: Thursday, June 04, 2009 1:09 PM > > To: users@cocoon.apache.org > > Subject: classes in block / usage in flowscript > >=20 > > Hello together, > >=20 > > I am a little bit wondering about following issue. > > Assume we have a Java-class inside a cocoon-block (i.e. like the = demo > > bean out of the tutorial). > >=20 > > When I get a new instance of this class through > >=20 > > ... > > var foo =3D new some.package.inside.block.MyClass(); > > ... > >=20 > > then i get this error: > >=20 > > ... > > Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "some" = is > > not defined. > > = (file:///home/pepemuck/_opt/devel/ISAC_DEV/isacBlocks/isacTermBlock/./sr > > c/main/resources/COB-INF/flow/MyFlowScript.js > >=20 > > There is no Problem to get instances like > > java.io.ByteArrayOutputStream() or the like. > >=20 > > So why is this error thrown when I want to get new Objects out of a > > package-hierarchy inside the package-hosting block? > >=20 > > By the way - instantiation via=20 > >=20 > > ... > > var foo =3D MyClass(); > > ... > >=20 > > works perfectly well! > >=20 > >=20 > > Any hints to understand WHY this happens? > >=20 > > Thanks upfront > >=20 > > with best regards, > > Patrick > > --=20 > > GMX FreeDSL mit DSL 6.000 Flatrate und Telefonanschluss nur 17,95 > > Euro/mtl.! > > = http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=3DOM.AD.PD003K11308T456= 9 > > a > >=20 > > = --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > > For additional commands, e-mail: users-help@cocoon.apache.org > >=20 > >=20 > > = --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > > For additional commands, e-mail: users-help@cocoon.apache.org >=20 > --=20 > GRATIS f=FCr alle GMX-Mitglieder: Die maxdome Movie-FLAT! > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: users-help@cocoon.apache.org >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: users-help@cocoon.apache.org --=20 GMX FreeDSL mit DSL 6.000 Flatrate und Telefonanschluss nur 17,95 = Euro/mtl.! http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=3DOM.AD.PD003K11308T456= 9a --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org