class WirisPlugin::ServiceResourceLoaderImpl

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb, line 10
def initialize()
    super()
end

Public Instance Methods

getContent(resource) click to toggle source
# File lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb, line 13
def getContent(resource)
    return Storage::newResourceStorage(resource)::read()
end
getContentType(name) click to toggle source
# File lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb, line 16
def getContentType(name)
    ext = Std::substr(name,name::lastIndexOf(".") + 1)
    if (ext == "png")
        return "image/png"
    else 
        if (ext == "gif")
            return "image/gif"
        else 
            if (ext == "jpg") || (ext == "jpeg")
                return "image/jpeg"
            else 
                if (ext == "html") || (ext == "htm")
                    return "text/html"
                else 
                    if (ext == "css")
                        return "text/css"
                    else 
                        if (ext == "js")
                            return "application/javascript"
                        else 
                            if (ext == "txt")
                                return "text/plain"
                            else 
                                if (ext == "ini")
                                    return "text/plain"
                                else 
                                    return "application/octet-stream"
                                end
                            end
                        end
                    end
                end
            end
        end
    end
end