lib/appengine-tools/web-xml.rb in appengine-tools-0.0.5 vs lib/appengine-tools/web-xml.rb in appengine-tools-0.0.6
- old
+ new
@@ -26,17 +26,22 @@
def initialize(&block)
@path = "/"
@paths = Hash.new {|h, k| h[k] = []}
@skip_defaults = false
+ @mime_mapping = {}
instance_eval(&block) if block_given?
end
- def skip_rack_servlet
- @skip_defaults = true
+ def add_mime_mapping(doc)
+ @mime_mapping.each_pair do |key,val|
+ mime = doc.add_element('mime-mapping')
+ mime.add_element('extension').add_text(key.to_s)
+ mime.add_element('mime-type').add_text(val)
+ end
end
-
+
def add_jruby_rack_defaults(rackup)
use JavaContextParams, :rackup => rackup
unless @skip_defaults
use JavaServletFilter, 'org.jruby.rack.RackFilter',
{ :name => 'RackFilter', :wildcard => true }
@@ -79,9 +84,10 @@
if object.respond_to? :append_xml
object.append_xml(doc, pattern, *args, &block)
end
end
end
+ add_mime_mapping(doc)
doc
end
private
def each_path