Le dimanche 30 décembre 2007 à 16:52 +1000, Arnold Somogyi a écrit : > I have thought on a good solution but I did not find it. The best > solution will be for me that to replace the $ character with other one > (fox example _$_). But I think it is a impossibble mission. > > I have three fictitious solutions: > > (1) I should use different extension for templatized js files. > Is is practicable but I think it is not too nice solution because > standard extension of Java Script files is js. Not other one.
That's the solution I use. HTTP uses the response content type to identify a content, not the extension. For HTML files for instance, there are plenty of extentions: .html .xhtml .php .php3 .cgi .... you are free to use the ones that please you as long as you handle the ContentType header... I choosed to name script files .vjs, html files .vhtml and css files .vcss. > (2) I should use different directories for templatized js files. > It is not good for me because I use another file structure in my web app. Plus, your pages won't load in a static HTML page editor if some dependancies are placed elsewhere. > (3) I should make a exception list with filenames in my servlet. These > files will not be process with Velocity. > My problem with this solution that I have to append this list sometime > and I have to modify the java source code. Yes, very ankward. There are some other possibilities: (4) Konstantin's solution: having HTTP ask for script.js.vtl and serve script.js. I really don't like it because if HTTP asks for script.js, then the source code is sent to the browser. It really looks like a security problem for me. (5) Having a file called script.js.vtl and HTTP ask for script.js. The servlet builds itself a hashmap of .vtl files, so it can know whether to handle or not a request. It works. The reason I choosed (1) is that if I want to have apache receive front requests and serve static files, I do not want the servlet container to even be called for those static files. Claude > I do not find the best solution too... > > > > On Dec 28, 2007 11:07 AM, Claude Brisson <[EMAIL PROTECTED]> wrote: > > You should use different extensions for files, like *.js and *.html for > > standard files (served by apache or tomcat or whatever) and different > > extensions for templatized files. Or use different directories. > > > > Anyway, having velocity interpret non-templatized files is bad design. > > > > Claude > > > > --------------------------------------------------------------------- > 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]
