Tag Archives: CDN

A few days ago, I created TestZilla on Aliyun Elastic Compute Service. However, with the increment of PV, I decided to use CDN to caches static files(images, css and javascripts). But there's no one told me how to use CDN with Spring MVC, so I asked a question on StackOverflow. Setup Spring Configuration First of all, you need to use PropertyPlaceholderConfigurer in Spring Configuration(such as dispatcher-servlet.xml) Of course, you need to add XML Namespaces: Create Properties File As I was declared in the Spring Configuration, there's a testzilla.properties in classpath. You need to create the file and add following lines in it: Of course, you can add extra properties if needed: Use CDN Property in JSP Now, we can get the…

In this article, you will learn how to create a custom view helper in Zend Framework 2. A concrete example will be used; a helper which generates links for a subdomain, intended for storing static files. This is especially useful if you wish to use a Content Delivery Network (CDN). With very little modification, the helper can be made generic to support links to subdomains for all purposes. The Helper Class Let us begin by creating the helper class. It can be added within any module, but a suitable place would be within the Application module, provided that you made use of the Skeleton Application. Create a file CdnHelper.php in zf2-tutorial\module\Application with the following subdirectories: There are a few things…