Convention for tornado template file naming? - naming-conventions

My team is using Tornado web server and the included Tornado template language.
Currently we, like the examples, use '.html' for Tornado template files. Which irks me somewhat, as Tornado templates are not pure HTML.
Eg, Django generally uses .dtml, Mustache uses .mustache.
Is there a similar convention for Tornado template files? If so, what is it?

Related

Can I use Volt engine with another framework?

I'm developing a system (in Phalcon initially) for a project that will be delivered to many shared hosts. But unfortunately they only accept mainstream php frameworks (you cannot install extensions such as Phalcon).
This being said, I had to change framerwork for this project. But alot of stuff were already made using Volt template engine.
There is a way to use it with another frameworks? Or Volt is deeply wattled into Phalcon's core?
It doesn't look like Volt can be decoupled from Phalcon entirely.
You could fall back on the Twig templating engine which seems to be the closest match language wise as well as completely standalone.

Which Testing framework will suit for Adobe CQ5 Project?

Which testing framework will suit for a Adobe CQ5 Project which is having some part of code in Java and some part of code in JSP for the CQ5 components?
There are some details of testing of apache sling components on the Sling Testing page, which will suit components within a CQ5 project
There are remote tests that can be deployed to a running CQ5 server and executed remotely (using curl for example)
There are also integration tests that create a sling launchpad instance and test against sling in-process.
Also, Testing Sling Based Applications discusses approaches to testing the various types of components such as OSGI and provides the links to mocks for common Sling classes (e.g. MockNode, MockProperty, MockResourceResolver).
Finally, if your components are just POJOs then you can just use plain old JUnit tests. For testing the interaction with the web interface of your site/application you could use something like Selenium

gwan reverse proxy

I am searching to configure gwan to act as reverse-proxy cache to my web python application.
I could'nt find some example on the web.
Thanks a lot for your examples
Laurent
If your goal is merely to accelerate your Python application then you should just run it from G-WAN (see the hello.py example).
Some (advanced) users have used G-WAN handlers to write their own custom proxy, but G-WAN will document its embedded proxy (and load-balancer) in the following weeks.
It still works without configuration files, so you will not have to learn anything new.
And the competent users will like the ability to personalize the proxy with their own scripts.
There's always a long way between a solution that "runs" and a polished version ready for a wide public.

Apache module for restful services

My objective is create an apache module that will provide RESTful services (i.e., we have some legacy code that controls/queries some networking equipment and we would now like to expose that functionality as a RESTful service). I guess the flow might look something like this:
WebBrowser -- issues RESTful URI---> [Apache (my_module) ] -->..
..---> Interface to existing Legacy code.
I have been mucking around various wikis, blogs, forums, articles etc. but I just can't seem to understand how those RESTful urls will get to (my_module) in apache [you can tell I have never worked with web-servers internals, much less modules, before]. I mean, do I have to edit that httpd.conf file and say something like: Send all urls that look like http://baseurl/restservices/... to my_module. If so, how do I do it?
Also, what will my_module actually get? Does it get the full http request message and it has to parse it like typical CGI programs?
Further, what is the best way for my_module to interact with my legacy code? E.g., Open a TCP connection to it and send messages and write wrapper around legacy code to interpret those messages. Or can my_module directly invoke the functions in my legacy code somehow if I compiled my entire legacy code as a module in apache?
Thanks for any hints. If u know of a good tutorial, please point me to it. I'm looking for a high level overview that will give me the architecture (the developers under me can then follow up on the nitty-gritty details).
I'd write an extension for PHP or Python and use mod_php / mod_wsgi
I think you are approaching this in the wrong way:
Apache modules are not really how you want to handle a URL if your requirements are quote basic. Depending on the language your legacy code is in, I would advise:
Binding its API into a python or PHP module, and have that script called by Apache through normal means. It is also a lot simple (in many cases) to glue a C-call style compiled language to these scripting languages rather than Apache itself.
It also has the advantage of adding an abstractions which allows you to layer additional logic in a scripting language on your core legacy code. You may also want to preprocess data and validate it from the request before handing it into your legacy code.
Both PHP and Python also have RESTful frameworks and utilities.
If you do write an Apache module, then check out Writing Apache Modules with Perl and C
See:
Developing PHP Extensions in C, Extending Python in C or C++ ... also if using Python checkout the WSGI stuff.
I'd agree with Aiden. Writing Apache modules is not for the faint hearted and you definitely don't want to go there unless you absolutely must. You would need to be prepared to become very conversant with how Apache works.
If you still think you need to, then look at:
http://httpd.apache.org/apreq/
This is a library which uses existing Apache Runtime Libraries and which provides higher level functionality for dealing with POST data, cookies etc from C code hooked into Apache via a custom module.
The book Aiden mentions though is a bit dated. Better off getting:
The Apache Modules Book: Application Development with Apache

Java EE: Print pdf on the fly

In my web application (Java EE), I would like to print a pdf file generated on the server side
on the fly in the client side without opening it. The files could be one or many. Is this possible?
I think it is not possible, except if you require clients to install a special application first.
Not just Java EE, it would be the same with any server-side technology.
You either need an additional Java library or to pass it to native code. There is a blog article with some suggestions at http://www.jpedal.org/PDFblog/2010/01/printing-pdf-files-from-java/