Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 81702 invoked from network); 25 Jan 2011 16:58:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Jan 2011 16:58:42 -0000 Received: (qmail 16229 invoked by uid 500); 25 Jan 2011 16:58:41 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 16154 invoked by uid 500); 25 Jan 2011 16:58:41 -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 16147 invoked by uid 99); 25 Jan 2011 16:58:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jan 2011 16:58:41 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ap-cocoon-users@m.gmane.org designates 80.91.229.12 as permitted sender) Received: from [80.91.229.12] (HELO lo.gmane.org) (80.91.229.12) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jan 2011 16:58:31 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PhmDY-0008DO-EP for users@cocoon.apache.org; Tue, 25 Jan 2011 17:58:08 +0100 Received: from 157.Red-80-37-78.staticIP.rima-tde.net ([80.37.78.157]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 25 Jan 2011 17:58:08 +0100 Received: from des by 157.Red-80-37-78.staticIP.rima-tde.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 25 Jan 2011 17:58:08 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: users@cocoon.apache.org From: Des Magner Subject: Re: Adding my Java code to flowscript Date: Tue, 25 Jan 2011 16:57:56 +0000 (UTC) Lines: 58 Message-ID: References: <4D3B758D.60408@icandriveatractor.com> <7C655C04B6F59643A1EF66056C0E095EA99C8A@eusex01.sweden.ecsoft> <4D3E8446.5070009@oulu.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 80.37.78.157 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729)) X-Virus-Checked: Checked by ClamAV on apache.org Hi André That is more or less what I was trying to achieve, ie. write Java code that can be used in my flowscript but for this Java code to be completely independent of cocoon. From reading the documentation I was given to understand that this code could be compiled on the fly which would of course speed up development time (See the documentation link I referenced in the original post). I have never had any problem using standard Java classes, such as ArrayList, etc. in flowscript, the problem is accessing classes that I have written. So as far as I can see there are three options outlined below, the third one being the only one I have been able to successfully achieve. Option 1: Have your code compiled on the fly, specifiying in cocoon.xconf a classpath as to where it should look for source code. I cannot get this to work and this was why I posted the message in the first place. In more detail this is what I do: Add the following to cocoon.xconf: resource://org/apache/cocoon/components/flow/ javascript/fom/fom_system.js true 4000 file:/path/to/my/java/src Javascript in my flowscript: var resource = new Packages.mypackage.xyz.MyClass(); Throws the following exception: org.mozilla.javascript.EcmaError: TypeError: [JavaPackage mypackage.xyx.MyClass] is not a function, it is org.mozilla.javascript.NativeJavaPackage. Option 2: Complile my code to the my application's WEB-INF/classes directory (or alternatively place it in a jar file in the application's WEB-INF/lib directory. This I also tried but to no avail. Option 3: Place the compiled classes in the cocoon's own classes folder. When I do this I can indeed access my Java classes from flowscript. But this for me is the least desireable solution as it requires me to mix my own class files with cocoons class files which I don't consider elegant nor correct. And also, cocoon would need to be restarted everytime I make a modication to my Java classes. Regards Des --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org