Re: Velosurf 2.0
Congratulations, Claude-- looks really nice! (obviously you meant the link below: http://velosurf.sourceforge.net ) WILL On 11/10/06, Claude Brisson [EMAIL PROTECTED] wrote: Velosurf 2.0 has just been released. Velosurf is a database mapping layer for the Apache Velocity template engine. It provides automatic database mapping of tables and relationships without any code generation. In the context of a Webapp, it also provides handy tools for authentication, localization, and forms validation. Homepage: http://velosurf.sourrceforge.net Claude - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ANN] Restlet now supports Velocity
Sounds very slick. Is Restlet in our Powered By Velocity wiki page? Feel free to add it. WILL On 11/10/06, Jerome Louvel [EMAIL PROTECTED] wrote: Hi all, Restlet, a lightweight REST framework for Java, now natively supports Velocity templates. This feature was added in our latest 1.0 beta 20 release. Here is a summary of the main features: * REST concepts have equivalent Java classes (resource, representation, connector, etc.) * Suitable for both client and server Web applications * Automatic server-side content negotiation based on media type and language preferences * Static file serving and editing with metadata association based on file extensions * Support for representations like JSON, XML (DOM or SAX), FreeMarker templates (alternative to JSP) * Server connectors for HTTP, HTTPS and AJP (for Apache or IIS) protocols * Client connectors for HTTP, HTTPS, SMTP, JDBC and FILE protocols * Routers support the concept of URIs as UI with advanced pattern matching features * Filters support features such as authorization, browser tunnelling and extraction of call attributes * Support of HTTP Basic and Amazon Web Services authentication schemes * Deployment as native services using Java Service Wrapper * Supports blocking and non-blocking NIO modes * Clean Restlet API as a full alternative to the Servlet API * Noelios Restlet Engine (NRE) is the Reference Implementation (provided by Noelios Consulting) Project home page: http://www.restlet.org -- Jerome Louvel http://www.noelios.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: graph
Hi, JFreeChart seems to be the most popular Java open source graphing tool. http://www.jfree.org/jfreechart/ I've used KavaCharts, which is as inexpensive commercial option http://www.ve.com/kavachart/index.html And here is a HTML-only graphing library http://webfx.eae.net/dhtml/chart/chart.html Will On 11/7/06, jill han [EMAIL PROTECTED] wrote: I have a turbine/torque/velocity application. I want to add some graphs to the web page. The data will be retrieved from the DB. Is there any tools out there to do the job? What kind of tool do you use to create a graph? Is there any recommendations? Thanks a lot for your help. Jill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: set directive and CSS syntax
The Velocity syntax looks ok to me. The quotes don't matter, they are outside of the reference. On 11/3/06, Timothy Stone [EMAIL PROTECTED] wrote: So we have set a bunch of variables to use as inline CSS directives in HTML emails. For example: #set( $div_header = height: 125px; padding: 0 10px 0 0; color: #13aaf3; background: white url('${IMAGE_SERVER}/path/to/image') top left repeat-x; font-size: 18px;) Note that the url is single quoted. I noted this was a problem and removed them, leaving: #set( $div_header = height: 125px; padding: 0 10px 0 0; color: #13aaf3; background: white url(${IMAGE_SERVER}/path/to/image) top left repeat-x; font-size: 18px;) This did not seem to correct the problem we are having and I'm attributing it to the url(${IMAGE_SERVER}/path/to/image) portion itself. Is Velocity misinterpreting the url() call as a VM, or something else? Thanks, Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bizarre ClassNotFoundException when running in Eclipse
You can get odd behavior with 1.4 when running Velocity from a jar outside of the application classpath. For example, having the velocity jar in a container while the calling app is in a webapp. We've fixed this with upcoming release 1.5 (download the beta http://people.apache.org/dist/jakarta/velocity/v1.5beta1/ ). Now it searches for all plugins, templates etc in the ThreadContext classpath first. The result is much more intuitive behavior in these type of circumstances. WILL On 10/23/06, Robby Walker [EMAIL PROTECTED] wrote: Hi, I have a project using Velocity 1.4 that I'm working on from Eclipse 3.2.1. In my project path I have a directory called 'lib' which contains velocity-dep-1.4.jar. I have velocity-dep-1.4.jar added as an external jar to my project (I've also tried as a non-external jar). I'm using the following velocity.properties: resource.loader = classpath classpath.resource.loader.description = Velocity Classpath Resource Loader classpath.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader When I run init(...) from org.apache.velocity.app.Velocity I get the following error: java.lang.Exception: Problem initializing template loader: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader Error is: java.lang.ClassNotFoundException: org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory.getLoader(ResourceLoaderFactory.java:41) at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:142) at org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:522) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:227) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:461) at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:208) at org.apache.velocity.app.Velocity.init(Velocity.java:106) at com.ctk.index.AirsIndexer.init(AirsIndexer.java:75) at com.ctk.index.AirsParser.main(AirsParser.java:62) at org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory.getLoader(ResourceLoaderFactory.java:56) at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:142) at org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:522) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:227) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:461) at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:208) at org.apache.velocity.app.Velocity.init(Velocity.java:106) at com.ctk.index.AirsIndexer.init(AirsIndexer.java:75) at com.ctk.index.AirsParser.main(AirsParser.java:62) But here is the strange part. In my main function if I call Class.forName(org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader) it works and loads the class. Even if I call Class.forName before Velocity.init, I still get the error. I know this could be something pretty simple or fundamental I'm missing. Any help is greatly appreciated. Additional info: Windows XP JRE 1.5_09 Thank you, Robby Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Which variables are involved in a template?
The latest version of Velocity (1.5) has an event handler InvalidReferenceEventHandler that allows you to capture bad references. It's not yet documented but you can read the docs on event handlers, then look at the javadocs for this specific one. It's available in svn, we'll do a beta release soon. WILL On 10/19/06, Matthias Hendler [EMAIL PROTECTED] wrote: Hello Javier, just an idea. Perhaps you can use the velocity log mechanism to get the information. In version 1.4 (in v1.5 the API is a bit different I think) you can write your own logging class for velocity. So there you can parse the log messages. It's more a dirty solution, I think. Hopefully the developers have a better idea. :-) Ciao Matthias Original-Nachricht Datum: Thu, 19 Oct 2006 11:37:43 +0200 Von: Javier Velez [EMAIL PROTECTED] An: Velocity Users List velocity-user@jakarta.apache.org Betreff: Which variables are involved in a template? Hi, I am developing a tool using velocity. In my application the user write down a template and then it is evaluated within a velocity context. But somtimes not all variables in template are found in the context. So I need a mechanism to recognize which variables could not be resolved. One solution is evaluate once the template and then parse it looking for string maching with $ or ${}. My question is: Is there any other more straitforward mechanism within the velocity API that give me the list of unsolved variables? Or at least, is there a method in velocity API that returns the list of referenced variables witin a template? Thanks in forward. -- GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist! NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Velocity Config/Security Issue
Hi Robin, I set up a test server and duplicated this issue. Here's the specifics of what's going on with a suggested solution (long email). By default, the Tomcat security manager policy prohibits reflection on classes in the org.catalina hierarchy. This prevents web apps from instantiating internal classes and doing things it shouldn't be doing. When you write a JSP page that calls %= request.getSession().getId() % this is literally compiled into a class. Since the code is called directly, it works fine. As a contrast, when Velocity calls $request.session.id it uses reflection. Since the $request reference is actually implemented by org.apache.catalina.connector.RequestFacade (in Tomcat 5.5) any method calls using reflection throw a security exception. There are two possible solutions. (1) Your hosting provider should add the following to the security policy. Note it is very specific - just applies to the two velocity jars. You'll need to change the path to match your webapp. grant codeBase file:${catalina.home}/webapps/simple/WEB-INF/lib/velocity-1.4.jar { permission java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.connector; permission java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.session; permission java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.core; }; grant codeBase file:${catalina.home}/webapps/simple/WEB-INF/lib/velocity-tools-view-1.2.jar { permission java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.connector; permission java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.session; permission java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.core; }; (2) You can create your own implementations of HttpServletRequest and HttpSession that simply delegate to the app server versions. Since your classes are outside of the org.catalina hierarchy there will be no reflection-related security issues. Then add your new wrapper to the context with the same name request. To sum up, this issue is due to the use of reflection by Velocity and a strict security policy in Tomcat. Either changing the security policy or changing the target of the reflection would solve the problem. I'm going to post a JIRA issue to the Velocity Tools list suggesting that the project add a wrapper for $request to eliminate this issue. Best, WILL On 10/13/06, Robin Mannering [EMAIL PROTECTED] wrote: Hi Will, Originally, any request to the $request object were just being ignored (or were throwing security exceptions). So the Velocity page just output $request into the HTML. He then granted permission on the below package uisng the security manager and the request object was then 'working' although it was putting out the incorrect values. The exceptions in the log then disappeared. Then, he ran the application without the Security manager and the $request object had expected values for methods such $request.contextPath and $request.session.id and everything worked fine. I'm unfamiliar with Security Managers, shall I ask him to apply just this one? (This has no reference to Velocity classes does it?) java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.core As an extra, do you know of a hosting company that has established clients using Velocity? I might do well to move somewhere with direct experience of hosting with velocity. Thanks for all your help Robin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Velocity Config/Security Issue
I'll play around with this. Might be a day or so. On 10/11/06, Robin Mannering [EMAIL PROTECTED] wrote: Hi, Sorry I forgot the velocity version: Velocity 1.4 From: Will Glass-Husain [EMAIL PROTECTED] Reply-To: Velocity Users List velocity-user@jakarta.apache.org To: Velocity Users List velocity-user@jakarta.apache.org Subject: Re: Velocity Config/Security Issue Date: Wed, 11 Oct 2006 15:54:51 -0700 One more question. What's your platform -- version of Tomcat -- version of JDK -- Win, Linux, etc? (and to repeat the last email for redundancy) -- VelocityServlet or VelocityViewServlet (with version) I run an instance of Tomcat with a security policy. I've found numerous inconsistencies even within Tomcat that require security permissions to be opened up. (There was a bug with the 4.1.x series for example for which I had to open up something similar). I tend to think you've hit a Tomcat bug triggered by the way Velocity accesses the request object. Send the info back and we can dig into this. WILL On 10/11/06, Robin Mannering [EMAIL PROTECTED] wrote: Sorry, some more logging that might make it clearer. My local machine uses request objects: [EMAIL PROTECTED] and [EMAIL PROTECTED] Whereas the hosted server with the problem uses: [EMAIL PROTECTED] and [EMAIL PROTECTED] Log 1 - From action class running on hosted server -- 11-Oct 17:52:49.647 |DEBUG|TestAction.executeLogic | request = '[EMAIL PROTECTED]' 11-Oct 17:52:49.648 |DEBUG|TestAction.executeLogic | request.getContextPath() = '' 11-Oct 17:52:49.648 |DEBUG|TestAction.executeLogic | request.getMethod() = 'GET' 11-Oct 17:52:49.649 |DEBUG|TestAction.executeLogic | request.getSession().getId() = '28536F4542A222DC6F0E6DE23442DC6D' 11-Oct 17:52:49.650 |DEBUG|TestAction.executeLogic | request.getRequestURI() = '/test.htm' 11-Oct 17:52:49.650 |DEBUG|TestAction.executeLogic | request.getRequestURL() = 'http://www.chaletexplorer.com/test.htm' 11-Oct 17:52:49.651 |DEBUG|TestAction.executeLogic | request.getServletPath() = '/test.htm' Log 2 - From VM Template/page running on hosted server -- request = '[EMAIL PROTECTED]' request.contextPath = '/' request.method = 'GET' request.session.id = '$request.session.id' request.requestURI = '//test.vm' request.requestURL = 'http://www.chaletexplorer.com//test.vm' request.servletPath = '/test.vm' Log 3 - From action class (running on my local machine) --- 12-Oct 00:10:17.516 |DEBUG|TestAction.executeLogic | request = '[EMAIL PROTECTED]' 12-Oct 00:10:17.516 |DEBUG|TestAction.executeLogic | request.getContextPath() = '/indy' 12-Oct 00:10:17.516 |DEBUG|TestAction.executeLogic | request.getMethod() = 'GET' 12-Oct 00:10:17.516 |DEBUG|TestAction.executeLogic | request.getSession().getId() = '79E50B9B3F25A2897BF420521952D51F' 12-Oct 00:10:17.516 |DEBUG|TestAction.executeLogic | request.getRequestURI() = '/indy/test.htm' 12-Oct 00:10:17.532 |DEBUG|TestAction.executeLogic | request.getRequestURL() = 'http://localhost:8080/indy/test.htm' 12-Oct 00:10:17.532 |DEBUG|TestAction.executeLogic | request.getServletPath() = '/test.htm' Log 4 - From VM Template/page (running on my local machine) --- request = '[EMAIL PROTECTED]' request.contextPath = '/indy' request.method = 'GET' request.session.id = '79E50B9B3F25A2897BF420521952D51F' request.requestURI = '/indy/test.vm' request.requestURL = 'http://localhost:8080/indy/test.htm' request.servletPath = '/test.vm' -- From: Robin Mannering [EMAIL PROTECTED] Reply-To: Velocity Users List velocity-user@jakarta.apache.org To: velocity-user@jakarta.apache.org Subject: Re: Velocity Config/Security Issue Date: Wed, 11 Oct 2006 22:08:29 + Hi all, Can anyone shed some light? I have some more facts now The original problem was Velocity required permission on a core package within catalina. Is this because it couldn't find the 'correct' request object. Here are some logs, the first is from a Struts action class, the second is output from the velocity template forwarded to immediately after the action class. They refer to different request objects that ultimately give different values. Should the velocity template not also refer to [EMAIL PROTECTED] ?? Any help/clues would be greatly appreciated. Log 1 - From action class -- 11-Oct 17:52:49.647 |DEBUG|TestAction.executeLogic | request = '[EMAIL PROTECTED]' 11-Oct 17:52:49.648 |DEBUG
Re: simple question 2
The + operator for string concatenation is available in 1.5. You can download the beta I prefer Christopher's solution, myself. WILL On 10/11/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: As simple as this: #set( $products=$products,$user.productName ) See more at: http://jakarta.apache.org/velocity/docs/user-guide.html#String%20Concatenation I do remember having seen the +-operator implemented for string concatenation, can someone geve me a pointer or state if 1.5 will have this enabled? Cheers, Christoph P.S. to create a string with a comma separated list I use: #set( $sep = ) #set( $string= ) #foreach( $item in $list ) #set( $string=$string$sep$item ) #set( $sep = , ) #end Arkadiusz Ryćkowski wrote: --- Oryginalna wiadomość --- Od: [EMAIL PROTECTED] Do: Velocity Users List velocity-user@jakarta.apache.org Wysłano: 2006-10-11 13:35:31 Temat: Re: simple question your string matches Velocity semantics up to the (, and that is why the parser has trouble witch what comes afterwards. Just replace the initial $ to soothe the barking parser: #set( $D = '$' ) Many thanks Last question, how to do sth like #set ($products=$products + , + $user.productName) I'v tried i.e. #set ($products=$products${COMMA}$user.productName) and $products.concat($user.productName) but without expected effect - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: Running forumdemo sample on Tomcat 5.5
Unfortunately, the Forum example is rather dated, and applies to older versions of Tomcat. We've dropped it in the upcoming release and in fact have deprecated VelocityServlet (which it is based on). We suggest you download the subproject Velocity Tools which has improved support for webapps, and contains a tutorial of its own. See this URL for some more info on using Velocity with webapps. http://jakarta.apache.org/velocity/webapps.html Will On 10/11/06, Nils, Maratron.ch [EMAIL PROTECTED] wrote: Hello I have done this as explained in the README.txt: 1. Build the demo by running ./build-velocity.sh forumdemo 2. Drop the WAR (forumdemo.war) made in the Velocity bin into your Tomcat webapps directory. 3. Start Tomcat ( this will expand the forumdemo.war 4. Point your browser to http://yourhost.com/forumdemo now I can go to http://yourhost.com/forumdemo where the main entrance shows ok, but if I want to see the posts or post it I get: description The requested resource (/forumdemo/servlet/forum) is not available. Is that cause I built forumdemo.war with ant examples and not ./build-velocity.sh forumdemo (which doesnt do anything on windows anyways)? -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Velocity Config/Security Issue
|TestAction.executeLogic | request.getRequestURL() = 'http://www.chaletexplorer.com/test.htm' 11-Oct 17:52:49.651 |DEBUG|TestAction.executeLogic | request.getServletPath() = '/test.htm' Log 2 - From VM Template/page - request = '[EMAIL PROTECTED]' request.contextPath = '/' request.method = 'GET' request.session.id = '$request.session.id' request.requestURI = '//test.vm' request.requestURL = 'http://www.chaletexplorer.com//test.vm' request.servletPath = '/test.vm' From: Will Glass-Husain [EMAIL PROTECTED] Reply-To: Velocity Users List velocity-user@jakarta.apache.org To: Velocity Users List velocity-user@jakarta.apache.org Subject: Re: Velocity Config/Security Issue Date: Wed, 11 Oct 2006 06:25:35 -0700 I don't think it's Velocity which requires that permission, I'm guessing it's the request object which is ultimately provided by Tomcat... WILL On 10/11/06, Robin Mannering [EMAIL PROTECTED] wrote: Hi Will, Thanks for the links, I'll give them a thorough read. I've been working with the hosting company who set up the server config and they have give the application permission to org.apache.catalina.core although they are troubled to do so. They seem very surprised that velocity requires this permission. Since they granted the permission, the problem has cleared up and $request.contextPath now has a value within a velocity template (although this has changed from an empty value to '/' so I need to make source amendments. Not a problem, just worrying it takes on a new value in a different hosting environment. Thanks again for your help Robin From: Will Glass-Husain [EMAIL PROTECTED] Reply-To: Velocity Users List velocity-user@jakarta.apache.org To: Velocity Users List velocity-user@jakarta.apache.org Subject: Re: Velocity Config/Security Issue Date: Tue, 10 Oct 2006 15:04:32 -0700 What app server are you using? This is a server configuration issue. If someone else set it up, you might also want to work with them. If you're using Tomcat, check out: http://tomcat.apache.org/tomcat-5.5-doc/security-manager-howto.html And you should read the Sun docs at: http://java.sun.com/j2se/1.5.0/docs/guide/security/permissions.html WILL On 10/10/06, Robin Mannering [EMAIL PROTECTED] wrote: Hi Will, thanks for your help. Sorry. I'm new to permissions, could you explain a little more for me please. Thanks Robin From: Will Glass-Husain [EMAIL PROTECTED] Reply-To: Velocity Users List velocity-user@jakarta.apache.org To: Velocity Users List velocity-user@jakarta.apache.org Subject: Re: Velocity Config/Security Issue Date: Tue, 10 Oct 2006 08:24:57 -0700 Looks like the security policy on your app server needs to be tuned. Have you tried giving the permission java.lang.RuntimePermission for accessClassInPackage.org.apache.catalina.core? WILL On 10/10/06, Robin Mannering [EMAIL PROTECTED] wrote: Hi all, I'm new back on this list in a while, please excuse if the following problem is obvious/has been posted before. I am transferring an existing site based on Struts/Velocity to a new web hosting provider. The application runs smoothly on its current host. However, there seems to be one last stumbling block with the new server in that the Struts object; 'request' appears not to be in scope within velocity pages (there may be others not in scope). I'm using the VelocityLayoutServlet if that helps. I've attached a snippet of the log file that points to the problem I mentioned, notable the 'java.security.AccessControlException' and '$request.contextPath is not a valid reference' All other velocity directives appear to be functioning as normal. Has anyone seen this behaviour before? Any help would be greatly appreciated. Kind regards Robin 10-Oct 02:45:21.752 |INFO | [/].log | Velocity [info] ResourceManager : found /pages/frontend/home.vm with loader org.apache.velocity.tools.view.servlet.WebappLoader 10-Oct 02:45:21.761 |INFO | [/].log | Velocity [error] PROGRAMMER ERROR : PropertyExector() : java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.core) 10-Oct 02:45:21.763 |INFO | [/].log | Velocity [error] ASTIdentifier.execute() : identifier = contextPath : java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.core) 10-Oct 02:45:21.764 |INFO | [/].log | Velocity [error] RHS of #set statement is null. Context will not be modified. /pages/frontend/home.vm [line 9, column 1] 10-Oct 02:45:21.772 |INFO | [/].log | Velocity [error] PROGRAMMER ERROR : PropertyExector
Re: Velocity Config/Security Issue
Looks like the security policy on your app server needs to be tuned. Have you tried giving the permission java.lang.RuntimePermission for accessClassInPackage.org.apache.catalina.core? WILL On 10/10/06, Robin Mannering [EMAIL PROTECTED] wrote: Hi all, I'm new back on this list in a while, please excuse if the following problem is obvious/has been posted before. I am transferring an existing site based on Struts/Velocity to a new web hosting provider. The application runs smoothly on its current host. However, there seems to be one last stumbling block with the new server in that the Struts object; 'request' appears not to be in scope within velocity pages (there may be others not in scope). I'm using the VelocityLayoutServlet if that helps. I've attached a snippet of the log file that points to the problem I mentioned, notable the 'java.security.AccessControlException' and '$request.contextPath is not a valid reference' All other velocity directives appear to be functioning as normal. Has anyone seen this behaviour before? Any help would be greatly appreciated. Kind regards Robin 10-Oct 02:45:21.752 |INFO | [/].log | Velocity [info] ResourceManager : found /pages/frontend/home.vm with loader org.apache.velocity.tools.view.servlet.WebappLoader 10-Oct 02:45:21.761 |INFO | [/].log | Velocity [error] PROGRAMMER ERROR : PropertyExector() : java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.core) 10-Oct 02:45:21.763 |INFO | [/].log | Velocity [error] ASTIdentifier.execute() : identifier = contextPath : java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.core) 10-Oct 02:45:21.764 |INFO | [/].log | Velocity [error] RHS of #set statement is null. Context will not be modified. /pages/frontend/home.vm [line 9, column 1] 10-Oct 02:45:21.772 |INFO | [/].log | Velocity [error] PROGRAMMER ERROR : PropertyExector() : java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.core) 10-Oct 02:45:21.773 |INFO | [/].log | Velocity [error] ASTIdentifier.execute() : identifier = contextPath : java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.org.apache.catalina.core) 10-Oct 02:45:21.774 |INFO | [/].log | Velocity [warn] org.apache.velocity.runtime.exception.ReferenceException: reference : template = /pages/frontend/home.vm [line 32,column 34] : $request.contextPath is not a valid reference. _ Windows Live™ Messenger has arrived. Click here to download it for free! http://imagine-msn.com/messenger/launch80/?locale=en-gb - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [announcement] Click Framework 1.0 is now available
That's great to hear. Look forward to checking the new release out. On 10/4/06, Malcolm Edgar [EMAIL PROTECTED] wrote: Hi All, Click Framework 1.0 is now available. For the list of changes please see: http://click.sourceforge.net/docs/roadmap-changes.html This release includes lots of new examples. www.avoka.com:8080/click-examples regards Malcolm Edgar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help in calling a class in a velocity template
Noo... #set($newobject = $foo.class.forName(myclass).newInstance()) is just not a good way of doing this. It's error-prone, hard to read, may not be supported in future versions of Velocity. Instead, create an instance of the object and put it into the context before Velocity is called with context.put(newobject, new MyClass()); Note to Claude: I've got a new (simpler) Uberspector subclass that addresses this. I'm going to integrate it into 1.5 during our Hackathon in two weeks. WILL On 9/29/06, Claude Brisson [EMAIL PROTECTED] wrote: Do you mean : How to put a new instance of a class in the velocity context from inside the vtl? Usually, you put classes in the context using java (context.put(name,object)), or using toolbox.xml if you rely on the VelocityTools subproject. Now, if you really want to load a new instance of a class in the context from inside the VTL, you have the following hack: #set($newobject = $foo.class.forName(myclass).newInstance()) where $foo can be any existing reference. But this is really not a very clean coding style... Also, the class you load must have a default constructor (otherwise it is still possible but more complex). By the way, dev people, why is this issue only scheduled for 1.6? Will's patch seems to be ready in http://issues.apache.org/jira/browse/VELOCITY-179 and backward compatible with proper default configuration value. Claude Le vendredi 29 septembre 2006 à 10:27 -0400, sandesh makam a écrit : hi, Can any body tell me how i can call a class in a velocity template. I am trying to write a template which call a class that allows me to build a tree. thankyou - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP] anythings like AjaxAnywhere to integrate with Velocity?
Hi, I'm not familiar with any Velocity specific AJAX libraries. You can however write a Velocity template to serve as a low-level AJAX response. Browse the archives of this list for some interesting recent discussion on Velocity and AJAX. WILL On 9/29/06, Pham Anh Tuan [EMAIL PROTECTED] wrote: Hi all, I got a problem in executing the javascript code in the response which I got after ajax request. I heard somewhere that there's HTML_AJAX, which can solve above problem, but it is used for PHP, and the other one is AjaxAnywhere which is used for Java, would you plz showing me anythingelse (like AjaxAnywhere, my web app is Struts based application + Velocity). but, as u knows, AjaxAnywhere requires u to put some AjaxAnywhere taglib in .vm file, but .. currently, Velocity doesn't quite support other taglib in .vm file... :| help me, thanks in advance :) bowlkhin -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AJAX and Velocity (again, building on the previous posts)
I use the prototype.js library. Seems to improve productivity for AJAX and Javascript work. I like the Ajax.Updater method call which can populate a div tag with a block of HTML loaded from a file. (In my case, often generated with Velocity). WILL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Installing velocity
Are the examples files included with the binary? We should change the tutorial to skip this step if we can. WILL On 9/25/06, Nathan Bubna [EMAIL PROTECTED] wrote: Ah. You downloaded, the binary. You need to download the source distribution. http://apache.gr-linux.com/jakarta/velocity-tools/source/velocity-tools-1.2-src.zip I believe the tutorial says to get the source, though it probably just mentioned it in passing, rather than making it clear. On 9/25/06, Brenton Strine [EMAIL PROTECTED] wrote: There is no file called build.xml in velocity-tools-1.2.zip anywhere. I even did a search. I *have* typed the ant commands in the root directory of the velocity tools. Maybe I'm confused about what the root directory is. I unzipped velocity tools into C:\vtools. (So that inside C:\vtools is a folder called velocity-tools-1.2.)I then opened the shell, navigated to C:\vtools, and typed the commands. I also navigated to C:\vtools\velocity-tools-1.2 and typed the ant commands. I also have tried doing this with the velocity tools unzipped in the same directory as I have velocity itself in. Brenton By the way, this is the zip I've been downloading. Perhaps I have the wrong file?? http://apache.gr-linux.com/jakarta/velocity-tools/binarie s/velocity-tools-1.2.zip -Original Message- From: Nathan Bubna [mailto:[EMAIL PROTECTED] Sent: Monday, September 25, 2006 12:49 PM To: Velocity Users List Subject: Re: Installing velocity Where is the build.xml? Your command prompt should be working in the directory where the build.xml file is for ant to find it. So, after you unzipped the velocity-tools distribution, go to the root directory of it and then type the ant command(s). On 9/25/06, Brenton Strine [EMAIL PROTECTED] wrote: Yes, I've looked through that tutorial, but I can't get through it. It says Build the Velocity Tools jar and the simple example by typing: ant example.simple and in the readme file it says To build the project, start ant in the root directory of the project: ant. However, when I do either of these, all I ever get is Buildfile: build.xml does not exist! Build failed. I'm typing these commands in cmd.exe and I've tried it in the directory velocity-tools-1.2, velocity-tools-1.2\examples, and a few other things. My velocity-tools-1.2 directory is inside the velocity directory. Is that bad? What's the problem? Brenton -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Will Glass-Husain Sent: Saturday, September 23, 2006 8:37 PM To: Velocity Users List Subject: Re: Installing velocity Have you read the tutorial on webapps I linked to in the previous email? Download the subproject Velocity Tools. Look for the tutorial on using VelocityViewServlet and follow that. WILL On 9/23/06, Brenton Strine [EMAIL PROTECTED] wrote: Perhaps actually, what I mean to ask is what I need to do to *use* Velocity. Because I'm pretty sure I have Velocity installed. I did the whole ant thing, and I also did ant test, and everything seems fine. But if it's installed, then why aren't .vm files executed as velocity? What do I have to do so that I can write some velocity code and see the output? Brenton -Original Message- From: Brenton Strine [mailto:[EMAIL PROTECTED] Sent: Saturday, September 23, 2006 5:43 PM To: Velocity Users List Subject: Installing velocity I've downloaded the tomcat windows exectutable (5.5.17) and ran it. It seems to have installed perfectly, and furthermore, is somehow integrated with apache! I have velocity downloaded (not to mention jdk and ant installed)... But I don't know how to install velocity. I assume I've got everything I need. So how do I install Velocity now? Thanks everyone, Brenton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: Installing velocity
Have you read the tutorial on webapps I linked to in the previous email? Download the subproject Velocity Tools. Look for the tutorial on using VelocityViewServlet and follow that. WILL On 9/23/06, Brenton Strine [EMAIL PROTECTED] wrote: Perhaps actually, what I mean to ask is what I need to do to *use* Velocity. Because I'm pretty sure I have Velocity installed. I did the whole ant thing, and I also did ant test, and everything seems fine. But if it's installed, then why aren't .vm files executed as velocity? What do I have to do so that I can write some velocity code and see the output? Brenton -Original Message- From: Brenton Strine [mailto:[EMAIL PROTECTED] Sent: Saturday, September 23, 2006 5:43 PM To: Velocity Users List Subject: Installing velocity I've downloaded the tomcat windows exectutable (5.5.17) and ran it. It seems to have installed perfectly, and furthermore, is somehow integrated with apache! I have velocity downloaded (not to mention jdk and ant installed)... But I don't know how to install velocity. I assume I've got everything I need. So how do I install Velocity now? Thanks everyone, Brenton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Beginner trying to install velocity to apache server
Yes, I think that's a good way of framing it. (no pun intended). So the stack becomes Apache (optional) - Tomcat (app server) -- web framework (or VelocityViewServlet) - Velocity WILL On 9/22/06, Brenton Strine [EMAIL PROTECTED] wrote: Does this mean that a web framework actually *is* necessary, but that if not supplied otherwise, velocity uses it's own simple one? Brenton -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Will Glass-Husain Sent: Friday, September 22, 2006 10:59 AM To: Velocity Users List Subject: Re: Beginner trying to install velocity to apache server Actually, Velocity provides the VelocityViewServlet which is a ultra simple web framework (i.e. category 1). You just drop the templates in your Tomcat web app and you go. Have you seen this article? http://jakarta.apache.org/velocity/webapps.html WILL On 9/22/06, Peter Locke [EMAIL PROTECTED] wrote: I can't comment on Click as I've never used it, but I must recommend staying away from Struts. I know I may start an argument here as there are a lot of people who still live by them but I've used Struts, and while they were great when they first came out and there weren't alternatives, I have found them to be inferior to many other newer MVC/MVC2 frameworks. You don't NEED anything from 1. To be honest, I wouldn't bother with any other MVC framework until you learn velocity and all it offers. All you need to do to get velocity based pages to render your computer is: Install Tomcat and then Velocity. That's it. Once you are comfortable with the above and are writing some simple velocity backed servlets, then do your OWN investigation as to a supporting framework to help you. My suggestions to look at are Spring MVC/Web flow, Tapestry, JSF, but remember these aren't necessary, and in my opinion can add an unnecessary layer unless the web app developed is going to be quite large. Again this is a matter of opinion and others may argue that you should never develop a web app without one of these helper frameworks under the templating language, and I encourage you to explore them for yourself after getting comfortable with a basic velocity only webapp. -Original Message- From: Brenton Strine [mailto:[EMAIL PROTECTED] Sent: Friday, September 22, 2006 10:16 AM To: Velocity Users List Subject: RE: Beginner trying to install velocity to apache server Wow, I really wasn't getting it! Thanks everyone. May I ask a clarifacatory question? It seemed to me that all the stuff mentioned goes into two categories: 1: click, struts 2: tomcat, jboss, websphere, resin, jetty And possibly 3: resin, apache. And my understanding is that to get velocity to render on my pc, I need to install one thing from category 1, and one thing from category 2. Correct? I'm going to want to install either the easiest or the one with the most detailed install documentation available. Thanks, Brenton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Velocity In Servlets
Hi Alexandre, (Would you mind keeping the discussion on the user list -- otherwise it becomes overwhelming). I suggest you use Velocity 1.5-beta, just released. It's pretty stable. Download it from here: http://cvs.apache.org/dist/jakarta/velocity/ WILL On 9/19/06, Alexandre [EMAIL PROTECTED] wrote: Hey, just though I could ask you one more question... i saw in the docs that Velocity suports number comparison only for integers. also, i saw one post of yours (dating of 2005...) that says in 1.5 it will be various types... how to overcome that limitation? should i implement a class to help me with that? thanks a lot! Alexandre On 9/17/06, Will Glass-Husain [EMAIL PROTECTED] wrote: Hi Alexandre, One thing to consider. We've just released the beta version of Velocity 1.5 (or rather, are in the middle of doing so -- I don't think the web site is upgraded). We've deprecated the VelocityServlet and recommend you use the VelocityViewServlet in the Velocity Tools project instead. (This works with Velocity 1.4 as well). There's more info at these two urls: http://jakarta.apache.org/velocity/webapps.html http://jakarta.apache.org/velocity/tools/view/ Along with the many technical improvements, the documentation and examples are much better. WILL On 9/16/06, Alexandre [EMAIL PROTECTED] wrote: Hi, I'm using Velocity now, but I spent the last hour trying to figure out how to tell it where my templates are stored. I'm writing this message because I think that the Developer's Guide section entitled Using Velocity In Servlets should give a little bit more of detail in this respect. I think you could just put a tiny example of a servlet code overriding the loadConfiguration() method. I know that it's explained on that section, telling that if you want to set properties at startup you could use it, but for newbies this is to much hidden (they're just learning that Velocity looks in a specific path for the templates). Notice that the text refers to the examples: The following code is SIMILAR to the SampleServlet.java class included in the distribution in the examples directory. It's SIMILAR. It would not work for anyone trying it. Then I thought it would make sense to just google for that (ResourceNotFoundException). None of them could help me. I thought it would be too stupid to post one more on the web. Finnaly, as I tend to look at code samples too late (because I like reading about the subject and seeing examples intermingled with text), I found one example that comes packaged with Velocity. Sorry for bothering you with this, but I think this would be a great trigger to get everyone up and running the first minute (a thing only a few templating engines can do). Congratulations! You're doing a great job! Alexandre Martini -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Velocity-tools and geronimo
Where's the Velocity jar file? Is it in the webapp directory? Could Geronimo have another Velocity jar in the container classpath? Velocity 1.4 has a problem if it's in the container classpath, not the webapp classpath. You might try Velocity 1.5-beta. (will be released momentarily). On 9/17/06, Nathan Bubna [EMAIL PROTECTED] wrote: Hmm. Seems like a difference in the servlet implementation is likely... of course that's just guessing. and it may be that Geronimo isn't wrong, but just interprets the spec differently. it's hard to say without looking into it more. Would you open a JIRA issue for this? http://issues.apache.org/jira/browse/VELTOOLS and perhaps include example output from that VTL snippet you sent for Tomcat and Geronimo as references for comparison? that'd be great! On 9/17/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hey all, Velocity has been working sweet for quite some time, but I am working on upgrading the system to using Geronimo 1.1 from Tomcat 5.5.*. When I run my war under Tomcat, it works perfectly. When I run the same war under Geronimo, it ...almost works. Screens are generated and some links work. However, whereever I use a link as follows, the host is left off of the front of the URL once it is generated. Again this does not happen under just Tomcat. a href=$link.setAction('/pub/list/submit').addQueryData(c,$!csl).addQueryData(r,$!pop.pId)$!pop.pName/a Any ideas? John Eichelsdorfer The job bank http://www.jobbank.com * 16:03:36,718 INFO [ValidatorPlugIn] Loading validation rules file from '/WEB-IN F/validator-rules.xml' 16:03:36,765 INFO [ValidatorPlugIn] Loading validation rules file from '/WEB-IN F/validation.xml' 16:03:37,437 INFO [TilesPlugin] Tiles definition factory loaded for module ''. 16:03:37,921 INFO [ServletToolboxManager] Using config file '/WEB-INF/toolbox.x ml' 16:03:37,999 INFO [ServletToolboxManager] Toolbox setup complete. started in 10.282s Startup completed in 42 seconds Listening on Ports: 1099 0.0.0.0 RMI Naming 1527 0.0.0.0 Derby Connector 4201 0.0.0.0 ActiveIO Connector EJB 4242 0.0.0.0 Remote Login Listener 8009 0.0.0.0 Tomcat Connector AJP 8080 0.0.0.0 Tomcat Connector HTTP 8443 0.0.0.0 Tomcat Connector HTTPS 0.0.0.0 JMX Remoting Connector 61616 0.0.0.0 ActiveMQ Message Broker Connector Started Application Modules: EAR: geronimo/webconsole-tomcat/1.1/car RAR: geronimo/activemq/1.1/car RAR: geronimo/system-database/1.1/car WAR: com.jmjmedia.jobbank/jobbank/1158515709468/war WAR: geronimo/remote-deploy-tomcat/1.1/car Web Applications: http://THOR:8080/ http://THOR:8080/console http://THOR:8080/console-standard http://THOR:8080/remote-deploy Geronimo Application Server started 16:05:18,077 INFO [TilesRequestProcessor] Tiles definition factory found for request processor ''. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: i encounter some mistakes in User Guide.
Hi Sun, Thanks for catching this. Coincidentally someone just reported the first mistake the other day. We'll work on fixing these. WILL On 9/11/06, sun davy [EMAIL PROTECTED] wrote: hi Velocity team: I am an user of Velocity from China. Thanks for your perfect production. Through your creative and hard work, we have such Convenience and Powerful tools in our toolbox. but i have encounter some mistakes in the Velocity User Guide which in velocity-1.4\docs directory. 1) in Escaping VTL Directives section. \\#if( $jazz ) Vyacheslav Ganelin \\#end In this case, if $jazz is true, the output is \ Vyacheslav Ganelin \ after i run this code fragment,the output is : \ Vyacheslav Ganelin \ i think it's reasonable,because there is no br tag,so the browser(my is IE 6.0) doesn't output the backslash in a new line. 2) Advanced Issues: Escaping and ! #set( $foo = bar ) $\!foo $\!{foo} $\\!foo $\\\!foo This renders as: $!foo $!{foo} $\!foo $\\!foo My output is: $!foo $!{ $\!foo $\\!foo i was confused. --- Contrast this with regular escaping, where \ precedes $: \$foo \$!foo \$!{foo} \\$!{foo} This renders as: \$foo \$!foo \$!{foo} \bar My output is: $foo $!foo $!{foo} \bar it seems like clerical error. 3) Velocimacro Trivia Currently, Velocimacros must be defined before they are first used in a template. This means that your #macro() declarations should come before using the Velocimacros. i defined VM after they are first used in a template, it also work. i don't know why. hope your reply. best regards sun wei - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: memory problem with display table export options
Sreidar, Are you sure you are referring to Velocity? I'm familiar with the open source Display Table tag library, but not with anything in Velocity of that name... WILL On 9/8/06, Alexey Panchenko [EMAIL PROTECTED] wrote: sreidhar kanaparthy wrote: I am using th display table to list the number of users in my application. Export is working fine when there is less data, but when it reaches more than 50,000 users , almost all types of exports throwing the exceptions like heap exception or unable to export . I am expecting the application to scale to support upto atleast a million users. Any suggestion to solve this problem is of great help 1. Allow JVM to use more memory - e.g. add -Xmx256Ì to the java command line starting your application. 2. Use profiler to track memory usage and optimize it in your application. How do you use velocity? Why do you think that velocity is the most involved part in your memory usage? -- Best regards, Alexeymailto:[EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP] I'm looking for one text editor for Velocity
I use Eclipse with one of the Velocity plugins or TextPad (with a Velocity syntax extension). The first does auto-completion and error checking, the second just syntax highlighting. On 8/28/06, Hessu X [EMAIL PROTECTED] wrote: At least Ecplipse, JEdit emacs http://wiki.apache.org/jakarta-velocity/VelocityEditors Pham Anh Tuan [EMAIL PROTECTED] wrote: Hi all, I got a problem in seeking one text editor using in Velocity, I tried to use FCKEditor, but it sometimes doesn't work :( , I tried to use Dojo, but it's text editor can't specify cols and rows :( ... help me plz thanks in advance. bowlkhin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AJAX anyone?
I use Velocity with Ajax to generate the server-side responses. More commonly I do JSON responses but have also done XML. For me, the Velocity does no parsing, merely generates the AJAX reponse like it would any other text. It's convenient to specify a few lines of velocity, save it to my web directory, then retrieve with an AJAX call. WILL On 8/25/06, Scott Edward Skinner [EMAIL PROTECTED] wrote: I use and love Velocity, but when I want to deal with XML I use FreeMarker, which supports XPATH and can parse very easily. I have Spring configured to use both Velocity and FreeMarker so I can use one or the other for any given view. S |\_._/| .-. E | o o |_ / / S _.( T ) `./ / ---(((-`-(((- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AJAX anyone?
One more quick note. With prototype.js, it's easy to use the Updater javascript function to populate a DIV tag on the fly with an HTML formatted chunk. Again, it's easy to do this chunk in Velocity (or any templating language, really). WILL On 8/25/06, Will Glass-Husain [EMAIL PROTECTED] wrote: I use Velocity with Ajax to generate the server-side responses. More commonly I do JSON responses but have also done XML. For me, the Velocity does no parsing, merely generates the AJAX reponse like it would any other text. It's convenient to specify a few lines of velocity, save it to my web directory, then retrieve with an AJAX call. WILL On 8/25/06, Scott Edward Skinner [EMAIL PROTECTED] wrote: I use and love Velocity, but when I want to deal with XML I use FreeMarker, which supports XPATH and can parse very easily. I have Spring configured to use both Velocity and FreeMarker so I can use one or the other for any given view. S |\_._/| .-. E | o o |_ / / S _.( T ) `./ / ---(((-`-(((- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting a velocity engine in Spring
Hmm... I've successfully (and easily) used Velocity with the Spring MVC. Anyone got experience with the Spring/Struts/Velocity combo? WILL On 8/21/06, Bill Rishel [EMAIL PROTECTED] wrote: Within Struts I've been using a velocity engine from within a subclass of VelocityViewServlet with which I am able to call evaluate(Context context, java.io.Writer out, java.lang.String logTag, java.lang.String instring) to render the vtl in the 'instring'. Because I am doing my own preprocessing before that call and possibly after I need that kind of fine grained control of the vtl rendering. I am moving now to Spring, which gives me some important features, but haven't been able to figure out how to do the hand rendering of the vtl within a Spring controller. Any suggestions on how to do that? Bill Rishel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to declare map in template
Hi Prashant, This capability (literal maps) is available in the (as yet unreleased) Velocity 1.5. If you download the code from svn, you'll see this in the users guide. WILL On 8/15/06, Prashant [EMAIL PROTECTED] wrote: Hi, I want to know that how we can declare Map object in template. regards prashant -- Prashant [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to reduce memory usage and still use the cache?
] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: some escape character
I don't think we currently allow this. Is it in JIRA? If not, I'll add it a bit later. Will On 8/4/06, Nathan Bubna [EMAIL PROTECTED] wrote: I can't recall if quote escaping was actually added to Velocity 1.5 yet or not, but i'm at least sure we came to the consensus that double quote escaping should be done as follows for backwards compatibility. #button( ADD javascript:retrieveURL($AJAXurl) At least, i think so. Perhaps someone else can confirm whether this is in 1.5 yet or not? My memory is fuzzy these days, as i'm suffering from newborn-baby-sleep-deprivation. :) On 8/4/06, Barbara Baughman [EMAIL PROTECTED] wrote: When in doubt, I find the most straightforward way to do it is to: #set($q='') #set ($AJAXurl = $link.setAction(ShowRegionAddForm)) #button(ADD javascript:retrieveURL($q$AJAXurl$q))br This approach takes less brainpower to implement and is easier to read than escape characters, which I don't think Velocity has anyway. I use this quite often in HTML-based templates. Barbara Baughman X2157 On Fri, 4 Aug 2006, dizzi wrote: It has probably pretty simple solution but i cant figure it anyway :) #macro(button $name $url) div class=buttona href=$url$name/a/div #end #set ($AJAXurl = $link.setAction(ShowRegionAddForm)) #button(ADD javascript:retrieveURL($AJAXurl))br is renedered like javascript:retrieveURL(/tors/ShowRegionAddForm.do) I need javascript:retrieveURL(/tors/ShowRegionAddForm.do) How can i tell velocity that quote in macro parameter is part of string and not argument #button(ADD javascript:retrieveURL('$AJAXurl'))br this works nice, but what if i need and not ' :) thx dizzi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Defining velocimacro in java class
Here are some good examples about how to extend Velocity, including the creation of custom directives... http://wiki.apache.org/jakarta-velocity/HackingVelocity WILL On 7/31/06, Maxim Gordienko [EMAIL PROTECTED] wrote: The reason is quite simple. The macro logic is quite complicated and cumbersome. It hardly can be implemented in velocity template. It's legacy architecture feature - view asks business logic for a model. Maybe I do not need macro and directive works just well. I need to define some kind of shortcut for view developer who can use it in any view. And a logic behind this shortcut is actually evaluated only if velocity engine encounter shortcut in rendered view. Can you point out where i can find info about custom directive? Thank you! On 7/31/06, Nathan Bubna [EMAIL PROTECTED] wrote: Is there some particular reason you want to attach the macro to a specific context? If you are just wanting to define a Velocimacro in a java class, than you can create a custom directive. But those must be associated with a VelocityEngine before initialization. Your other option would be to Use A Tool. This could be a tool that takes advantage of the VelocityTools support or just any old POJO. Have it take the parameters you want and generate the output you want. Then you just put it in your context and use it. Other than these alternatives, no, i don't believe it is possible to define a Velocimacro in a java class and attach it to a specific context. On 7/30/06, Maxim Gordienko [EMAIL PROTECTED] wrote: Hello! Is it possible to define Velocimacro in java class (implementing some interface, extending some base class etc.), somehow register it in context and use it just like macro defined inline or in macros library? Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Putting key/value pair into hashmap from velocity template
More specifically, see https://issues.apache.org/jira/browse/VELOCITY-186 WILL Henning P. Schmiedehausen wrote: [EMAIL PROTECTED] writes: (In 2001 I made a proposal and contribution allowing: #set($!dummy=null) to explicitly allow set-operations with null RHS - but it did not find its way in. It is a simple patch, and maybe there is more interest now). Please take a look at the directive.set.null.allowed property of 1.5-dev. It should do exactly what you want. Best regards Henning -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com
Re: Putting key/value pair into hashmap from velocity template
That'll teach me to actually try out syntax before suggesting it. Thanks, Henning... Henning P. Schmiedehausen wrote: Will Glass-Husain [EMAIL PROTECTED] writes: Hi Matthias-- Two things. First, this syntax is not valid: ${jMap.put(123, test)} No. It is valid. Don't listen to Will. ;-) Use one of these two forms this instead $jMap.put(ttt123,test) ${jMap}.put(ttt123,test) Uhm, no?!? ${jMap.put(...)} _is_ correct. If you write ${jMap}.put(), you force Velocity to evaluate ${jMap} without looking at the surrounding template code. This leads to executing jMap.toString() which renders the map as text and then adding .put(...) after it. The reason Velocity works this way is that templates are typically used to just display data. They very rarely change internal state. (makes for less error-prone programming). If you want to call put from within your template and not have it return null, you'll need to write a Map wrapper which is either defined void or returns an actual value. ... or use the quiet notation $! or use 1.5-dev where you can set a property to have null as a valid reference. Best regards Henning -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com
Re: Putting key/value pair into hashmap from velocity template
Hi Matthias-- Two things. First, this syntax is not valid: ${jMap.put(123, test)} Use one of these two forms this instead $jMap.put(ttt123,test) ${jMap}.put(ttt123,test) Second, the put call works fine in your example. But since it returns null, it echoes back the velocity reference. You can test this by doing a get after the put. The reason Velocity works this way is that templates are typically used to just display data. They very rarely change internal state. (makes for less error-prone programming). If you want to call put from within your template and not have it return null, you'll need to write a Map wrapper which is either defined void or returns an actual value. WILL Matthias Hendler wrote: Hello, I have created a simple test to show the problem I have with velocity. I offer my test case in a zip archive to everyone who is interested. Download the archive at: http://velocity.hendlerreplace this and brackets by a minus sign '-'home.de/ In this archive you will find the java source, all needed velocity jars, a template and a batch file to run the test. Look at my template file, run the batch file and watch the output file and velocity logfile. I would be pleased if anyone could tell me what I am doing wrong! -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Putting key/value pair into hashmap from velocity template
Hi-- I do not know if the current release allows empty #if(...)#end body. Previously fixed in the source control head. WILL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Overriding the default precedence of the template engine
Hi Mike, Not sure. The basic premise behind Velocity is this notion of the application providing the context and then the template being filled out. Such an approach keeps things simple. You might look at the Velocity Tools project -- there's a item called RenderTool that lets a Velocity template evaluate more text within itself. WILL Smith, Mike H wrote: Hi, Is there a way to modify the precedence logic of the template engine? In particular, I'd like to: 1. Define a template like: #set( $this = Velocity) $this is great! 2. Within the application code, set the this property to be something different (e.g. Laughter) 3. Then have the engine render as Laughter is great With the current implementation the rendering precedence is template then context, any easy way to reverse this? Thanks. Mike -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Extracting a list of keys from a string based template
Hi Mike, First, a quick side comment. Velocity.evaluate() does work fine. But if you are calling Velocity repeatedly, consider using a resource loader like FileResourceLoader or ClasspathResourceLoader. The caching mechanism in the resource loader speeds up things tremendously. Velocity is more aimed at generating the text rather than parsing it. It doesn't contain much in the way of identifying content. It's possible you might load the file in a resource loader, take the returned Template object, and break it down into to the constituent parsed nodes. But since this is essentially an internal structure, the specific node types it might change in future versions. WILL Smith, Mike H wrote: Hi, I'm a Velocity newbie, and am evaluating to see if it can address our relatively simple requirements. I need to use String based templates. After a bit if digging around I found the following function: Velocity.evaluate( context, writer, , templateString ); This works pretty well for our purposes. However I also need to get a list of candidate keys from the template String. So if my template contains: $a $b I need to extract [a,b]. Thanks. Mike -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Putting key/value pair into hashmap from velocity template
Hi Matthias-- There's no magic. If there are parens, it assumes it is a method call $abc.foo(data) calls the foo method with the argument data. $abc.foo would call either getFoo(), getfoo() or (for a Map) get(foo) WILL Matthias Hendler wrote: Thanx Chris, but this doesn't solve the problem. :( It's still the same error. I also tried to use the method set(index, object) from arraylist, but this also doesn't work. I guess that velocity does some magic and don't calls the put-method from hashmap or the set-method from arraylist. I have verified both tests by calling the methods clear() and size() on hashmap and arraylist to be sure, that the objects exists in the velocity context. I have found at http://www.freebok.net/help/velocity4.html the following example: $sisyphus.pushRock() ## Velocity assumes I mean $sisyphus.getRock() Its not discussed in detail what the author meant by his example, but I wonder how velocity assumes method calls. Original-Nachricht Datum: Wed, 19 Jul 2006 17:00:13 +0200 Von: [EMAIL PROTECTED] An: Velocity Users List velocity-user@jakarta.apache.org Betreff: Re: Putting key/value pair into hashmap from velocity template try without the square brackets... ;) Christoph Matthias Hendler wrote: Hello, I try to put a key/value pair to a hashmap from velocity template. First I put a new hashmap object into velocity context named myMap. In my templates I can write: ... $myMap.clear() Size: $myMap.size() ... The above works fine. Now I want to put a key/value pair into the hashmap using the method put(object, object). So I wrote: ... ${myMap.put([123, test])} ^ ^ ... And I get an exception: ${myMap.put([123, test])} is not a valid reference. What's wrong? Thanx Matthias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com
Re: Putting key/value pair into hashmap from velocity template
ah - thanks for the correction. not every day I learn something new about Velocity. WILL Henning P. Schmiedehausen wrote: Will Glass-Husain [EMAIL PROTECTED] writes: would call either getFoo(), getfoo() or (for a Map) get(foo) Not just for a map. For _any_ object. If it has a get(Object) method, this gets called. I've used this many times in Turbine tools which definitely don't implement Map. Best regards Henning -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com
Re: Urgent ,need help for using Velocity
Hi Surjan, [Can you please respond to [EMAIL PROTECTED] Thanks!] Depends whether you want to use Velocity for a web app or other application. For a web app, see http://jakarta.apache.org/velocity/webapps.html (there's a tutorial at the end) For use in other applications (e.g. generating email or other text files), see the example in http://jakarta.apache.org/velocity/docs/developer-guide.html#Using%20Velocity%20In%20General%20Applications Will Surjan Rawat wrote: Hi, I am new to Velocity . I want to if theres any good tutorial for beginners on velocity. I want to develop a simple application using velocity for my presentation. Please Help. -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: parseErrorException
Hi Tom, Are you trying to compile the docs for Tools? Any of the tools users have thoughts on this? best, WILL Tom Jerry wrote: C:\Softwares\velocity-tools-1.2-srcant Buildfile: build.xml .. . . docs: [dvsl] Loading stylesheet C:\Softwares\velocity- tools-1.2-src\xdocs\site.dv sl [dvsl] [error] Exception Loading User Directive: org.apache.tools.dvsl.dir ective.MatchDirective : java.lang.ClassNotFoundException: org.apache.tools.dvsl. directive.MatchDirective [dvsl] [error] ResourceManager : unable to find resource 'VM_global_librar y.vm' in any resource loader. [dvsl] [error] Parser Exception: DVSL:stylesheet : org.apache.velocity.run time.parser.ParseException: Encountered #end\r\n at line 162, column 1. [dvsl] Was expecting one of: [dvsl] EOF [dvsl] ( ... [dvsl] RPAREN ... [dvsl] ESCAPE_DIRECTIVE ... [dvsl] SET_DIRECTIVE ... [dvsl] ... [dvsl] \\ ... [dvsl] TEXT ... [dvsl] SINGLE_LINE_COMMENT ... [dvsl] *# ... [dvsl] *# ... [dvsl] STRING_LITERAL ... ... [dvsl] Failed to read stylesheet C:\Softwares\velocity- tools-1.2-src\xdocs\ site.dvsl BUILD FAILED C:\Softwares\velocity-tools-1.2-src\build.xml:261: org.apache.velocity.exception .ParseErrorException: Encountered #end\r\n at line 162, column 1. Was expecting one of: EOF ( ... RPAREN ... ESCAPE_DIRECTIVE ... what should I do about this -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClasspathResourceLoader with/without leading slash
Hi Bradley, I think this works in the (as yet) unreleased Velocity 1.5. It's pretty stable, you can download it, compile it and use it. If you want to make it relative, you might try writing your own resource loader. It's a fairly simple API. Just grab the code for ClasspathResourceLoader from the source and modify it. Then specify this custom resource loader in your velocity.properties. There's some more info on writing custom resource loaders on the Wiki here and elsewhere: http://wiki.apache.org/jakarta-velocity/HackingVelocity Best, WILL Bradley Wagner wrote: I'm using Velocity-1.4 and I'm experiencing problems with loading templates using the ClasspathResourceLoader. Basically, the only way I can get it to work is by dropping the leading slash on my absolute classpath. Template template = Velocity.getTemplate(class/path/to/file) Also, is there any way to reference something relative to your current class as you can do with the resource loader in Java? MyClass.class.getResourceAsStream(./relative/to/current) Thanks, Bradley - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: pls help on Velocity-servlets
Hi Tom, You probably want to download the sub project Velocity Tools. Use the VelocityViewServlet -- it's the best approach. Also, read this article. It includes a simple tutorial http://jakarta.apache.org/velocity/webapps.html WILL Tom Jerry wrote: hi... I have a simple servlet and velocity program.. for eg. Sample.java and email.vm ... and when the vm file is run in a browser, nothing is displayed.. which means the template is not loaded properly . email.vm is in pets folder (pets/email.vm) and Sample.class is in pets/WEB-INF/classes folder. I gave the simple code as : Template t = getTemplate (email.vm); I am new to Velocity... and while googling, I found that webAppLoader is the best way to load templates. How to use it ??? And which is the proper way.. having a velocity.properties file or setting the properties in the Servlet java file ??? Please guide me. Regards, Snowy -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
macro not being called
Hi, Just a quick query. Has anyone else had problems with repeated or simultaneous macro calls not executing? I've a template that does 10 macro calls in quick succession with a #parse'd header file. (I use this to load a common set of data for the page). This is an app with 2 iframes, so there are always at least 3 simultaneous threads making these 10 macro calls. I'm discovering that on my production machine sometimes the first 7 of those calls execute, but the last 3 don't. Changing the order of the calls doesn't make a difference, it's always the last 3. I'm suspecting some subtle race condition, but it's hard to replicate this on my dev machine. The property velocimacro.permissions.allow.inline.local.scope is set to true, so theoretically macros in one page shouldn't affect another. Anyone have a similar experience? Will -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Inject velocimacros during runtime (request)
I'd like this too. (or something similar to allow macros to be defined in other files). It's been a growing demand from our users. Adding the macros via #parse would be nice for me. But it sounds like you're looking for some type of event handler allowing the macros to be selected in code. Is this right? WILL Magnus Kvalheim wrote: Hi all, I'm using VelocityViewServlet with velocitytools 1.2 I'm working on a web based templating system that relies on velocity for generating output. This is a multiuser system and files are stored in private repositories (DB). A custom resourceloader takes care of the file segregation. I would like for my users to be able to specify velocimacros in a configuration-file and have them loaded in request time. (Just like with the velocimacro.library property in the velocity.properties file are loaded for the velocity engine) I have searched through the sourcecode for a suited place to 'inject' the runtime macro files, with no success so far. I realize that the macro files could be parsed from within a template file, but I would like for my users to be able to declare them in a configuration file. Any suggestions would be greatly appreaciated thanks magnus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: clarification needed for getting HashMap values in the templates
yes. WILL jian chen wrote: Hi, All, As a long term Velocity user, I think I have been pretty savvy for Velocity usage. Still got a question to ask though. If I put a HashMap in the Velocity template, HashMap map = new HashMap(); map.put(aKey, aValue); ctx.put(map, map); I can retrieve the value in the template by: $map.aKey. I tried to find relevant info. in Velocity user guide, but couldn't find any relating this usage. So, is it that $map.aKey is the same as $map.get(aKey)? Thanks, Jian -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please - help me
Hi Ravi, [ this questions is more suited for the velocity-user list, not the developer list. Would you mind responding please to [EMAIL PROTECTED] Thanks. ] All Velocity does is generate text files - you have to define the output template for the radio buttons. Take a look at Anakia. This is an ant task for Velocity that reads in an XML file and uses it as the source data. You should be able to use this to populate an HTML template that displays radio buttons. For examples of how it works, download the velocity source and look at the documentation -- it's all created with Velocity/Anakia based on XML source. Best, WILL ravi gowda wrote: Hi, Description: Using apache template writer. I was not sure on how to post this question.. so I am writing this mail.. Problem is , I have written an xml file (where two radio buttons should be horizontally aligned) for ex: radiobutton name=RadioButtons description= option label=Radio_1 value= option label=Radio_2 value= /radiobutton Based on the above example the buttons will be aligned vertically one below the other like.. Radio_1 . Radio_2 . But I need them to be horizontally aligned on next to the other like this. Radio_1 . Radio_2 . When I start my Application the XML will be loaded by the java class (which imports the functionality of the Sun's velocity template engine API) and writes to the template using Apache's velocity template writer. Since I don't have any control to any CSS/XSL standards and also even I don't even know abt it at all. At the end when I could my those radio buttons sitting one below the other.. Can Any one suggest me how to achieve this. Thanks in Advance Ravi __ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Velocity on z/OS - velocity.properties not getting picked up
Having the multiple jars with Velocity has been known to cause problems in the past, particularly if they are loaded by different classloaders (e.g. one in a container classpath and one in the app). Can you get rid of one and see what happens? WILL Anuradha Weeraman wrote: Hi, I've been using Velocity in J2EE web application on z/OS and have been running into a few problems. I'm using maven to build the application which has set dependencies on velocity 1.4. the repository/jars folder contains both velocity-1.4.jar and velocity-1.4-dev.jar. For some reason, when velocity is initialized, the velocity.properties file doesn't get picked up and as a result throws a NullPointerException. When a Property object is manually populated with the needed fields or if the property file is manually loaded and passed into the init method, it seems to work. Does anybody any idea why the velocity.properties in velocity-1.4.jar\org\apache\velocity\runtime\defaults doesn't get picked up automatically? Could it be because the property file appears in both maven-1.4.jar and maven-1.4-dev.jar? Regards, Anuradha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How Can I Search the Archive?
Search for StringResourceLoader. There's a couple of archives. I like GMane. http://news.gmane.org/gmane.comp.jakarta.velocity.user But here's a more helpful link with some sample code: http://issues.apache.org/jira/browse/VELOCITY-183 WILL Keith R. Bennett wrote: All - Is there a way I can search the archive for a given string, say String Resource Locator? The only interface I see is to view messages by month (at http://mail-archives.apache.org/mod_mbox/jakarta-velocity-user/). Thanks, Keith - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: another kudo to Velocity, destinationlighting.com is live
Jian, Thanks for the update and good words! Please feel free to update the PoweredByVelocity wiki page if you'd like. Good luck with your site. Cheers, WILL jian chen wrote: Hi, All, Our site, www.destinationlighting.com, went live yesterday. Powered by Velocity template engine, it will be the best and most comprehensive online store for lighting fixtures and related hardware. A big thank you for the velocity developers and the open source community. we love this template engine! Jian Chen Lead Developer www.destinationlighting.com -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Velocity 1.5-dev on jdk 1.3
Yes, it can run with JDK 1.3+. (requires JDK 1.4 to compile) WILL Ricardo Lecheta wrote: Hi all, I would like to use the Click web framework in a project and Click uses Velocity 1.5-dev for view rendering. But my customer uses WebSphere 3.5 with jdk 1.3. Does velocity run with jdk 1.3 ? thanks, Ricardo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I get the length of Array ?
Not true, though it's on our feature request list. Use ListTool from the Velocity tools project. WILL Withers John Z wrote: I think $arr.size() would return the length of the array. If memory serves, Velocity implements arrays as ArrayList. John Withers -Original Message- From: trad-ex [mailto:[EMAIL PROTECTED] Sent: Thursday, May 25, 2006 1:13 AM To: Velocity Users List Subject: How can I get the length of Array ? Hi all, In the Velocity realm, how can I get the length of Array ? For instance, #set( $arr = __set int[] value__ ) #if( $arr.length 0 ) ...(snip)... $arr.length is always null. Why ? I always use helper Object to avoid this issue. For example, $helperObj.lengthOf( $arr ) This method, lengthOf, is described below: public int lengthOf( Object[] objects ) { if( objects == null) return 0; return objects.length; } Best Regards, trad-ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I get the length of Array ?
That'll teach me to read the question fully before answering... #set($abc = [1,2,3]) actually creates an ArrayList, so any List method-- such as size()-- will work. WILL Townson, Chris wrote: How do you mean, Will? $myArray.class.name returns java.util.ArrayList and $myArray.size() has always worked for me. Chris -Original Message- From: Will Glass-Husain [mailto:[EMAIL PROTECTED] Sent: 25 May 2006 14:50 To: Velocity Users List Subject: Re: How can I get the length of Array ? Not true, though it's on our feature request list. Use ListTool from the Velocity tools project. WILL Withers John Z wrote: I think $arr.size() would return the length of the array. If memory serves, Velocity implements arrays as ArrayList. John Withers -Original Message- From: trad-ex [mailto:[EMAIL PROTECTED] Sent: Thursday, May 25, 2006 1:13 AM To: Velocity Users List Subject: How can I get the length of Array ? Hi all, In the Velocity realm, how can I get the length of Array ? For instance, #set( $arr = __set int[] value__ ) #if( $arr.length 0 ) ...(snip)... $arr.length is always null. Why ? I always use helper Object to avoid this issue. For example, $helperObj.lengthOf( $arr ) This method, lengthOf, is described below: public int lengthOf( Object[] objects ) { if( objects == null) return 0; return objects.length; } Best Regards, trad-ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER: This e-mail is confidential and should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage mechanism. Neither Macmillan Publishers Limited nor any of its agents accept liability for any statements made which are clearly the sender's own and not expressly made on behalf of Macmillan Publishers Limited or one of its agents. Please note that neither Macmillan Publishers Limited nor any of its agents accept any responsibility for viruses that may be contained in this e-mail or its attachments and it is your responsibility to scan the e-mail and attachments (if any). No contracts may be concluded on behalf of Macmillan Publishers Limited or its agents by means of e-mail communication. Macmillan Publishers Limited Registered in England and Wales with registered number 785998 Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com
Re: Static Template Validation?
Elmar, Nice idea. It's been discussed briefly on the list before, but there's no implementation. There's two sides to it. (1) validation of template and (2) performance improvement through compilation. My personal opinion is that validation would be a major benefit, but that compilation may or may not matter. (Performance with Velocity's built in caching system is pretty good). WILL Elmar Jürgens wrote: Hi, I am using Velocity to generate Java classes for a custom target framework (also written in Java). Every time I change my target framework, I have to adapt my velocity templates accordingly. I am looking for a way to statically validate the Java code contained in my velocity templates, in order to automatically find those spots in my templates that I have to adapt to a change in the underlying framework. My first guess at a static template validator would be to somehow transform a Java-generating-template into something one can more or less hand to a Java compiler for static validation. Does something like this already exist? Any other ideas? Any comments, explanations, wild ideas or pointers to additional material very much appreciated! Best greetings, Elmar Juergens - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: macros and out of scope variables
Hi Scott, Only what's defined in the user guide under Velocimacro configuration. I don't think you can enforce this, no. WILL Scott Edward Skinner wrote: Hi Velocity people, Some of the developers I work with have this annoying habit of referencing variables in macros that were not passed to the macros as a parameters. I suppose you could call these global variables and argue that this is perfectly normal, but from my point of view that makes every variable passed from the model to the view a global and why have macro params at all? It's useful to be able to look at a macro's params and know that these represent every external variable the macro needs in order to fulfill its logic responsibilities. So... Is there any way to enforce scope on macros such that they can only reference the params that are explicitly passed to them? S |\_._/| .-. E | o o |_ / / S _.( T ) `./ / ---(((-`-(((- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A 1.5 release date?
Hi Peter, I'll just weigh in with a quick comment or two as I'm working through the weekend to deliver a big project next week. I may not be able to respond later as my email access is limited. We've discussed this on the list before. My take -- Velocity is a mature product, with a released version in use lots of places. For 1.5 we focused on bug fixes (and improvements in error reporting, integration, etc) and it's pretty stable. There's really no important bugs left that haven't been solved-- Look at JIRA and look at the wiki -- there's only a handful of trivial (if subtle) syntax bugs left. (there's an irritating problem with including macros in parsed files too, but it's arguable whether that's a bug or design issue). User support is pretty good -- the lists have far more activity than a classic dormant project. And developers are still around. (Myself, Nathan, Henning are often present on the lists). The major frustration continues to be release - understandably many users expect a released version and we haven't delivered it in a timely manner. Regardless of this fact, there's many users using version 1.4 and some using pre-release 1.5. The software hasn't decayed, it's only gotten better. I don't feel competitive. Everyone has to make their own decisions about whether and how to use Velocity. Like Nathan, I also feel bad about the lack of a release. A week of work and it would be done. But when I have my entire year's salary hanging onto the delivery of a consulting project in May and June, it's hard to set that time aside. The other committers also have significant work and family committments. (what's with all this family stuff, anyway?) I'm reluctant to say anything about timing in public, since I've been wrong before. But I'm betting that I'll have that week in the summer - maybe when I go on vacation :-) best, WILL Peter Harrison wrote: Velocity continues to be one of the primary technologies I use, but there are a few annoying bugs that have been planned for future releases and never made. The point is that without a tight release cycle a open source project will stagnate. The primary problem I see is that any work done in Velocity will not make a release version anytime soon. If I thought that improvements would make it into a release I would have fixed them by now in the original codebase. There are two major bugs I know of: 1. Setting a value to Null is ignored. Yes, I know its in the docs, its been discussed to death here, but has not seen a fix in years, eben though its a consensus that this should not be the right behaviour. . 2. Having a Null in the first object within a list will cause the method cache to fail, and that column will have empty values for every column. There is a nasty work around code in every view for these issues. I am not a newbie, have used Velocity for years, and continue to believe it is better than JSP. However, I would like to see active development, and I am prepared to help so long as I know that the work will actually be released. I'm not being critical for its own sake - I believe in Velocity, and my work depends on it. I would like to see it improved. I would like to take part in that improvement. But I need to know that those who control the process will release my work in a timely manner. Regards, Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: curious about stack trace...
) at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:571) at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:846) at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:345) at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:237) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:240) at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: #include()ed doc not loading
Hi Brian, This is a known issue. Macros can't be written in one file and included with a #parse statement. See this for a summary. http://wiki.apache.org/jakarta-velocity/MacroIssues WILL On 4/25/06, THOMAS, BRIAN M (SBCSI) [EMAIL PROTECTED] wrote: I'm a little fuddled about a macro definition file. The Velocity engine is running in a Tomcat server (XWiki, actually) and I have a Velocity macro defined in a wiki document which is included in another wiki document which also calls it. The problem is that after the wiki restarts, the macro definition file is not loaded - or at least, the macro definition is not placed into the context - as evidenced by Velocity rendering the call instead of its execution. Its argument is expanded, so that it's plain that it is being rendered. What usually fixes it is when one of us opens the file explicitly, or saves it. I'm not at all certain that this is a Velocity problem, but I'd like to know if there's a way to learn whether an #include directive has failed, other than to note that the macro is undefined...? brain[sic] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Escaping double quote characters during variable substitution?
In the latest unreleased version in source control, there's are event handlers to escape HTML, Javascript, etc. I should have docs posted in the next day or so. WILL On 4/24/06, Joe Desbonnet [EMAIL PROTECTED] wrote: I've forms with velocity lines like this: input type=text name=myparam value=$myBean.getName() / Occasionally myParamValue will contain a double quote character which causes HTML parsing problems. I could of course define some object with a filter method and include it in the velocity context ... eg: input type=text name=myparam value=$filterObject.escapeQuotes($myBean.getName()) / but this is rather messy. Is there a way to put all variable substitutions through a filter? Or any other elegant solutions? Thanks, Joe. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to find vm location in a velocity application jar
Have you looked into the JarResourceLoader or (my favorite) the ClasspathResourceLoader? http://jakarta.apache.org/velocity/docs/developer-guide.html#Resource%20Loaders WILL On 4/23/06, Son Juhee [EMAIL PROTECTED] wrote: hi, I'm developing a simple code-generator program using velocity. I'll distribute this as a jar (including java main- class and vm files ) to developers. A problem is the location of vm files.. generator.jar! main.java vm/ aaa.vm bbb.vm in this structure, how can I find the path of vm files? property.setProperty( file.resource.loader.path, ../vm ); Velocity.init(property); = doesn't work.. it searches for the where javaw executed../vm NOT INSIDE JAR!! I cannot use an absolute path, because vm files are inside jar and I don't even know where developers will put the jar !! is there any way to use ../.. path to access vm files inside jar?? please help.. any help will be appreciated! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: Can velocity load a properties file ?
Hi Trad-Ex, Far be it from me to dictate how to develop your app. But I tend to avoid reflection in Velocity for the following reasons: -- It's a complex syntax, easy to mess up, hard to read, hard to debug. -- There's a much simpler alternative (putting objects and methods directly in the context). -- This is actively dangerous for cases in which third parties submit templates as they have full acess to files and other resources on your machine Velocity works well as a markup language where text is directly inserted in a template via properties or method calls. Such templates are easy to use and easy to maintain. If you need a scripting or programming language there are much better alternatives. best, WILL On 4/20/06, trad-ex [EMAIL PROTECTED] wrote: Hi Barbara, Hi Will, Thanks a lot for your response. As Will says, #set can make any class objects. In fact, I often make instances of ArrayList, and use them. But I think whether there are tools like org.apache.velocity.tools. struts.MessageTool or not. I will follow Will's advice to implement methods like $util. getPropertyResourceBundle( path ) in $util. BTW, why do you propse to limit to use reflection ? It's a powerful way to provide such availability into velocity realm, I guess. Would you mind asking you for reasons ? Best Regards, trad-ex Are you sure? I think #set can be used for any class. I've proposed to limit this to prohibit reflection by default (such as what trad-ex is doing), but we haven't applied the patch yet. WILL On 4/20/06, Barbara Baughman [EMAIL PROTECTED] wrote: You cannot use the #set directive to designate just any kind of JAVA object. See the User Guide for allowable references. I believe the #set directive you have will automatically call the toString method of the class in order to set the variable to a valid reference, but you can check by printing the value of the set variable. Barbara Baughman X2157 On Thu, 20 Apr 2006, trad-ex wrote: Hi All, I tried to load property resource bundle file, but failed to get an instance of FileInputStream. My code is below: #set( $fStreamClass = $util.class.forName(java.io.FileInputStream) ) #set( $iStreamClass = $util.class.forName(java.io.InputStream) ) #set( $stringClass = $util.class.forName(java.lang.String) ) #set( $bundleClass = $util.class.forName(java.util.PropertyResourceBundle) ) #set( $userNameFilePath = $util.getPortalFile($userNameFile) ) #set( $resStream = $fStreamClass.getConstructor( [$stringClass] ) .newInstance( [$userNameFile] ) ) #set( $resBundle = $bundleClass.getConstructor( [$iStreamClass] ) .newInstance( [$resStream] ) ) $util object is provided by our application to inject functionality into velocity context. I succeeded to get $fStreamClass $iStreamClass $bundleClass But I failed to get $resStream $resBundle. My questions are: 1. Can I load the specific property file in Velocity context ? 2. What's wrong with my velocity script ? Best Regards, and thanks in advance. trad-ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: Can velocity load a properties file ?
Ugh. Using reflection in Velocity to create a new class is a pretty messy kludge. Would it be possible just to create a method in $util that loads this, e.g. $util.getPropertyResourceBundle? WILL On 4/20/06, trad-ex [EMAIL PROTECTED] wrote: Hi All, I tried to load property resource bundle file, but failed to get an instance of FileInputStream. My code is below: #set( $fStreamClass = $util.class.forName(java.io.FileInputStream) ) #set( $iStreamClass = $util.class.forName(java.io.InputStream) ) #set( $stringClass = $util.class.forName(java.lang.String) ) #set( $bundleClass = $util.class.forName(java.util.PropertyResourceBundle) ) #set( $userNameFilePath = $util.getPortalFile($userNameFile) ) #set( $resStream = $fStreamClass.getConstructor( [$stringClass] ) .newInstance( [$userNameFile] ) ) #set( $resBundle = $bundleClass.getConstructor( [$iStreamClass] ) .newInstance( [$resStream] ) ) $util object is provided by our application to inject functionality into velocity context. I succeeded to get $fStreamClass $iStreamClass $bundleClass But I failed to get $resStream $resBundle. My questions are: 1. Can I load the specific property file in Velocity context ? 2. What's wrong with my velocity script ? Best Regards, and thanks in advance. trad-ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: Private fields and methods in ResourceLoader
That sounds interesting. Did you remember to call VelocityEngine.init() or Velocity.init() before parsing a template? WILL On 4/20/06, Tim Pizey [EMAIL PROTECTED] wrote: Hi, I have been trying to write a ResourceLoader, initially a FileResourceLoader, but found that I could not extend FileResourceLoader as the members and findTemplate method are private. This has forced me to a more general solution, where I have a ResouceLoader which is a decorator to any other and takes the InputStream returned, converts it to a String, does Perl5 substitutions on it and then converts the String back to an InputStream. My code is at work but from memory I do something like public abstract class WebMacroResourceLoader extends ResourceLoader { private ResourceLoader loader ; public void init( ExtendedProperties configuration) { loader.init(configuration); } public InputStream getResourceStream(String templateName) { if (templateName.endsWith(.wm) { // mugle about with Perl5 // return new input stream } else return loader.getResourceStream(templateName); } } public class WebMacroClasspathResourceLoader extends WebMacroResourceLoader { public WebMacroClasspathResourceLoader() { this.loader = new ClasspathResourceLoader(); } } public class WebMacroFileResourceLoader extends WebMacroResourceLoader { public WebMacroClasspathResourceLoader() { this.loader = new FileResourceLoader(); } } Mine feels like a not-unusual requirement, is my approach sensible? PS Any idea why I am getting NPE thrown from the init method? yours Tim Pizey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: Can velocity load a properties file ?
Are you sure? I think #set can be used for any class. I've proposed to limit this to prohibit reflection by default (such as what trad-ex is doing), but we haven't applied the patch yet. WILL On 4/20/06, Barbara Baughman [EMAIL PROTECTED] wrote: You cannot use the #set directive to designate just any kind of JAVA object. See the User Guide for allowable references. I believe the #set directive you have will automatically call the toString method of the class in order to set the variable to a valid reference, but you can check by printing the value of the set variable. Barbara Baughman X2157 On Thu, 20 Apr 2006, trad-ex wrote: Hi All, I tried to load property resource bundle file, but failed to get an instance of FileInputStream. My code is below: #set( $fStreamClass = $util.class.forName(java.io.FileInputStream) ) #set( $iStreamClass = $util.class.forName(java.io.InputStream) ) #set( $stringClass = $util.class.forName(java.lang.String) ) #set( $bundleClass = $util.class.forName(java.util.PropertyResourceBundle) ) #set( $userNameFilePath = $util.getPortalFile($userNameFile) ) #set( $resStream = $fStreamClass.getConstructor( [$stringClass] ) .newInstance( [$userNameFile] ) ) #set( $resBundle = $bundleClass.getConstructor( [$iStreamClass] ) .newInstance( [$resStream] ) ) $util object is provided by our application to inject functionality into velocity context. I succeeded to get $fStreamClass $iStreamClass $bundleClass But I failed to get $resStream $resBundle. My questions are: 1. Can I load the specific property file in Velocity context ? 2. What's wrong with my velocity script ? Best Regards, and thanks in advance. trad-ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: Cleaned the PoweredByVelocity WikiPage
Thanks! Good idea to remove dead sites. I'd give people the benefit of the doubt whether they use Velocity or not. It's hard to tell from just looking at a site. (for example, one of mine has all .htm extensions). WILL On 4/16/06, Dominik Bruhn [EMAIL PROTECTED] wrote: Hy, I just cleaned the PoweredByVelocity Page in the Velocity-Wiki: http://wiki.apache.org/jakarta-velocity/PoweredByVelocity I threw out alle links not working anymore or definitly not showing the descirved Content anymore (Domain-Sell-Pages). I left thos pages in which don't seem to use velocity (anymore) because I don't want to decide this. If anybody got any Problems with these Steps he/she might revert all the changes. Greetings Dominik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Updated SilentParseInclude
Chris, Thanks for contributing this. Do you want to edit the Wiki so this can be preserved? WILL On 4/14/06, Townson, Chris [EMAIL PROTECTED] wrote: Okay, fixed for me ... Needed to change scope in toolbox and method to templateExists() In TemplateExistsTool.exists(), change this: return this.engine.resourceExists(template); To this: return this.engine.templateExists(template); And in toolbox.xml, change this: scopeapplication/scope To this: scoperequest/scope Anyone else encountered similar? C -Original Message- From: Townson, Chris [mailto:[EMAIL PROTECTED] Sent: 14 April 2006 15:01 To: velocity-user@jakarta.apache.org Subject: Updated SilentParseInclude Hi, I just noticed Shinobu's updated version of the Fred Toth's TemplateExistsTool for the VelocityViewServlet in Velocity Tools v.1.2 (details on wiki here: http://wiki.apache.org/jakarta-velocity/SilentParseInclude) This updated class doesn't seem to work for me (using tools 1.2 and velocity 1.4 ... i.e. current release versions, not dev tree) The problem originates with the new exists(String template) method: this uses the resourceExists() method which exists for org.apache.velocity.app.Velocity (in favour of the deprecated templateExists()), but not for org.apache.velocityapp.VelocityEngine (which only has the templateExists() method ... Not deprecated). I am therefore getting a java.lang.Error because the resourceExists() is undefined for VelocityEngine. Changing resourceExists() to templateExists() results in NullPointerException. Can anyone tell me what is going on here? Cheers, Chris ** ** DISCLAIMER: This e-mail is confidential and should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage mechanism. Neither Macmillan Publishers Limited nor any of its agents accept liability for any statements made which are clearly the sender's own and not expressly made on behalf of Macmillan Publishers Limited or one of its agents. Please note that neither Macmillan Publishers Limited nor any of its agents accept any responsibility for viruses that may be contained in this e-mail or its attachments and it is your responsibility to scan the e-mail and attachments (if any). No contracts may be concluded on behalf of Macmillan Publishers Limited or its agents by means of e-mail communication. Macmillan Publishers Limited Registered in England and Wales with registered number 785998 Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS ** ** DISCLAIMER: This e-mail is confidential and should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage mechanism. Neither Macmillan Publishers Limited nor any of its agents accept liability for any statements made which are clearly the sender's own and not expressly made on behalf of Macmillan Publishers Limited or one of its agents. Please note that neither Macmillan Publishers Limited nor any of its agents accept any responsibility for viruses that may be contained in this e-mail or its attachments and it is your responsibility to scan the e-mail and attachments (if any). No contracts may be concluded on behalf of Macmillan Publishers Limited or its agents by means of e-mail communication. Macmillan Publishers Limited Registered in England and Wales with registered number 785998 Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Switching from PHP to Java/Velocity, Performance?
One of the things I like about Hibernate is that it has request-level caching automatically. In other words if you read and write to the database within a single request, that will only hit the database once. It also organizes queries and minimize them. Another point - if you do clustering you might consider a stateless app. (This is very common for PHP). This solves a lot of the session cluster problems. WILL On 4/13/06, Florin Vancea [EMAIL PROTECTED] wrote: Yes, that's what I knew. But that's 1.1. Check http://ehcache.sourceforge.net/ Scroll down to 26 March 2006 1.2 beta 5 released - Original Message - From: Dominik Bruhn [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Thursday, April 13, 2006 5:15 PM Subject: Re: Switching from PHP to Java/Velocity, Performance? Hy, I read the following: 5 Distributed Caching Ehcache is not a distributed cache. There are no plans to make it a distributed cache. The key design goals of ehcache are simplicity and provability. Adding a distribution mechanism to ehcache conflicts with those goals. Moreover, a requirement for distribution is far less common than for requirements such as memory and disk storage. http://ehcache.sourceforge.net/documentation/documentation-1_1.html#mozTocId763298 Where did you take the information about the distribution-feature from? Thanks TO Am Thursday 13 April 2006 16:10 schrieb Florin Vancea: Yes, easily. You'll find it in docs. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Switching from PHP to Java/Velocity, Performance?
Stateless means that there is no in-memory user session. Track the user id in a cookie and retrieve any relevant info from the database each request based on the user id and URL parameters. This works well for simple apps which don't need to remember much info from page to page (I think of Flickr where most stuff is driven by URLs). The advantage of that without a user session in memory, you can send the user request to any server in your cluster. Not a requirement (there's other ways to handle this problem) but just an idea. You'll still need to use a cluster-based cache for database queries. This is where a lot of the performance savings can come in. Possibly you'd use an abstraction layer (like Spring or Hibernate) that will let you change cache systems from a single server cache to a clustered cache when you need to. WILL On 4/13/06, Dominik Bruhn [EMAIL PROTECTED] wrote: Hy, what does stateless mean? Does it mean that you don't save data between requests? So no caching? Thanks Dominik Am Thursday 13 April 2006 17:07 schrieb Will Glass-Husain: Another point - if you do clustering you might consider a stateless app. (This is very common for PHP). This solves a lot of the session - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Switching from PHP to Java/Velocity, Performance?
Hi Dominik, Wow, that's a busy site. The short answer is that writing a high performance application is mostly about architecture and only partially about language. If you read the pages and pages of comments on that famous post, the intelligent comments mostly boil down to that response. Caching is critical, (for both database queries and page generation), as is good database design. Velocity is unlikely to be a significant part of your bottleneck as performance with template caching turned on is quite fast. WILL On 4/12/06, Dominik Bruhn [EMAIL PROTECTED] wrote: Hy, I currently got a online-community running on a PHP-Bulletin-Board-Software. I didn't write the software myself but I modified it over the time so the code grew and became quite unreadable, hard to understand and also slow. Some data for the site: 300Users online at the same time 30661 visitors per day 10GB Traffic per day The site is currently running on two servers, one for the dynamic PHP-Scripts and one for the Database (MySQL) and the static content. I was thinking about a complete rewrite for a long time and now I started to plan it more detailed. As I have used Velocity and Java for another (but quite small) project this was what first came into my mind. I also hoped for some speed increases from a Java-Application due to the fact that is possible to cache the Data-Base Data and save Queries to the DB. I'm also thinking about the time when there might be more than one server needed for the site (due to increasing visitors). My PHP and Java knowledeges are about equal, but I have never done such a big project in Java (neither in PHP) and so i'm searching for help. On my search through the internet I found a webpage where they told that friendster (really big site) switched from java to PHP due to performance. This made me think about my decision. http://troutgirl.com/blog/index.php?/archives/22_Friendster_goes_PHP.html I fear programming the whole Website in Java and then recognizing that its much to slow for this purpose. Thats why I write to this mailinglist. Are there any people who made a similar step from php to java and can tell about performance gains or looses. Can anybody else tell me where there are differences and how the influence the performance. Thanks TO - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Switching from PHP to Java/Velocity, Performance?
Oh, no. Here come the religious arguments. Although you'll likely find more Java than PHP programmers on this list! To be fair, although I'm a Java programmer I attended a compelling presentation on designing scalable apps with PHP. (Taught by Cal Henderson of Flickr). So, I'm wary of blanket statements condemning scripting languages or PHP. http://www.carsonworkshops.com/dev/henderson/20JUN2005_photos.html Anyone have good practical resources/articles on scalable web app design to point Dominik towards? WILL On 4/12/06, Peter Harrison [EMAIL PROTECTED] wrote: Dominik Bruhn wrote: Hy Will, thanks to your response. My question was not only concerning Velocity but also about Java in General in Comparison to PHP. I hope that there are some Developers who have user Java and Velocity in realy huge sites. You must also consider complexity. If you have a site which is simple then PHP will probably be fine, even under heavy load. However, if your application is complex then Java shows its mettle. You *can* write nice PHP code, but it requires a disciplined developer. You can also write horrible Java code, although its less permissive about what it allows at compile time (strong typing). The point is that each language has its role, and I think blanket statements like PHP is not a language are not helpful. Python for example is a great language, and we have used it several times to develop quick solutions that would have been substantially more difficult in Java. However, with the infrastructure around Java/Struts/Velocity the actual code you have to write is greatly reduced, and whats left is simplified. For web apps Java/Tomcat/Struts/Velocity remains a credible and effective solution. The downside to Java I feel is a pretty long learning curve compared to other languages. It is certainly more verbose, and has quite a few elements that make life complex. PHP and Python on the other hand have not developed the same infrastructure to date, although if you want a CMS there are many options that will be a good start. As for performance, I must agree that performance is a question of architecture and complexity. Complex applications will be slower because they need more DB time and more CPU. The best way to handle this is - as a previous poster said, keep everything cached where possible, hit the db the least possible, and keep the architecture open so you can deploy multiple web servers as part of a cluster. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting the protocol of actual page
Hi Gustavo, It depends what is in the context. If you have the HTTPRequest object in the context with the name request, then $request.getScheme() is exactly right. Are you using VelocityViewServlet, VelocityServilet or some other servlet? WILL On 4/11/06, GB Developer [EMAIL PROTECTED] wrote: $request.getScheme() ? -Original Message- From: Gustavo Straube Pereira [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 11, 2006 1:02 PM To: Velocity Users List Subject: Getting the protocol of actual page Hi, I want to know if actual page is secure or insecure, then how can I get the protocol (http or https) of actual page? Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: UTF8-Enconding in Macros
Hi, A quick look at the source suggests this isn't currently possible. Anyone else have any ideas on this? If you'd care to file a JIRA issue on this we'll probably add this capability. It seems an obvious miss. http://issues.apache.org/JIRA Best, WILL On 4/8/06, Dominik Bruhn [EMAIL PROTECTED] wrote: Hy, I encode all my templates in UTF-8, and I load them via getTemplate(frame.vm,UTF-8); I also use some macros, all of them are written in the VM_global_library.vm which Velocity loads at startup. The Problem is: This library isn't loaded with UTF8 encoding. How can I change this? Thanks TO - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using Velocity in an untrusted environment
] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using Velocity in an untrusted environment
PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using Velocity in an untrusted environment
Hi Ben, You probably don't have an issue with #include though it depends how you organize the templates. In our case, I load templates specific to a given user via part of the path, e.g. /will/abc.htm. Hence we needed an event handler to decide if you have permission to include the files or not. If you don't indicate user specific info on the path you're likely ok. It's probably pretty obvious whether this is the case or not. In regards to unescaped HTML, do a Google search on Cross-Site Scripting. Esentially, the issue is that if user A can insert text that appears on User B's screen, you need to prevent that text from including arbitrary HTML or JavaScript. The easiest way to do this is to convert all entities (e.g. into lt;). I'll have to think about the rendering cost issue. I agree with Nathan in that I'm reluctant to add a lot of complexity to the core to address this. I suggest either putting such code in a custom plugin (e.g. the ReferenceInsertEventHandler) that checks for resource activity and throws a RuntimeException if appropriate, or adding such a routine externally to Velocity in some type of thread handler. (e.g. it launches Velocity in a thread and kills the thread if it takes too long -- is that possible? I'm not a thread guru). Best, WILL On 4/6/06, Ben [EMAIL PROTECTED] wrote: Thanks Will, I appreciate your response. Two more questions though, in my project the templates are kept inside a MySQL database and are loaded by a custom class from there, does this mean I don't have to worry about the #include and the #parse loading another user's templates, since they only load them from a directory on the hard-drive? Also I dont' fully understand the problem of unescaped HTML inside the templates, what kind of issues can be expected from that in my case, where users are allowed to upload their own templates anyway, or it only applies in a case where they don't have permission to do this? I'll be happy to share my solution about interrupting the rendering process, if I come up with a generic way which can be applied to other projects besides mine. Ideally I would like this to be a function of Velocity itself, where for every operation it does it would assign some number, which would be the cost of that operation, and then the developer would have the ability to set the maximum cost, after which velocity would automatically interrupt the rendering process. Another option would be for it to save the starting date/time of the rendering process, and then every now and then to check how much time has passes, and if the time limit has expired to interrupt the rendering process. I am not sure I have sufficient understanding of the Velocity source code to do this though, can anybody who knows the Velocity code well tell me if any of these two options are feasable, and if yes, what class/classes would I need to modify for this? Thanks, Ben - Original Message - From: Will Glass-Husain [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Thursday, April 06, 2006 4:39 AM Subject: Re: using Velocity in an untrusted environment Hi Ben, I run a web site with some hundreds of users who upload their own Velocity templates. It works pretty well. We've tried to address most security-related issues, but so far we've just ignored the potential DenialOfService issue and haven't had any trouble. As far as the classloader patch goes, you can put it into a custom Uberspector and use it right now. A little complicated, but it works. Some of the other items in the article have been fixed. The current source control head contains an Event Handler which can automatically escape HTML. There's also a new event handler that can be used to modify #include and #parse (say, to prevent one user from including files of another user). In Tomcat you can set up catalina.policy to restrict access to files outside the webapp using the Java security manager. It takes a little trial and error to get this right. Most third-party libraries (e.g. Velocity, Hibernate, etc.) require certain permissions and these are almost never documented. I can share mine if that's helpful although it's pretty specific to my apps. Finally, you need to be very careful as to what you put in the context. Any methods that allow access to files, databases and other resources are actively dangerous. WILL On 4/5/06, Nathan Bubna [EMAIL PROTECTED] wrote: Well, this is really more Will's area of expertise. I have the luxury of not letting users of my apps define their own templates. So, i've not had any need to use a JavaSecurityManager. The language in the article is a little unclear. Version 1.6 has not started development yet. We are still tweaking 1.5 in our collectively scarce free time. It's more that the patch in question has been put on the roadmap for 1.6. In the meantime, the info and references
Re: using Velocity in an untrusted environment
Thanks - let us know what you find... On 4/6/06, Ben [EMAIL PROTECTED] wrote: Thanks for pointing the way, I'll definitely take a look at the SimpleNode class and see if it can be used for my purpose. I don't want to use a separate thread since by me the render function is called from within a servlet running inside resin, so what i'll probably do is have it check the time, let's say every 10,000/100,000/1,000,000 loops or so, depending on how many loops it does per second, and if it's past the time limit stop the render process, or maybe just limit the rendering process to a certain amount of loops, to prevent people from writing templates with a near infinite loop. I do some work with Yahoo's RTML scripting language, which is being interpreted by a perl script running on Yahoo's servers, and I think that's what Yahoo does, limit the loops to 10,000,000 iterations or so. If people are interested I can paste the results of my experiment when I am done, as well as any modifications I make. Hmm. To be honest, I'm not interested in having this be an out-of-the-box piece of Velocity. Adding this maximum cost option for every operation it does would mean a performance hit, a big rise in complexity, or both. I would want to see a lot of interest in this from others before i would let this change go through without vetoing it. I really don't think this is something most of our users want or need. No one else has asked for it (to my memory) in the five years i've been around. For you, however, it ought to be fairly easy straightforward to create a VelocityRunnable that you can start in a new Thread to do the template merge/render and then have the request thread check up on it (sleeping in between checks, of course) periodically. The tricky part is stopping the rendering thread when it goes over time. It's not really safe to use the deprecated Thread.stop() method. The recommended replacement (http://java.sun.com/j2se/1.4.2/docs/guide/misc/threadPrimitiveDeprecation.html) is to create velocityRunnable.stop() method that can flip a flag to interrupt the rendering. But Velocity doesn't have any built in way to *interrupt* the rendering. The only thing i'm aware of is the #stop directives ability to make Velocity stop sending output to the writer. So far as i know, it doesn't actually stop the template processing (personally, i think it'd be better if it did). To actually stop template processing, you will probably have to alter some of the internals yourself. The driver of the rendering process is a simple for() loop in the render(context, writer) method of the SimpleNode class. all the nodes extend this class, so this method is how the AST is traversed. I would imagine that the real way to do this would be to somehow put the flag in that for() loop's conditional that would be shared by all nodes in that template. That probably means you need a flag that resides in the context that's being passed around. When the flag is tripped, no further nodes should be rendered. Of course, i'm not 100% sure that that is all you'll need to change, and it also might not catch all possible problems. For instance, if it is the rendering of a particular leaf on the AST that is taking forever, then this won't stop that node's rendering; it would only stop further traversal of the tree. Still, that is hopefully enough info to get you started... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Velocity vs. WebMacro performance
:www.coretrek.no Simple is beautiful -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Missing inequality in VTL documentation
Turns out we already fixed this for 1.5. Thanks for reporting it though! WILL On 3/29/06, Will Glass-Husain [EMAIL PROTECTED] wrote: Thanks for catching this. We'll fix it in the next release. Best, WILL On 3/29/06, Mike Bridge [EMAIL PROTECTED] wrote: One of our designers was confused by the lack of an inequality operator in the VTL documentation at: http://jakarta.apache.org/velocity/docs/vtl-reference-guide.html I think the following lines are missing from the if/then/else section: Not Equal to Number: #if( $foo != 42 ) Not Equal to String: #if( $foo != bar ) Thanks, -Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Trouble using TexenTask
That's strange. Is there the same problem with the vanilla Texen task? I don't see any obvious gotchas. (though I'm not a regular Texen user). WILL On 3/29/06, Philip A Grim II [EMAIL PROTECTED] wrote: Greetings, I have been using Velocity to generate code for quite some time now, but I've tried something for the first time recently and it's not working. I have a class that derives from TexenTask that I call from Ant that invokes my code generation system. I set the templatePath property on the task to point to one directory, call the task a number of times (which all work fine) then call the task with a different templatePath and it fails saying that the control template cannot be found. The output from ant -debug shows the task claiming to use the templatePath that I set, and the control template exists on that path, so I don't understand what the problem is. Here is an example: fomgen controlTemplate=cppPCOMFileIncludeControl.vm outputDirectory=${cpp.om.path} templatePath=${cpp.template.path}/PCOM // This one works outputFile = build.log / fomgen controlTemplate=cppPluginControl.vm outputDirectory=${cpp.plugin.path} templatePath=${cpp.template.path}/RTI1_3 // This one fails outputFile = build.log / If I reorder the tasks to call the broken one first and the working one second, the error moves...in other words, the first one I call always works, and the second always fails. Here is the error from velocity.log: Wed Mar 29 11:30:49 EST 2006 [error] ResourceManager : unable to find resource 'cppPluginControl.vm' in any resource loader. I'd appreciate any insight you could offer. Thanks. Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Trouble using TexenTask
Thanks. In fact, if you care to take the trouble, you should open up a bug report at http://issues.apache.org/jira and attach the test case. This will help us track the issue and resolution. Otherwise if you post the code I'll open it up. Best, WILL On 3/30/06, Philip A Grim II [EMAIL PROTECTED] wrote: Yes, I put together a trivial test case using just the vanilla TexenTask and a couple of little templates and the behavior is the same...if you change the template path and call the task again, it fails, even though the new path is valid and the control template exists. I can send you a tar file with my test case if you want it. Phil On Thu, 2006-03-30 at 01:21 -0800, Will Glass-Husain wrote: That's strange. Is there the same problem with the vanilla Texen task? I don't see any obvious gotchas. (though I'm not a regular Texen user). WILL On 3/29/06, Philip A Grim II [EMAIL PROTECTED] wrote: Greetings, I have been using Velocity to generate code for quite some time now, but I've tried something for the first time recently and it's not working. I have a class that derives from TexenTask that I call from Ant that invokes my code generation system. I set the templatePath property on the task to point to one directory, call the task a number of times (which all work fine) then call the task with a different templatePath and it fails saying that the control template cannot be found. The output from ant -debug shows the task claiming to use the templatePath that I set, and the control template exists on that path, so I don't understand what the problem is. Here is an example: fomgen controlTemplate=cppPCOMFileIncludeControl.vm outputDirectory=${cpp.om.path} templatePath=${cpp.template.path}/PCOM // This one works outputFile = build.log / fomgen controlTemplate=cppPluginControl.vm outputDirectory=${cpp.plugin.path} templatePath=${cpp.template.path}/RTI1_3 // This one fails outputFile = build.log / If I reorder the tasks to call the broken one first and the working one second, the error moves...in other words, the first one I call always works, and the second always fails. Here is the error from velocity.log: Wed Mar 29 11:30:49 EST 2006 [error] ResourceManager : unable to find resource 'cppPluginControl.vm' in any resource loader. I'd appreciate any insight you could offer. Thanks. Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Missing inequality in VTL documentation
Thanks for catching this. We'll fix it in the next release. Best, WILL On 3/29/06, Mike Bridge [EMAIL PROTECTED] wrote: One of our designers was confused by the lack of an inequality operator in the VTL documentation at: http://jakarta.apache.org/velocity/docs/vtl-reference-guide.html I think the following lines are missing from the if/then/else section: Not Equal to Number: #if( $foo != 42 ) Not Equal to String: #if( $foo != bar ) Thanks, -Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ternary operator
I don't think this is supported. On 3/28/06, Michael Fortin [EMAIL PROTECTED] wrote: Hello, Is it possible to use the ternary operator in a set directive? I tried the fallowing set directive but it didn't work, is there an alternative way to do this without and if else statement? #set($test = $command == null ? 'its null' : 'not null') $test thanks, Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Macro not executed on first load
Hi Gunnar, This is a known bug. See https://issues.apache.org/jira/browse/VELOCITY-146 Best advice - don't define a in a parsed file and use it in the main file. You might also try the config setting velocimacro.permissions.allow.inline.local.scope WILL On 3/28/06, Gunnar Wagenknecht [EMAIL PROTECTED] wrote: Hi! I've defined a macro in a file that is included in a template using #parse. On the first page load the macro call is not executed but printed as is. If I reload the page immediately it works as desired. Any ideas? Cu, Gunnar -- Gunnar Wagenknecht [EMAIL PROTECTED] http://wagenknecht.org/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: #parse expensive ?
Hi Andrew, I don't have much specific feedback on this, except be sure template caching is turned on. Otherwise, performance testing is the key. If you find anything useful, let us know! WILL On 3/24/06, Andrew Mason [EMAIL PROTECTED] wrote: Hi guiys, Just wondering how expensive a #parse() is in terms of time taken to render a page? I have a few servlets which take between 12-18 ms to do the getTemplate() method. I'm not sure if this is extremely fast for the amount of work it's doing or about average or slow. The getTemplate() function seems to be the most time consuming thing the servlet is doing, the rest combined is between 4-6ms The servlet isn't particularly slow but I am always looking for ways to speed things up. Are there operations that I should avoid in the templates. kind regards Andrew M - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to stop a loop (#foreach)
There's no break or continue statement. You need to use an inner #if statement that only evaluates for the first X elements. WILL On 3/22/06, Pham Anh Tuan [EMAIL PROTECTED] wrote: Hi all, I don't know how we can stop a loop or #foreach? help me plz thanks in advance bowlkhin -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Collect variables from a template
Ok, glad you will be able to get your needs met. WILL On 3/22/06, Holger Willebrandt [EMAIL PROTECTED] wrote: Der Will, I'm sorry that i can't give you results of testing with 1.5-dev, as i didn't manage to get velocity-1.5-dev compiled yet. Should I take it from the snapshosts or is there a 1.5-dev jar ? I need to get this working and can't spent much time on experiments. I took a look at the TemplateTool and it seems to be suitable (Thanks, Claude), so i for myself am through with this issue ;-) Thanks for your replies. Holger Will Glass-Husain wrote: Also, have you tried this with the latest source code? (velocity 1.5dev)? If so, can you give us the exception trace with the latest source? WILL On 3/15/06, Claude Brisson [EMAIL PROTECTED] wrote: Hi. Maybe you can check the TemplateTool in the experimental section : http://svn.apache.org/repos/asf/jakarta/velocity/engine/trunk/experimental/templatetool/TemplateTool.java Claude Le mercredi 15 mars 2006 à 11:07 +0100, Holger Willebrandt a écrit : - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: confusion regarding velocity versions...
Whoops! The home page is wrong. The current version is 1.4. The patch is in the as-yet-unreleased-1.5 (along with numerous other new features). This can be downloaded (source) at http://svn.apache.org/snapshots/jakarta-velocity/ For info on building, see http://jakarta.apache.org/velocity/build.html And feel free to ask for help on the list. WILL On 3/16/06, Piyush Purang [EMAIL PROTECTED] wrote: I am very interested in the http://issues.apache.org/bugzilla/show_bug.cgi?id=17379 being fixed. Bug status shows taht it'll be fixed for 1.5 eventhough the patch is in. I went on looking for a milestone build but couldn't find any. http://jakarta.apache.org/velocity/ goes on to state that the The current release version is version 1.5. which is followed by a link http://jakarta.apache.org/site/downloads/downloads_velocity-engine.cgithat isn't found (404). Maven ditribution and http://jakarta.apache.org/site/downloads/downloads_velocity.cgi only provide 1.4 release. I hope someone fixes the error on the homepage or relases 1.5... I'd rather see the second happening ;) Cheers Piyush PS - Anywhere I could find a recent build? -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: Collect variables from a template
Also, have you tried this with the latest source code? (velocity 1.5dev)? If so, can you give us the exception trace with the latest source? WILL On 3/15/06, Claude Brisson [EMAIL PROTECTED] wrote: Hi. Maybe you can check the TemplateTool in the experimental section : http://svn.apache.org/repos/asf/jakarta/velocity/engine/trunk/experimental/templatetool/TemplateTool.java Claude Le mercredi 15 mars 2006 à 11:07 +0100, Holger Willebrandt a écrit : Hello everybody, i would like to parse a velocity template and collect information about all variables that are used within it. Therefore, i use the Parser class in the following way: //here a reader for the template and a collector for the variables //will be supplied public static void findVariables(Reader reader, List collector) throws ParseException { VelocityCharStream cstream = new VelocityCharStream(reader, 0, 0); Parser parser = new Parser(cstream); findVariables(parser.process(), collector); //call method below } //this method will recursively collect the variables and store them //in the collector. public static void findVariables(Node startNode, List collector) { if (startNode.getClass().equals(ASTReference.class)) { if (!collector.contains(startNode.literal())) { collector.add(startNode.literal()); } } for (int i = 0; i startNode.jjtGetNumChildren(); i++) { findVariables(startNode.jjtGetChild(i), collector); } } The code is working as long as the template does not contain a #foreach statement. Whenever i try to parse velocity code with a #foreach, i get the following error: java.lang.NullPointerException at org.apache.velocity.runtime.parser.Parser.Directive( Parser.java:628) at org.apache.velocity.runtime.parser.Parser.Statement( Parser.java:319) at org.apache.velocity.runtime.parser.Parser.process( Parser.java:258) Looking into velocity's source code, revealed that the Parser is missing a RuntimeServices instance, resp. a template name. It would be nice to have a way of collecting all variables and validating the synatx (a ParseException would indicate a syntax error) at once. Any kind of help or advice is welcome. Thanks, Holger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: Features
Hey, just a quick comment. Check the velocity-user archives for extensive velocity versus freemarker conversation. This has been hashed to death here in previous months... might be more productive to take the FreeMarker specific part of the conversation to the FreeMarker list. WILL On 3/10/06, jian chen [EMAIL PROTECTED] wrote: Hi, Jonathan, I am a bit sad to see that the Velocity project hasn't been that active these days, particularly with the much needed enhancements still pending. However, I just don't like FreeMarker for the following major reasons: 1) FreeMarker tags look similar as html tags. 2) Too much feature in FreeMarker. The template engine language should be succinct. Otherwise, it might give people too much flexibility in templating. I would hope to have a better version of Velocity though, with the bug fixes and correct feature enhancements. Jian Lead Developer, Seattle Lighting On 3/10/06, Jonathan Revusky [EMAIL PROTECTED] wrote: Jurica Viskovic wrote: Will , thanks! Last night i looked at source to see how to simply implement those new features, but it seems it will not be as easy as i thought. The fact is that if nobody even gives you any pointers as to where to look, where the crucial points in the code are, it's not generally going to be easy. Some people are surely better at this than others, but I personally find it very hard to get into an unfamiliar codebase and understand the mind behind it. I think it's only fair to tell you and anybody else interested in having macros work this way, that this is already available in FreeMarker. For example, if I define a macro as follows: #macro foo bar baz=some default value ... /#macro it can be invoked with either one or two arguments. The baz argument reverts to the default value when it is invoked with just one argument. Macros with can be invoked with the parameters by name, as in: @foo bar=arg1 baz=arg2/ If I listed all the other other goodies in FreeMarker's macro system that are not present in Velocity, this message would get quite long. See: http://freemarker.org/docs/dgui_misc_userdefdir.html These features have been present in FreeMarker for 3 years or more and many people use this stuff in production and it is highly stress tested. An existing mature tool that already has the features you want is likley to be a better technical solution. Jonathan Revusky -- lead developer, FreeMarker project, http://freemarker.org/ Anyway i will forward this discussion on developers mailing list. Regards, jure - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: problem loading templates
A snapshot of the (unreleased) Velocity 1.5 code is available here. http://svn.apache.org/snapshots/jakarta-velocity/ (I notice the link on the website is wrong - I'll fix that). You'll need to install ant and type ant build after cd'ing to the build directory. You can also access the source code with Subversion (svn). More info here. http://www.apache.org/dev/version-control.html If you get stuck, give a holler on the list. Best, WILL On 3/10/06, Richard Huegill [EMAIL PROTECTED] wrote: so whats the easiest way to get to the most recent build ? the latest code from the source control head thanks Richard From: Will Glass-Husain [EMAIL PROTECTED] Reply-To: Velocity Users List velocity-user@jakarta.apache.org To: Velocity Users List velocity-user@jakarta.apache.org Subject: Re: problem loading templates Date: Mon, 6 Mar 2006 07:37:40 -0800 George is right. Or use the latest code from the source control head, which solves this problem. (It looks in the Thread's context classloader so it finds the templates). WILL On 3/6/06, George Joseph [EMAIL PROTECTED] wrote: Are you using classpath loader? If yes, then put your templates jar (jar which have the velocity templates) in the same directory as velocity.jar. -Original Message- From: Richard Huegill [mailto:[EMAIL PROTECTED] Sent: Monday, March 06, 2006 5:43 AM To: velocity-user@jakarta.apache.org Subject: problem loading templates I have an app which has templates, in web-inf/templates dir. (working fine). I decided to move all my jars from the war file to the common dir under tomcat. now I can't load my templates, same directory, but it can't find them. has anyone tried this before ? is there a trick ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ## NOTICE: The contents of this e-mail and any attachments to it may contain privileged and confidential information from Jones Apparel Group, Inc. or its affiliates. This information is only for the viewing or use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of, or the taking of any action in reliance upon, the information contained in this e-mail, or any of the attachments to this e-mail, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by replying to this message and delete it from your system. ## - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- ___ Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: Features
Hi Jurica, Sure, we'd welcome help to implement those features. Thanks for offering! WILL On 3/9/06, Jurica Viskovic [EMAIL PROTECTED] wrote: Hy. I have a bit different question about velocity. Velocity is great, simple and efficient and we have 2 projects using velocity as view. I was wondering is there some workaround to implement some new features in velocity or is there some work in progress to implement those features. New features: - accept macros with same name but different number of arguments #macro(img $src) #macro(img $src $properties) - passing macro arguments as (name=value) pair #img(src=/images/text.gif properties=border=0) If I can help with implementing this new features I will gladly do it. Regards, jure PS: i am using intelliJ IDEA and if someone has some plug-in for velocity or some syntax highlighter please send it to it will be of great help. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: Features
Sure. A good starting point are these links: http://jakarta.apache.org/site/getinvolved.html http://wiki.apache.org/jakarta-velocity/CodeStandards And the Velocity Wiki in general: http://wiki.apache.org/jakarta-velocity/ You can submit ideas for features and bug patches on the velocity-developer list, or create an issue on our JIRA issue tracking system. (use the list for general ideas and discussion and use JIRA for submitting patches or requesting certain features). https://issues.apache.org/jira/ Best, WILL On 3/9/06, Jurica Viskovic [EMAIL PROTECTED] wrote: Ok! I never developed for open source project so can you give me some pointers on how i can help. Regards, jure - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: #macro recursion
Yes, but their are some pecularities about scoping. Do you have this property set to true? velocimacro.context.localscope I'm not experienced in Macro recursion, but I suggest you try that. Maybe someone else would chime in who works with recursion macros. Or check the archives. (the topic has come up before). WILL On 3/8/06, Jean-Marc Reynaud [EMAIL PROTECTED] wrote: Is it possible for #macro()s to recurse? I'm attempting recursion but the output is not as expected and I'm not sure whether it's due to my code or whether recursion is not supported. Kindest regards, Jean-Marc Reynaud This transmission is confidential and intended solely for the person or organisation to whom it is addressed. It may contain privileged and confidential information. If you are not the intended recipient, you should not copy, distribute or take any action in reliance on it. If you have received this transmission in error, please notify the sender immediately. Any opinions or advice contained in this e-mail are those of the individual sender except where they are stated to be the views of RDF Group plc. All messages passing through this gateway are virus scanned. -- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com
Re: problem loading templates
What is common.jars? On 3/6/06, Richard Huegill [EMAIL PROTECTED] wrote: Is there a way that I can have my common.jars in the common/lib and only my application specific ones in the webapp (just easier to only deploy changes in 1 war file) ? if i Have to have them in the same dir, then i have to have them both in the war with any other dependencies (which makes a big war file) From: Will Glass-Husain [EMAIL PROTECTED] Reply-To: Velocity Users List velocity-user@jakarta.apache.org To: Velocity Users List velocity-user@jakarta.apache.org Subject: Re: problem loading templates Date: Mon, 6 Mar 2006 07:37:40 -0800 George is right. Or use the latest code from the source control head, which solves this problem. (It looks in the Thread's context classloader so it finds the templates). WILL On 3/6/06, George Joseph [EMAIL PROTECTED] wrote: Are you using classpath loader? If yes, then put your templates jar (jar which have the velocity templates) in the same directory as velocity.jar. -Original Message- From: Richard Huegill [mailto:[EMAIL PROTECTED] Sent: Monday, March 06, 2006 5:43 AM To: velocity-user@jakarta.apache.org Subject: problem loading templates I have an app which has templates, in web-inf/templates dir. (working fine). I decided to move all my jars from the war file to the common dir under tomcat. now I can't load my templates, same directory, but it can't find them. has anyone tried this before ? is there a trick ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ## NOTICE: The contents of this e-mail and any attachments to it may contain privileged and confidential information from Jones Apparel Group, Inc. or its affiliates. This information is only for the viewing or use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of, or the taking of any action in reliance upon, the information contained in this e-mail, or any of the attachments to this e-mail, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by replying to this message and delete it from your system. ## - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- ___ Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- ___ Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com
Re: problem loading templates
George is right. Or use the latest code from the source control head, which solves this problem. (It looks in the Thread's context classloader so it finds the templates). WILL On 3/6/06, George Joseph [EMAIL PROTECTED] wrote: Are you using classpath loader? If yes, then put your templates jar (jar which have the velocity templates) in the same directory as velocity.jar. -Original Message- From: Richard Huegill [mailto:[EMAIL PROTECTED] Sent: Monday, March 06, 2006 5:43 AM To: velocity-user@jakarta.apache.org Subject: problem loading templates I have an app which has templates, in web-inf/templates dir. (working fine). I decided to move all my jars from the war file to the common dir under tomcat. now I can't load my templates, same directory, but it can't find them. has anyone tried this before ? is there a trick ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ## NOTICE: The contents of this e-mail and any attachments to it may contain privileged and confidential information from Jones Apparel Group, Inc. or its affiliates. This information is only for the viewing or use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of, or the taking of any action in reliance upon, the information contained in this e-mail, or any of the attachments to this e-mail, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by replying to this message and delete it from your system. ## - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- ___ Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com
Re: New MVC Framework
Thanks for sharing this! Don't forget to add it to the PoweredByVelocity section on the Wiki. WILL On 3/3/06, John Villar [EMAIL PROTECTED] wrote: Hi everyone, i'm mailing this list to announce everybody that i've released a new MVC Framework, based on the Velocity Templating engine. Everyone is invited to check it out at http://myvelcont.sourceforge.net cheers!! John Villar -- ___ Forio Business Simulations Will Glass-Husain phone (415) 440-7500 x89 mobile (415) 235-4293 [EMAIL PROTECTED] www.forio.com
Re: PANIC : Velocity cannot find any of the specified or default logging ...
What's a VelocityGen? That's not in the Velocity distribution. Do the error messages list what class was causing the problem? - Original Message - From: Pascual Queralt [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Tuesday, February 21, 2006 10:47 AM Subject: PANIC : Velocity cannot find any of the specified or default logging ... Hi, I need a little of help. My plugin in Eclipse that use Velocity was working fine, but suddenly I've got this velocity message. systems in the classpath, or the classpath doesn't contain the necessary classes to support them. Please consult the documentation regarding logging. Exception : java.lang.NoClassDefFound It happens just when I execute this instruction. VGenerator = new VelocityGen(); Any ideas will be helpfull. Many thanks. Pascual - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PANIC : Velocity cannot find any of the specified or default logging ...
Hi Pascual, I've never seen that error message in connection with Velocity. Did you say you were writing a plugin? It's probably an Eclipse classpath problem. Or are you running under some type of restrictive security policy? You might consider using the VelocityEngine instead of Velocity. Velocity.init() sets up a singleton - all other uses of Velocity in the same classloader will share all the properties. If you create a VelocityEngine you can have different instances with different properties. WILL - Original Message - From: Pascual Queralt [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Tuesday, February 21, 2006 11:01 AM Subject: Re: PANIC : Velocity cannot find any of the specified or default logging ... Hi Will, I mean the instruction Velocity.init(); the velocitygen is only a constructor that binds values to the velocity properties. - Original Message - From: Will Glass-Husain [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Tuesday, February 21, 2006 7:51 PM Subject: Re: PANIC : Velocity cannot find any of the specified or default logging ... What's a VelocityGen? That's not in the Velocity distribution. Do the error messages list what class was causing the problem? - Original Message - From: Pascual Queralt [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Tuesday, February 21, 2006 10:47 AM Subject: PANIC : Velocity cannot find any of the specified or default logging ... Hi, I need a little of help. My plugin in Eclipse that use Velocity was working fine, but suddenly I've got this velocity message. systems in the classpath, or the classpath doesn't contain the necessary classes to support them. Please consult the documentation regarding logging. Exception : java.lang.NoClassDefFound It happens just when I execute this instruction. VGenerator = new VelocityGen(); Any ideas will be helpfull. Many thanks. Pascual - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y mviles desde 1 cntimo por minuto. http://es.voice.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PANIC : Velocity cannot find any of the specified or default logging ...
Of course! Forgot about the basics... - Original Message - From: Nathan Bubna [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Tuesday, February 21, 2006 11:20 AM Subject: Re: PANIC : Velocity cannot find any of the specified or default logging ... Sounds like you are using the vanilla velocity.jar without the necessary dependencies. You either need to use the velocity-dep.jar included in your distribution, or else make sure that either logkit or log4j are in the classpath. On 2/21/06, Pascual Queralt [EMAIL PROTECTED] wrote: Hi, I need a little of help. My plugin in Eclipse that use Velocity was working fine, but suddenly I've got this velocity message. systems in the classpath, or the classpath doesn't contain the necessary classes to support them. Please consult the documentation regarding logging. Exception : java.lang.NoClassDefFound It happens just when I execute this instruction. VGenerator = new VelocityGen(); Any ideas will be helpfull. Many thanks. Pascual - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wanting to preprocess Velocity templates
Thanks for the followup... Just a caution - be aware that VelocityEngine.evaluate does not cache templates. There's a substantial performance improvement for using mergeTemplate instead which will cache the parsed template. WILL - Original Message - From: Bill Rishel [EMAIL PROTECTED] To: velocity-user@jakarta.apache.org Sent: Friday, February 17, 2006 4:38 AM Subject: re: wanting to preprocess Velocity templates I solved my problem. I just had to override doRequest(...) in VelocityViewServlet, use evaluate(...) etc. Bill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]