wirispluginengine 3.62.0.1322 → 7.14.0.1422
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +34 -34
- data/app/assets/javascripts/wirispluginengine/WIRISplugins.js +1040 -64
- data/app/controllers/wirispluginengine/application_controller.rb +84 -75
- data/app/helpers/wirispluginengine/application_helper.rb +4 -4
- data/config/routes.rb +4 -4
- data/lib/com/wiris/common/WInteger.rb +52 -51
- data/lib/com/wiris/plugin/api/Cas.rb +5 -5
- data/lib/com/wiris/plugin/api/CleanCache.rb +5 -5
- data/lib/com/wiris/plugin/api/Configuration.rb +5 -5
- data/lib/com/wiris/plugin/api/ConfigurationKeys.rb +94 -91
- data/lib/com/wiris/plugin/api/Editor.rb +5 -5
- data/lib/com/wiris/plugin/api/Filter.rb +5 -5
- data/lib/com/wiris/plugin/api/ImageFormatController.rb +5 -5
- data/lib/com/wiris/plugin/api/ParamsProvider.rb +5 -5
- data/lib/com/wiris/plugin/api/PluginBuilder.rb +88 -74
- data/lib/com/wiris/plugin/api/Render.rb +5 -5
- data/lib/com/wiris/plugin/api/ServiceResourceLoader.rb +5 -5
- data/lib/com/wiris/plugin/api/Test.rb +5 -5
- data/lib/com/wiris/plugin/api/TextService.rb +5 -5
- data/lib/com/wiris/plugin/configuration/ConfigurationUpdater.rb +5 -5
- data/lib/com/wiris/plugin/impl/CacheFormulaImpl.rb +15 -0
- data/lib/com/wiris/plugin/impl/CacheImpl.rb +124 -0
- data/lib/com/wiris/plugin/impl/CasImpl.rb +140 -138
- data/lib/com/wiris/plugin/impl/CleanCacheImpl.rb +103 -101
- data/lib/com/wiris/plugin/impl/ConfigurationImpl.rb +165 -166
- data/lib/com/wiris/plugin/impl/CustomConfigurationUpdater.rb +32 -30
- data/lib/com/wiris/plugin/impl/DefaultConfigurationUpdater.rb +24 -22
- data/lib/com/wiris/plugin/impl/EditorImpl.rb +80 -78
- data/lib/com/wiris/plugin/impl/FileConfigurationUpdater.rb +29 -27
- data/lib/com/wiris/plugin/impl/FileStorageAndCache.rb +55 -53
- data/lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb +65 -134
- data/lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb +50 -48
- data/lib/com/wiris/plugin/impl/HttpImpl.rb +49 -48
- data/lib/com/wiris/plugin/impl/HttpListener.rb +5 -5
- data/lib/com/wiris/plugin/impl/ImageFormatControllerPng.rb +71 -63
- data/lib/com/wiris/plugin/impl/ImageFormatControllerSvg.rb +37 -28
- data/lib/com/wiris/plugin/impl/PluginBuilderImpl.rb +280 -248
- data/lib/com/wiris/plugin/impl/RenderImpl.rb +303 -257
- data/lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb +41 -39
- data/lib/com/wiris/plugin/impl/TestImpl.rb +177 -157
- data/lib/com/wiris/plugin/impl/TextFilter.rb +210 -194
- data/lib/com/wiris/plugin/impl/TextFilterTags.rb +57 -50
- data/lib/com/wiris/plugin/impl/TextServiceImpl.rb +158 -107
- data/lib/com/wiris/plugin/storage/StorageAndCache.rb +5 -5
- data/lib/com/wiris/util/json/JSon.rb +505 -493
- data/lib/com/wiris/util/json/JSonIntegerFormat.rb +17 -16
- data/lib/com/wiris/util/json/JsonAPIResponse.rb +70 -0
- data/lib/com/wiris/util/json/StringParser.rb +57 -56
- data/lib/com/wiris/util/sys/AccessProvider.rb +8 -0
- data/lib/com/wiris/util/sys/Cache.rb +8 -0
- data/lib/com/wiris/util/sys/HttpConnection.rb +14 -13
- data/lib/com/wiris/util/sys/HttpConnectionListener.rb +5 -5
- data/lib/com/wiris/util/sys/HttpSync.rb +28 -0
- data/lib/com/wiris/util/sys/IniFile.rb +132 -131
- data/lib/com/wiris/util/sys/Lock.rb +8 -0
- data/lib/com/wiris/util/sys/LockProvider.rb +8 -0
- data/lib/com/wiris/util/sys/Store.rb +126 -101
- data/lib/com/wiris/util/sys/StoreCache.rb +63 -0
- data/lib/com/wiris/util/sys/TimerProxy.rb +21 -0
- data/lib/com/wiris/util/sys/TimerTask.rb +8 -0
- data/lib/com/wiris/util/type/Arrays.rb +275 -0
- data/lib/com/wiris/util/type/ByteBuffer.rb +69 -0
- data/lib/com/wiris/util/type/Comparator.rb +8 -0
- data/lib/com/wiris/util/type/DataUtils.rb +24 -0
- data/lib/com/wiris/util/type/DoubleTools.rb +14 -0
- data/lib/com/wiris/util/type/HashCache.rb +43 -0
- data/lib/com/wiris/util/type/IntegerTools.rb +32 -0
- data/lib/com/wiris/util/type/Queue.rb +31 -0
- data/lib/com/wiris/util/type/SortArrayByStringLength.rb +26 -0
- data/lib/com/wiris/util/type/SortStringByLength.rb +26 -0
- data/lib/com/wiris/util/type/SortedHash.rb +45 -0
- data/lib/com/wiris/util/type/Stack.rb +31 -0
- data/lib/com/wiris/util/type/StringUtils.rb +56 -0
- data/lib/com/wiris/util/type/Tokenizer.rb +40 -0
- data/lib/com/wiris/util/type/UrlUtils.rb +78 -0
- data/lib/com/wiris/util/xml/ContentHandler.rb +8 -0
- data/lib/com/wiris/util/xml/DefaultHandler.rb +25 -0
- data/lib/com/wiris/util/xml/EntityResolver.rb +8 -0
- data/lib/com/wiris/util/xml/MathMLEntityResolver.rb +19 -0
- data/lib/com/wiris/util/xml/SAXParser.rb +470 -0
- data/lib/com/wiris/util/xml/SerializableImpl.rb +16 -15
- data/lib/com/wiris/util/xml/WCharacterBase.rb +968 -627
- data/lib/com/wiris/util/xml/WEntities.rb +11 -9
- data/lib/com/wiris/util/xml/WXmlUtils.rb +660 -490
- data/lib/com/wiris/util/xml/XmlSerializer.rb +517 -471
- data/lib/com/wiris/util/xml/XmlWriter.rb +260 -262
- data/lib/loader.rb +15 -12
- data/lib/src-generic/Array.rb +22 -22
- data/lib/src-generic/ArrayInt.rb +31 -31
- data/lib/src-generic/Base64.rb +14 -14
- data/lib/src-generic/BaseCode.rb +93 -93
- data/lib/src-generic/Boolean.rb +27 -0
- data/lib/src-generic/Bytes.rb +50 -50
- data/lib/src-generic/BytesInput.rb +37 -37
- data/lib/src-generic/EReg.rb +55 -55
- data/lib/src-generic/File.rb +35 -35
- data/lib/src-generic/FileLock.rb +26 -26
- data/lib/src-generic/FileSystem.rb +37 -37
- data/lib/src-generic/Hash.rb +42 -42
- data/lib/src-generic/Http.rb +111 -107
- data/lib/src-generic/HttpRequest.rb +25 -25
- data/lib/src-generic/HttpResponse.rb +70 -70
- data/lib/src-generic/Iterator.rb +20 -19
- data/lib/src-generic/Math.rb +14 -14
- data/lib/src-generic/Md5.rb +8 -8
- data/lib/src-generic/Md5Tools.rb +11 -11
- data/lib/src-generic/PropertiesTools.rb +32 -32
- data/lib/src-generic/Reflect.rb +16 -16
- data/lib/src-generic/RubyConfigurationUpdater.rb +49 -45
- data/lib/src-generic/Serializer.rb +84 -84
- data/lib/src-generic/Std.rb +74 -74
- data/lib/src-generic/Storage.rb +152 -152
- data/lib/src-generic/StringBuf.rb +40 -40
- data/lib/src-generic/StringTools.rb +44 -46
- data/lib/src-generic/Timer.rb +6 -6
- data/lib/src-generic/Type.rb +18 -18
- data/lib/src-generic/TypeTools.rb +31 -31
- data/lib/src-generic/Unserializer.rb +72 -72
- data/lib/src-generic/Utf8.rb +26 -26
- data/lib/src-generic/Xml.rb +199 -198
- data/lib/src-generic/extended/Integer.rb +5 -5
- data/lib/src-generic/extended/Math.rb +6 -6
- data/lib/src-generic/extended/Properties.rb +11 -11
- data/lib/src-generic/extended/String.rb +38 -38
- data/lib/src-generic/settings/PlatformSettings.rb +18 -18
- data/lib/src-generic/system/HttpProxy.rb +23 -0
- data/lib/src-generic/system/HttpProxyAuth.rb +10 -0
- data/lib/wirispluginengine.rb +5 -5
- data/lib/wirispluginengine/engine.rb +5 -5
- data/lib/wirispluginengine/integration/cleancache.rb +8 -8
- data/lib/wirispluginengine/integration/configurationjs.rb +8 -15
- data/lib/wirispluginengine/integration/configurationjson.rb +6 -6
- data/lib/wirispluginengine/integration/createimage.rb +7 -7
- data/lib/wirispluginengine/integration/getmathml.rb +18 -18
- data/lib/wirispluginengine/integration/resource.rb +8 -8
- data/lib/wirispluginengine/integration/service.rb +5 -5
- data/lib/wirispluginengine/integration/showimage.rb +28 -21
- data/lib/wirispluginengine/integration/test.rb +5 -5
- data/lib/wirispluginengine/integration/testfilter.rb +10 -0
- data/lib/wirispluginengine/version.rb +2 -2
- data/resources/VERSION +1 -1
- data/resources/WEB-INF/web.xml +25 -0
- data/resources/WIRISplugins.js +3809 -0
- data/resources/default-configuration.ini +47 -45
- data/resources/tech.txt +1 -1
- data/resources/wirisplugin.css +43 -42
- metadata +40 -4
- data/configuration.ini.dist +0 -104
|
@@ -1,144 +1,75 @@
|
|
|
1
1
|
module WirisPlugin
|
|
2
2
|
include Wiris
|
|
3
|
-
require('com/wiris/plugin/
|
|
4
|
-
require('com/wiris/
|
|
5
|
-
require('com/wiris/plugin/storage/StorageAndCache.rb')
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
require('com/wiris/plugin/storage/StorageAndCache.rb')
|
|
4
|
+
require('com/wiris/plugin/impl/CacheImpl.rb')
|
|
5
|
+
require('com/wiris/plugin/storage/StorageAndCache.rb')
|
|
6
|
+
class FolderTreeStorageAndCache
|
|
7
|
+
extend StorageAndCacheInterface
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
include Wiris
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
def self.backwards_compat=(backwards_compat)
|
|
17
|
-
@@backwards_compat = backwards_compat
|
|
18
|
-
end
|
|
19
|
-
def initialize()
|
|
20
|
-
super()
|
|
21
|
-
end
|
|
22
|
-
def init(obj,config)
|
|
23
|
-
@config = config
|
|
24
|
-
end
|
|
25
|
-
def codeDigest(content)
|
|
26
|
-
digest = Md5Tools::encodeString(content)
|
|
27
|
-
parent = getFolderStore(getAndCheckFolder(ConfigurationKeys::FORMULA_FOLDER),digest)
|
|
28
|
-
parent::mkdirs()
|
|
29
|
-
store = getFileStoreWithParent(parent,digest,"ini")
|
|
30
|
-
store::write(content)
|
|
31
|
-
return digest
|
|
32
|
-
end
|
|
33
|
-
def decodeDigest(digest)
|
|
34
|
-
formula = getAndCheckFolder(ConfigurationKeys::FORMULA_FOLDER)
|
|
35
|
-
store = getFileStore(formula,digest,"ini")
|
|
36
|
-
if @@backwards_compat
|
|
37
|
-
if !store::exists()
|
|
38
|
-
oldstore = Store::newStore(((formula+"/")+digest)+".ini")
|
|
39
|
-
parent = store::getParent()
|
|
40
|
-
parent::mkdirs()
|
|
41
|
-
oldstore::moveTo(store)
|
|
11
|
+
attr_accessor :config
|
|
12
|
+
@@backwards_compat;
|
|
13
|
+
def self.backwards_compat
|
|
14
|
+
@@backwards_compat
|
|
42
15
|
end
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
end
|
|
46
|
-
def retreiveData(digest,service)
|
|
47
|
-
formula = getAndCheckFolder(ConfigurationKeys::CACHE_FOLDER)
|
|
48
|
-
store = getFileStore(formula,digest,getExtension(service))
|
|
49
|
-
if @@backwards_compat
|
|
50
|
-
if !store::exists()
|
|
51
|
-
oldstore = Store::newStore((((formula+"/")+digest)+".")+getExtension(service))
|
|
52
|
-
if !oldstore::exists()
|
|
53
|
-
return nil
|
|
54
|
-
end
|
|
55
|
-
parent = store::getParent()
|
|
56
|
-
parent::mkdirs()
|
|
57
|
-
oldstore::moveTo(store)
|
|
16
|
+
def self.backwards_compat=(backwards_compat)
|
|
17
|
+
@@backwards_compat = backwards_compat
|
|
58
18
|
end
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
19
|
+
attr_accessor :cache
|
|
20
|
+
attr_accessor :cacheFormula
|
|
21
|
+
def initialize()
|
|
22
|
+
super()
|
|
62
23
|
end
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
end
|
|
73
|
-
def getAndCheckFolder(key)
|
|
74
|
-
folder = PropertiesTools::getProperty(@config,key)
|
|
75
|
-
if (folder==nil)||(folder::trim()::length()==0)
|
|
76
|
-
raise Exception,"Missing configuration value: "+key
|
|
77
|
-
end
|
|
78
|
-
return folder
|
|
79
|
-
end
|
|
80
|
-
def getExtension(service)
|
|
81
|
-
if (service=="png")
|
|
82
|
-
return "png"
|
|
83
|
-
end
|
|
84
|
-
if (service=="svg")
|
|
85
|
-
return "svg"
|
|
86
|
-
end
|
|
87
|
-
return service+".txt"
|
|
88
|
-
end
|
|
89
|
-
def getFolderStore(dir,digest)
|
|
90
|
-
return Store::newStore((((dir+"/")+Std::substr(digest,0,2).to_s)+"/")+Std::substr(digest,2,2).to_s)
|
|
91
|
-
end
|
|
92
|
-
def getFileStoreWithParent(parent,digest,extension)
|
|
93
|
-
return Store::newStoreWithParent(parent,(Std::substr(digest,4).to_s+".")+extension)
|
|
94
|
-
end
|
|
95
|
-
def getFileStore(dir,digest,extension)
|
|
96
|
-
return getFileStoreWithParent(getFolderStore(dir,digest),digest,extension)
|
|
97
|
-
end
|
|
98
|
-
def updateFoldersStructure()
|
|
99
|
-
updateFolderStructure(getAndCheckFolder(ConfigurationKeys::CACHE_FOLDER))
|
|
100
|
-
updateFolderStructure(getAndCheckFolder(ConfigurationKeys::FORMULA_FOLDER))
|
|
101
|
-
end
|
|
102
|
-
def updateFolderStructure(dir)
|
|
103
|
-
folder = Store::newStore(dir)
|
|
104
|
-
files = folder::list()
|
|
105
|
-
if files!=nil
|
|
106
|
-
for i in 0..files::length-1
|
|
107
|
-
digest = isFormulaFileName(files[i])
|
|
108
|
-
if digest!=nil
|
|
109
|
-
newFolder = getFolderStore(dir,digest)
|
|
110
|
-
newFolder::mkdirs()
|
|
111
|
-
newFile = getFileStoreWithParent(newFolder,digest,Std::substr(files[i],files[i]::indexOf(".")+1))
|
|
112
|
-
file = Store::newStoreWithParent(folder,files[i])
|
|
113
|
-
file::moveTo(newFile)
|
|
24
|
+
def init(obj, config, cache, cacheFormula)
|
|
25
|
+
self.config = config
|
|
26
|
+
self.cache = cache
|
|
27
|
+
self.cacheFormula = cacheFormula
|
|
28
|
+
end
|
|
29
|
+
def codeDigest(content)
|
|
30
|
+
digest = Md5Tools::encodeString(content)
|
|
31
|
+
begin
|
|
32
|
+
self.cacheFormula::set(digest + ".ini",Bytes::ofData(Utf8::toBytes(content)))
|
|
114
33
|
end
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
34
|
+
return digest
|
|
35
|
+
end
|
|
36
|
+
def decodeDigest(digest)
|
|
37
|
+
data = self.cacheFormula::get(digest + ".ini")
|
|
38
|
+
if data != nil
|
|
39
|
+
return Utf8::fromBytes(data::getData())
|
|
40
|
+
else
|
|
41
|
+
return nil
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
def retreiveData(digest, service)
|
|
45
|
+
data = self.cache::get((digest + ".") + getExtension(service))
|
|
46
|
+
if data != nil
|
|
47
|
+
return data::getData()
|
|
48
|
+
else
|
|
49
|
+
return nil
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
def storeData(digest, service, stream)
|
|
53
|
+
begin
|
|
54
|
+
self.cache::set((digest + ".") + self.getExtension(service),Bytes::ofData(stream))
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
def getExtension(service)
|
|
58
|
+
if (service == "png")
|
|
59
|
+
return "png"
|
|
60
|
+
end
|
|
61
|
+
if (service == "svg")
|
|
62
|
+
return "svg"
|
|
63
|
+
end
|
|
64
|
+
return service + ".txt"
|
|
65
|
+
end
|
|
66
|
+
def deleteCache()
|
|
67
|
+
cache = CacheImpl.new(self.config)
|
|
68
|
+
begin
|
|
69
|
+
cache::deleteAll()
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
@@backwards_compat = true
|
|
142
74
|
end
|
|
143
|
-
end
|
|
144
75
|
end
|
|
@@ -1,56 +1,58 @@
|
|
|
1
1
|
module WirisPlugin
|
|
2
2
|
include Wiris
|
|
3
|
-
require('com/wiris/plugin/api/ConfigurationKeys.rb')
|
|
4
|
-
require('com/wiris/plugin/api/ParamsProvider.rb')
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
require('com/wiris/plugin/api/ConfigurationKeys.rb')
|
|
4
|
+
require('com/wiris/plugin/api/ParamsProvider.rb')
|
|
5
|
+
require('com/wiris/plugin/api/ParamsProvider.rb')
|
|
6
|
+
class GenericParamsProviderImpl
|
|
7
|
+
extend ParamsProviderInterface
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
include Wiris
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
def getParameter(param,dflt)
|
|
16
|
-
return PropertiesTools::getProperty(@properties,param,dflt)
|
|
17
|
-
end
|
|
18
|
-
def getRequiredParameter(param)
|
|
19
|
-
parameter = PropertiesTools::getProperty(@properties,param,nil)
|
|
20
|
-
if parameter!=nil
|
|
21
|
-
return parameter
|
|
22
|
-
else
|
|
23
|
-
raise Exception,("Error: parameter"+param)+"is required"
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
def getParameters()
|
|
27
|
-
return @properties
|
|
28
|
-
end
|
|
29
|
-
def getRenderParameters(configuration)
|
|
30
|
-
renderParams = PropertiesTools::newProperties()
|
|
31
|
-
renderParameterList = configuration::getProperty(ConfigurationKeys::EDITOR_PARAMETERS_LIST,ConfigurationKeys::EDITOR_PARAMETERS_DEFAULT_LIST)::split(",")
|
|
32
|
-
for i in 0..renderParameterList::length-1
|
|
33
|
-
key = renderParameterList[i]
|
|
34
|
-
value = PropertiesTools::getProperty(@properties,key)
|
|
35
|
-
if value!=nil
|
|
36
|
-
PropertiesTools::setProperty(renderParams,key,value)
|
|
37
|
-
end
|
|
38
|
-
i+=1
|
|
11
|
+
attr_accessor :properties
|
|
12
|
+
def initialize(properties)
|
|
13
|
+
super()
|
|
14
|
+
self.properties = properties
|
|
39
15
|
end
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def getServiceParameters()
|
|
43
|
-
serviceParams = PropertiesTools::newProperties()
|
|
44
|
-
serviceParamListArray = Std::split(ConfigurationKeys::SERVICES_PARAMETERS_LIST,",")
|
|
45
|
-
for i in 0..serviceParamListArray::length()-1
|
|
46
|
-
key = serviceParamListArray::_(i)
|
|
47
|
-
value = PropertiesTools::getProperty(@properties,key)
|
|
48
|
-
if value!=nil
|
|
49
|
-
PropertiesTools::setProperty(serviceParams,key,value)
|
|
50
|
-
end
|
|
51
|
-
i+=1
|
|
16
|
+
def getParameter(param, dflt)
|
|
17
|
+
return PropertiesTools::getProperty(self.properties,param,dflt)
|
|
52
18
|
end
|
|
53
|
-
|
|
19
|
+
def getRequiredParameter(param)
|
|
20
|
+
parameter = PropertiesTools::getProperty(self.properties,param,nil)
|
|
21
|
+
if parameter != nil
|
|
22
|
+
return parameter
|
|
23
|
+
else
|
|
24
|
+
raise Exception,("Error: parameter " + param) + " is required"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
def getParameters()
|
|
28
|
+
return self.properties
|
|
29
|
+
end
|
|
30
|
+
def getRenderParameters(configuration)
|
|
31
|
+
renderParams = PropertiesTools::newProperties()
|
|
32
|
+
renderParameterList = configuration::getProperty(ConfigurationKeys::EDITOR_PARAMETERS_LIST,ConfigurationKeys::EDITOR_PARAMETERS_DEFAULT_LIST)::split(",")
|
|
33
|
+
for i in 0..renderParameterList::length - 1
|
|
34
|
+
key = renderParameterList[i]
|
|
35
|
+
value = PropertiesTools::getProperty(self.properties,key)
|
|
36
|
+
if value != nil
|
|
37
|
+
PropertiesTools::setProperty(renderParams,key,value)
|
|
38
|
+
end
|
|
39
|
+
i+=1
|
|
40
|
+
end
|
|
41
|
+
return renderParams
|
|
42
|
+
end
|
|
43
|
+
def getServiceParameters()
|
|
44
|
+
serviceParams = PropertiesTools::newProperties()
|
|
45
|
+
serviceParamListArray = Std::split(ConfigurationKeys::SERVICES_PARAMETERS_LIST,",")
|
|
46
|
+
for i in 0..serviceParamListArray::length() - 1
|
|
47
|
+
key = serviceParamListArray::_(i)
|
|
48
|
+
value = PropertiesTools::getProperty(self.properties,key)
|
|
49
|
+
if value != nil
|
|
50
|
+
PropertiesTools::setProperty(serviceParams,key,value)
|
|
51
|
+
end
|
|
52
|
+
i+=1
|
|
53
|
+
end
|
|
54
|
+
return serviceParams
|
|
55
|
+
end
|
|
56
|
+
|
|
54
57
|
end
|
|
55
|
-
end
|
|
56
58
|
end
|
|
@@ -1,53 +1,54 @@
|
|
|
1
1
|
module WirisPlugin
|
|
2
2
|
include Wiris
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
class HttpImpl < Http
|
|
4
|
+
include Wiris
|
|
5
|
+
|
|
6
|
+
attr_accessor :data
|
|
7
|
+
attr_accessor :listener
|
|
8
|
+
def initialize(url, listener)
|
|
9
|
+
super(url)
|
|
10
|
+
self.listener = listener
|
|
11
|
+
end
|
|
12
|
+
def request(post)
|
|
13
|
+
proxy = getProxy()
|
|
14
|
+
if ((proxy != nil) && (proxy::host != nil)) && (proxy::host::length() > 0)
|
|
15
|
+
hpa = (proxy::auth)
|
|
16
|
+
if (hpa::user != nil) && (hpa::user::length() > 0)
|
|
17
|
+
data = Base64.new()::encodeBytes(Bytes::ofString((hpa::user.to_s + ":") + hpa::pass.to_s))::toString()
|
|
18
|
+
self.setHeader("Proxy-Authorization","Basic " + data)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
super(post)
|
|
22
|
+
end
|
|
23
|
+
def onData(data)
|
|
24
|
+
self.data = data
|
|
25
|
+
if @listener != nil
|
|
26
|
+
@listener::onData(data)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
def onError(msg)
|
|
30
|
+
if @listener != nil
|
|
31
|
+
@listener::onError(msg)
|
|
32
|
+
else
|
|
33
|
+
raise Exception,msg
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
def getData()
|
|
37
|
+
return @data
|
|
38
|
+
end
|
|
39
|
+
def getProxy()
|
|
40
|
+
proxy = Reflect::field(Http,"PROXY")
|
|
41
|
+
if proxy == nil
|
|
42
|
+
return nil
|
|
43
|
+
end
|
|
44
|
+
return (proxy)
|
|
45
|
+
end
|
|
46
|
+
def setProxy(proxy)
|
|
47
|
+
Reflect::setField(Http,"PROXY",proxy)
|
|
48
|
+
end
|
|
49
|
+
def setListener(listener)
|
|
50
|
+
self.listener = listener
|
|
51
|
+
end
|
|
5
52
|
|
|
6
|
-
attr_accessor :data
|
|
7
|
-
attr_accessor :listener
|
|
8
|
-
def initialize(url,listener)
|
|
9
|
-
super(url)
|
|
10
|
-
@listener = listener
|
|
11
|
-
end
|
|
12
|
-
def request(post)
|
|
13
|
-
proxy = getProxy()
|
|
14
|
-
if ((proxy!=nil)&&(proxy::host!=nil))&&(proxy::host::length()>0)
|
|
15
|
-
hpa = (proxy::auth)
|
|
16
|
-
if (hpa::user!=nil)&&(hpa::user::length()>0)
|
|
17
|
-
data = Base64.new()::encodeBytes(Bytes::ofString((hpa::user.to_s+":")+hpa::pass.to_s))::toString()
|
|
18
|
-
setHeader("Proxy-Authorization","Basic "+data)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
super(post)
|
|
22
|
-
end
|
|
23
|
-
def onData(data)
|
|
24
|
-
@data = data
|
|
25
|
-
if @listener!=nil
|
|
26
|
-
@listener::onData(data)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
def onError(msg)
|
|
30
|
-
if @listener!=nil
|
|
31
|
-
@listener::onError(msg)
|
|
32
|
-
else
|
|
33
|
-
raise Exception,msg
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
def getData()
|
|
37
|
-
return @data
|
|
38
|
-
end
|
|
39
|
-
def getProxy()
|
|
40
|
-
proxy = Reflect::field(Http,"PROXY")
|
|
41
|
-
if proxy==nil
|
|
42
|
-
return nil
|
|
43
|
-
end
|
|
44
|
-
return (proxy)
|
|
45
|
-
end
|
|
46
|
-
def setProxy(proxy)
|
|
47
|
-
Reflect::setField(Http,"PROXY",proxy)
|
|
48
|
-
end
|
|
49
|
-
def setListener(listener)
|
|
50
|
-
@listener = listener
|
|
51
53
|
end
|
|
52
|
-
end
|
|
53
54
|
end
|
|
@@ -1,73 +1,81 @@
|
|
|
1
1
|
module WirisPlugin
|
|
2
2
|
include Wiris
|
|
3
|
-
require('com/wiris/plugin/api/ImageFormatController.rb')
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
require('com/wiris/plugin/api/ImageFormatController.rb')
|
|
4
|
+
require('com/wiris/plugin/api/ImageFormatController.rb')
|
|
5
|
+
class ImageFormatControllerPng
|
|
6
|
+
extend ImageFormatControllerInterface
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
include Wiris
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
10
|
+
def initialize()
|
|
11
|
+
super()
|
|
12
|
+
end
|
|
13
|
+
def getContentType()
|
|
14
|
+
return "image/png"
|
|
15
|
+
end
|
|
16
|
+
def getMetrics(bytes, ref_output)
|
|
17
|
+
output = ref_output
|
|
18
|
+
width = 0
|
|
19
|
+
height = 0
|
|
20
|
+
dpi = 0
|
|
21
|
+
baseline = 0
|
|
22
|
+
bi = BytesInput.new(bytes)
|
|
23
|
+
n = bytes::length()
|
|
24
|
+
alloc = 10
|
|
25
|
+
b = Bytes::alloc(alloc)
|
|
26
|
+
bi::readBytes(b,0,8)
|
|
27
|
+
n -= 8
|
|
28
|
+
while n > 0
|
|
29
|
+
len = bi::readInt32()
|
|
30
|
+
typ = bi::readInt32()
|
|
31
|
+
if typ == 1229472850
|
|
32
|
+
width = bi::readInt32()
|
|
33
|
+
height = bi::readInt32()
|
|
34
|
+
bi::readInt32()
|
|
35
|
+
bi::readByte()
|
|
36
|
+
else
|
|
37
|
+
if typ == 1650545477
|
|
38
|
+
baseline = bi::readInt32()
|
|
39
|
+
else
|
|
40
|
+
if typ == 1883789683
|
|
41
|
+
dpi = bi::readInt32()
|
|
42
|
+
dpi = (Math::round(dpi/39.37))
|
|
43
|
+
bi::readInt32()
|
|
44
|
+
bi::readByte()
|
|
45
|
+
else
|
|
46
|
+
if len > alloc
|
|
47
|
+
alloc = len
|
|
48
|
+
b = Bytes::alloc(alloc)
|
|
49
|
+
end
|
|
50
|
+
bi::readBytes(b,0,len)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
bi::readInt32()
|
|
55
|
+
n -= len + 12
|
|
56
|
+
end
|
|
57
|
+
if output != nil
|
|
58
|
+
PropertiesTools::setProperty(output,"width","" + width.to_s)
|
|
59
|
+
PropertiesTools::setProperty(output,"height","" + height.to_s)
|
|
60
|
+
PropertiesTools::setProperty(output,"baseline","" + baseline.to_s)
|
|
61
|
+
if dpi != 96
|
|
62
|
+
PropertiesTools::setProperty(output,"dpi","" + dpi.to_s)
|
|
63
|
+
end
|
|
64
|
+
r = ""
|
|
44
65
|
else
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
bi::readBytes(b,0,len)
|
|
66
|
+
r = (((("&cw=" + width.to_s) + "&ch=") + height.to_s) + "&cb=") + baseline.to_s
|
|
67
|
+
if dpi != 96
|
|
68
|
+
r = (r + "&dpi=") + dpi.to_s
|
|
69
|
+
end
|
|
50
70
|
end
|
|
51
|
-
|
|
52
|
-
end
|
|
53
|
-
bi::readInt32()
|
|
54
|
-
n-= len+12
|
|
55
|
-
end
|
|
56
|
-
if output!=nil
|
|
57
|
-
PropertiesTools::setProperty(output,"width",""+width.to_s)
|
|
58
|
-
PropertiesTools::setProperty(output,"height",""+height.to_s)
|
|
59
|
-
PropertiesTools::setProperty(output,"baseline",""+baseline.to_s)
|
|
60
|
-
if dpi!=96
|
|
61
|
-
PropertiesTools::setProperty(output,"dpi",""+dpi.to_s)
|
|
71
|
+
return r
|
|
62
72
|
end
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
def scalateMetrics(dpi, metrics)
|
|
74
|
+
f = 96/dpi
|
|
75
|
+
metrics::set("width",(f*metrics::get("width")))
|
|
76
|
+
metrics::set("height",(f*metrics::get("height")))
|
|
77
|
+
metrics::set("baseline",(f*metrics::get("baseline")))
|
|
68
78
|
end
|
|
69
|
-
|
|
70
|
-
return r
|
|
79
|
+
|
|
71
80
|
end
|
|
72
|
-
end
|
|
73
81
|
end
|