# # Copyright (C) 2007 Mobio Networks, Inc. # # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program. If not, see . # =begin Some summary should go here =end # #require 'rexml/document' require 'open-uri' require 'hpricot' module Rmobio module Utils # #== cachControl #=== Adding cache control to response header def cacheControl(cacheStr='priority=P3;max-age=604800') headers.delete("Cache-Control"); headers["Cache-Control"] = cacheStr; end # #== cacheloader #=== A utility method to add cache control to images, # styles and files To add a cache control, edit the configuration file # 'cachehints.txt' with filename and header. Here is a ample configuration: # # # #logo.png: priority=P2;max-age=1296000 # # #base.rhtml: priority=P2;max-age=1296000 # # # The utility assumes base directory for images files in # RAILS_ROOT/public/images and other files in RAILS_ROOT/apps/views. # # # To access the image in your xform, use the following pattern: # #recipe/loader?name=logo.png To access the style in # your xform, use the following pattern: #