Class: WirisPlugin::ServiceResourceLoaderImpl

Inherits:
Object
  • Object
show all
Extended by:
ServiceResourceLoaderInterface
Includes:
Wiris
Defined in:
lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb

Instance Method Summary collapse

Methods included from ServiceResourceLoaderInterface

ServiceResourceLoader

Constructor Details

#initializeServiceResourceLoaderImpl

Returns a new instance of ServiceResourceLoaderImpl.



10
11
12
# File 'lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb', line 10

def initialize()
    super()
end

Instance Method Details

#getContent(resource) ⇒ Object



13
14
15
# File 'lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb', line 13

def getContent(resource)
    return Storage::newResourceStorage(resource)::read()
end

#getContentType(name) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 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