def cacheloader
if (name=params[:name]).nil?
render :text => ''
return
end
cache_hints = File::join RAILS_ROOT, 'public/cachehints.txt'
headers.delete("Cache-Control")
if File.file?(cache_hints)
file = File.new(cache_hints,"r")
hintsTxt = file.read(File.size(cache_hints))
file.close()
hintsTxt.each_line do |line|
if line.index(name) == 0
line.scan(/(.*):(.*)/) do |garbage, ccheader|
headers["Cache-Control"] = ccheader.strip
end
break
end
end
end
if name=~ /.png$/
filePath = File::join RAILS_ROOT, 'public/images/', name
file = File.new(filePath,"r")
filecontents = file.read(File.size(filePath))
file.close()
headers["Content-Type"] = "image/png"
render :text => filecontents
return
elsif name =~ /.xfs$/ or name =~ /.rxf/
headers["Content-Type"] = "application/mform"
else
headers["Content-Type"] = "application/xml"
end
render :template => name
end