Hey Felix

Thx for your answer.


Felix Meschberger schrieb:
Hi Christian,

Christian Sprecher schrieb:
Hi all

Maybe a silly question: what is the best way to create reusable scripts?
By reusable I primarly mean for related resources.

Well, if it just for executing the same scripts to handle requests to
different resources, you might want to consider using resource super types.

Ok, have to check that one for code reuse
I am currently aware of 3 possibilites:
1) the *.esp way with the load() function, which afaik loads & evaluates
a script
2) the *.jsp way with compilation and then execution

Well, in JSP you have you have two options: include pieces of code
(fragements) upon JSP build time (<%...@include>) and RequestDispatcher
based include with <jsp:include>. I assume you mean the  former here,
right ?

Yes, exactly. I did have a look at it and the resulting *.java and *.class files are compiled to /var/classes. Basically I would expect the same behaviour when compiling a Groovy class and putting it in that directory (respecting the java package structure). I did try this by creating a *.class file out of a groovy file and put it in that directory, which didnt work
3) the OSGI way with bundles and services and stuff

This is fundamentally different from the first two options, but it has
one big advantage: It is the ultimate option to be really reusable
independent on whatever scripting language to you choose to handle
resource requsts.

True, but I am still thinking along the line of OSGI beeing components that are reusable by more than one "application".

How do you handle plain java classes: should those classes be available to scripting when deployed to /var/classes?

Hope this helps -- or maybe I am missing your point ;-)


It did and you didn't

Cheers

CSp

Reply via email to