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,34 +1,43 @@
|
|
1
1
|
module WirisPlugin
|
2
2
|
include Wiris
|
3
|
-
require('com/wiris/
|
4
|
-
require('com/wiris/plugin/api/ImageFormatController.rb')
|
5
|
-
|
6
|
-
|
3
|
+
require('com/wiris/plugin/api/ImageFormatController.rb')
|
4
|
+
require('com/wiris/plugin/api/ImageFormatController.rb')
|
5
|
+
class ImageFormatControllerSvg
|
6
|
+
extend ImageFormatControllerInterface
|
7
7
|
|
8
|
-
|
8
|
+
include Wiris
|
9
|
+
|
10
|
+
def initialize()
|
11
|
+
super()
|
12
|
+
end
|
13
|
+
def getContentType()
|
14
|
+
return "image/svg+xml"
|
15
|
+
end
|
16
|
+
def getMetrics(bytes, ref_output)
|
17
|
+
svg = bytes::toString()
|
18
|
+
svgRoot = Std::substr(svg,0,svg::indexOf(">"))
|
19
|
+
firstIndex = svgRoot::indexOf("height=") + 8
|
20
|
+
endIndex = svgRoot::indexOf("\"",firstIndex)
|
21
|
+
height = Std::substr(svgRoot,firstIndex,endIndex - firstIndex)
|
22
|
+
firstIndex = svgRoot::indexOf("width=") + 7
|
23
|
+
endIndex = svgRoot::indexOf("\"",firstIndex)
|
24
|
+
width = Std::substr(svgRoot,firstIndex,endIndex - firstIndex)
|
25
|
+
firstIndex = svgRoot::indexOf("wrs:baseline=") + 14
|
26
|
+
endIndex = svgRoot::indexOf("\"",firstIndex)
|
27
|
+
baseline = Std::substr(svgRoot,firstIndex,endIndex - firstIndex)
|
28
|
+
output = ref_output
|
29
|
+
if output != nil
|
30
|
+
PropertiesTools::setProperty(output,"width","" + width)
|
31
|
+
PropertiesTools::setProperty(output,"height","" + height)
|
32
|
+
PropertiesTools::setProperty(output,"baseline","" + baseline)
|
33
|
+
r = ""
|
34
|
+
else
|
35
|
+
r = (((("&cw=" + width) + "&ch=") + height) + "&cb=") + baseline
|
36
|
+
end
|
37
|
+
return r
|
38
|
+
end
|
39
|
+
def scalateMetrics(dpi, metrics)
|
40
|
+
end
|
9
41
|
|
10
|
-
def initialize()
|
11
|
-
super()
|
12
|
-
end
|
13
|
-
def getContentType()
|
14
|
-
return "image/svg+xml"
|
15
|
-
end
|
16
|
-
def getMetrics(bytes,ref_output)
|
17
|
-
svg = bytes::toString()
|
18
|
-
output = ref_output
|
19
|
-
svgXml = WXmlUtils::parseXML(svg)
|
20
|
-
width = svgXml::firstElement()::get("width")
|
21
|
-
height = svgXml::firstElement()::get("height")
|
22
|
-
baseline = svgXml::firstElement()::get("wrs:baseline")
|
23
|
-
if output!=nil
|
24
|
-
PropertiesTools::setProperty(output,"width",""+width)
|
25
|
-
PropertiesTools::setProperty(output,"height",""+height)
|
26
|
-
PropertiesTools::setProperty(output,"baseline",""+baseline)
|
27
|
-
r = ""
|
28
|
-
else
|
29
|
-
r = (((("&cw="+width)+"&ch=")+height)+"&cb=")+baseline
|
30
|
-
end
|
31
|
-
return r
|
32
42
|
end
|
33
|
-
end
|
34
43
|
end
|
@@ -1,253 +1,285 @@
|
|
1
1
|
module WirisPlugin
|
2
2
|
include Wiris
|
3
|
-
require('com/wiris/plugin/api/
|
4
|
-
require('com/wiris/plugin/api/
|
5
|
-
require('com/wiris/plugin/impl/FolderTreeStorageAndCache.rb')
|
6
|
-
require('com/wiris/plugin/impl/TestImpl.rb')
|
7
|
-
require('com/wiris/plugin/impl/
|
8
|
-
require('com/wiris/plugin/impl/
|
9
|
-
require('com/wiris/plugin/impl/
|
10
|
-
require('com/wiris/plugin/impl/
|
11
|
-
require('com/wiris/plugin/impl/
|
12
|
-
require('com/wiris/plugin/impl/
|
13
|
-
require('com/wiris/plugin/impl/
|
14
|
-
require('com/wiris/plugin/impl/
|
15
|
-
require('com/wiris/plugin/impl/
|
16
|
-
require('com/wiris/plugin/impl/
|
17
|
-
require('com/wiris/plugin/impl/
|
18
|
-
require('com/wiris/plugin/impl/
|
19
|
-
require('com/wiris/plugin/
|
20
|
-
|
21
|
-
|
3
|
+
require('com/wiris/plugin/api/PluginBuilder.rb')
|
4
|
+
require('com/wiris/plugin/api/ConfigurationKeys.rb')
|
5
|
+
require('com/wiris/plugin/impl/FolderTreeStorageAndCache.rb')
|
6
|
+
require('com/wiris/plugin/impl/TestImpl.rb')
|
7
|
+
require('com/wiris/plugin/impl/EditorImpl.rb')
|
8
|
+
require('com/wiris/plugin/impl/CleanCacheImpl.rb')
|
9
|
+
require('com/wiris/plugin/impl/FileStorageAndCache.rb')
|
10
|
+
require('com/wiris/plugin/impl/ImageFormatControllerSvg.rb')
|
11
|
+
require('com/wiris/plugin/impl/ConfigurationImpl.rb')
|
12
|
+
require('com/wiris/plugin/impl/GenericParamsProviderImpl.rb')
|
13
|
+
require('com/wiris/plugin/impl/CacheFormulaImpl.rb')
|
14
|
+
require('com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb')
|
15
|
+
require('com/wiris/plugin/impl/ImageFormatControllerPng.rb')
|
16
|
+
require('com/wiris/plugin/impl/RenderImpl.rb')
|
17
|
+
require('com/wiris/plugin/impl/DefaultConfigurationUpdater.rb')
|
18
|
+
require('com/wiris/plugin/impl/CasImpl.rb')
|
19
|
+
require('com/wiris/plugin/impl/CacheImpl.rb')
|
20
|
+
require('com/wiris/plugin/impl/TextServiceImpl.rb')
|
21
|
+
require('com/wiris/plugin/api/PluginBuilder.rb')
|
22
|
+
class PluginBuilderImpl < PluginBuilder
|
23
|
+
include Wiris
|
22
24
|
|
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
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
if @store==nil
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
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
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
25
|
+
attr_accessor :configuration
|
26
|
+
attr_accessor :store
|
27
|
+
attr_accessor :updaterChain
|
28
|
+
attr_accessor :storageAndCacheInitObject
|
29
|
+
@storageAndCacheCacheObject;
|
30
|
+
attr_accessor :storageAndCacheCacheObject
|
31
|
+
@storageAndCacheCacheFormulaObject;
|
32
|
+
attr_accessor :storageAndCacheCacheFormulaObject
|
33
|
+
@customParamsProvider;
|
34
|
+
attr_accessor :customParamsProvider
|
35
|
+
@accessProvider;
|
36
|
+
attr_accessor :accessProvider
|
37
|
+
def initialize()
|
38
|
+
super()
|
39
|
+
@updaterChain = Array.new()
|
40
|
+
@updaterChain::push(DefaultConfigurationUpdater.new())
|
41
|
+
ci = ConfigurationImpl.new()
|
42
|
+
@configuration = ci
|
43
|
+
ci::setPluginBuilderImpl(self)
|
44
|
+
end
|
45
|
+
def addConfigurationUpdater(conf)
|
46
|
+
@updaterChain::push(conf)
|
47
|
+
end
|
48
|
+
def setCustomParamsProvider(provider)
|
49
|
+
self.customParamsProvider = provider
|
50
|
+
end
|
51
|
+
def getCustomParamsProvider()
|
52
|
+
return self.customParamsProvider
|
53
|
+
end
|
54
|
+
def setAccessProvider(provider)
|
55
|
+
self.accessProvider = provider
|
56
|
+
end
|
57
|
+
def getAccessProvider()
|
58
|
+
return self.accessProvider
|
59
|
+
end
|
60
|
+
def setStorageAndCache(store)
|
61
|
+
self.store = store
|
62
|
+
end
|
63
|
+
def newRender()
|
64
|
+
if (Type::resolveClass("com.wiris.editor.services.PublicServices") != nil) && isEditorLicensed()
|
65
|
+
return RenderImplIntegratedServices.new(self)
|
66
|
+
end
|
67
|
+
return RenderImpl.new(self)
|
68
|
+
end
|
69
|
+
def newAsyncRender()
|
70
|
+
return AsyncRenderImpl.new(self)
|
71
|
+
end
|
72
|
+
def newTest()
|
73
|
+
return TestImpl.new(self)
|
74
|
+
end
|
75
|
+
def newEditor()
|
76
|
+
return EditorImpl.new(self)
|
77
|
+
end
|
78
|
+
def newCas()
|
79
|
+
return CasImpl.new(self)
|
80
|
+
end
|
81
|
+
def newTextService()
|
82
|
+
if (Type::resolveClass("com.wiris.editor.services.PublicServices") != nil) && isEditorLicensed()
|
83
|
+
return TextServiceImplIntegratedServices.new(self)
|
84
|
+
end
|
85
|
+
return TextServiceImpl.new(self)
|
86
|
+
end
|
87
|
+
def newAsyncTextService()
|
88
|
+
return AsyncTextServiceImpl.new(self)
|
89
|
+
end
|
90
|
+
def getConfiguration()
|
91
|
+
return @configuration
|
92
|
+
end
|
93
|
+
def getStorageAndCache()
|
94
|
+
if @store == nil
|
95
|
+
className = @configuration::getProperty(ConfigurationKeys::STORAGE_CLASS,nil)
|
96
|
+
if (className == nil) || (className == "FolderTreeStorageAndCache")
|
97
|
+
@store = FolderTreeStorageAndCache.new()
|
98
|
+
else
|
99
|
+
if (className == "FileStorageAndCache")
|
100
|
+
@store = FileStorageAndCache.new()
|
101
|
+
else
|
102
|
+
cls = Type::resolveClass(className)
|
103
|
+
if cls == nil
|
104
|
+
raise Exception,("Class " + className) + " not found."
|
105
|
+
end
|
106
|
+
@store = (Type::createInstance(cls,Array.new()))
|
107
|
+
if @store == nil
|
108
|
+
raise Exception,("Instance from " + cls.to_s) + " cannot be created."
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
initialize_(@store,@configuration::getFullConfiguration())
|
113
|
+
end
|
114
|
+
return @store
|
115
|
+
end
|
116
|
+
def initialize_(sac, conf)
|
117
|
+
if @storageAndCacheCacheObject == nil
|
118
|
+
@storageAndCacheCacheObject = CacheImpl.new(conf)
|
119
|
+
end
|
120
|
+
if @storageAndCacheCacheFormulaObject == nil
|
121
|
+
@storageAndCacheCacheFormulaObject = CacheFormulaImpl.new(conf)
|
122
|
+
end
|
123
|
+
sac::init(@storageAndCacheInitObject,conf,@storageAndCacheCacheObject,@storageAndCacheCacheFormulaObject)
|
124
|
+
end
|
125
|
+
def getConfigurationUpdaterChain()
|
126
|
+
return @updaterChain
|
127
|
+
end
|
128
|
+
def setStorageAndCacheInitObject(obj)
|
129
|
+
@storageAndCacheInitObject = obj
|
130
|
+
end
|
131
|
+
def setStorageAndCacheCacheObject(cache)
|
132
|
+
@storageAndCacheCacheObject = cache
|
133
|
+
end
|
134
|
+
def setStorageAndCacheCacheFormulaObject(cacheFormula)
|
135
|
+
@storageAndCacheCacheFormulaObject = cacheFormula
|
136
|
+
end
|
137
|
+
def newCleanCache()
|
138
|
+
return CleanCacheImpl.new(self)
|
139
|
+
end
|
140
|
+
def newResourceLoader()
|
141
|
+
return ServiceResourceLoaderImpl.new()
|
142
|
+
end
|
143
|
+
def getImageServiceURL(service, stats)
|
144
|
+
config = getConfiguration()
|
145
|
+
if Type::resolveClass("com.wiris.editor.services.PublicServices") != nil
|
146
|
+
if (config::getProperty(ConfigurationKeys::SERVICE_HOST,nil) == "www.wiris.net")
|
147
|
+
return self.getConfiguration()::getProperty(ConfigurationKeys::CONTEXT_PATH,"/") + "/editor/editor"
|
148
|
+
end
|
149
|
+
end
|
150
|
+
protocol = config::getProperty(ConfigurationKeys::SERVICE_PROTOCOL,nil)
|
151
|
+
port = config::getProperty(ConfigurationKeys::SERVICE_PORT,nil)
|
152
|
+
url = config::getProperty(ConfigurationKeys::INTEGRATION_PATH,nil)
|
153
|
+
if (protocol == nil) && (url != nil)
|
154
|
+
if StringTools::startsWith(url,"https")
|
155
|
+
protocol = "https"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
if protocol == nil
|
159
|
+
protocol = "http"
|
160
|
+
end
|
161
|
+
if port != nil
|
162
|
+
if (protocol == "http")
|
163
|
+
if !(port == "80")
|
164
|
+
port = ":" + port
|
165
|
+
else
|
166
|
+
port = ""
|
167
|
+
end
|
168
|
+
end
|
169
|
+
if (protocol == "https")
|
170
|
+
if !(port == "443")
|
171
|
+
port = ":" + port
|
172
|
+
else
|
173
|
+
port = ""
|
174
|
+
end
|
175
|
+
end
|
176
|
+
else
|
177
|
+
port = ""
|
178
|
+
end
|
179
|
+
domain = config::getProperty(ConfigurationKeys::SERVICE_HOST,nil)
|
180
|
+
path = config::getProperty(ConfigurationKeys::SERVICE_PATH,nil)
|
181
|
+
if service != nil
|
182
|
+
_end = path::lastIndexOf("/")
|
183
|
+
if _end == -1
|
184
|
+
path = service
|
185
|
+
else
|
186
|
+
path = (Std::substr(path,0,_end).to_s + "/") + service
|
187
|
+
end
|
188
|
+
end
|
189
|
+
if stats
|
190
|
+
path = addStats(path)
|
191
|
+
end
|
192
|
+
return (((protocol + "://") + domain) + port) + path
|
193
|
+
end
|
194
|
+
def addProxy(h)
|
195
|
+
conf = self.getConfiguration()
|
196
|
+
proxyEnabled = conf::getProperty(ConfigurationKeys::HTTPPROXY,"false")
|
197
|
+
if (proxyEnabled == "true")
|
198
|
+
host = conf::getProperty(ConfigurationKeys::HTTPPROXY_HOST,nil)
|
199
|
+
port = Std::parseInt(conf::getProperty(ConfigurationKeys::HTTPPROXY_PORT,"80"))
|
200
|
+
if (host != nil) && (host::length() > 0)
|
201
|
+
user = conf::getProperty(ConfigurationKeys::HTTPPROXY_USER,nil)
|
202
|
+
pass = conf::getProperty(ConfigurationKeys::HTTPPROXY_PASS,nil)
|
203
|
+
h::setProxy(HttpProxy::newHttpProxy(host,port,user,pass))
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
def addReferer(h)
|
208
|
+
conf = self.getConfiguration()
|
209
|
+
if (conf::getProperty("wirisexternalplugin","false") == "true")
|
210
|
+
h::setHeader("Referer",conf::getProperty(ConfigurationKeys::EXTERNAL_REFERER,"external referer not found"))
|
211
|
+
else
|
212
|
+
h::setHeader("Referer",conf::getProperty(ConfigurationKeys::REFERER,""))
|
213
|
+
end
|
214
|
+
end
|
215
|
+
def addCorsHeaders(response, origin)
|
216
|
+
conf = self.getConfiguration()
|
217
|
+
if (conf::getProperty("wiriscorsenabled","false") == "true")
|
218
|
+
confDir = conf::getProperty(ConfigurationKeys::CONFIGURATION_PATH,nil)
|
219
|
+
corsConfFile = confDir + "/corsservers.ini"
|
220
|
+
s = Storage::newStorage(corsConfFile)
|
221
|
+
if s::exists()
|
222
|
+
dir = s::read()
|
223
|
+
allowedHosts = Std::split(dir,"\n")
|
224
|
+
if allowedHosts::contains_(origin)
|
225
|
+
response::setHeader("Access-Control-Allow-Origin",origin)
|
226
|
+
end
|
227
|
+
else
|
228
|
+
response::setHeader("Access-Control-Allow-Origin","*")
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
def addStats(url)
|
233
|
+
saveMode = self.getConfiguration()::getProperty(ConfigurationKeys::SAVE_MODE,"xml")
|
234
|
+
externalPlugin = self.getConfiguration()::getProperty(ConfigurationKeys::EXTERNAL_PLUGIN,"false")
|
235
|
+
begin
|
236
|
+
version = Storage::newResourceStorage("VERSION")::read()
|
237
|
+
end
|
238
|
+
begin
|
239
|
+
tech = StringTools::replace(Storage::newResourceStorage("tech.txt")::read(),"\n","")
|
240
|
+
tech = StringTools::replace(tech,"\r","")
|
241
|
+
end
|
242
|
+
if url::indexOf("?") != -1
|
243
|
+
return (((((((url + "&stats-mode=") + saveMode) + "&stats-version=") + version) + "&stats-scriptlang=") + tech) + "&external=") + externalPlugin
|
244
|
+
else
|
245
|
+
return (((((((url + "?stats-mode=") + saveMode) + "&stats-version=") + version) + "&stats-scriptlang=") + tech) + "&external=") + externalPlugin
|
246
|
+
end
|
247
|
+
end
|
248
|
+
def isEditorLicensed()
|
249
|
+
licenseClass = Type::resolveClass("com.wiris.util.sys.License")
|
250
|
+
if licenseClass != nil
|
251
|
+
init = Reflect::field(licenseClass,"init")
|
252
|
+
initMethodParams = Array.new()
|
253
|
+
initMethodParams::push(self.getConfiguration()::getProperty(ConfigurationKeys::EDITOR_KEY,""))
|
254
|
+
initMethodParams::push("")
|
255
|
+
initMethodParams::push([4, 5, 9, 10])
|
256
|
+
Reflect::callMethod(licenseClass,init,initMethodParams)
|
257
|
+
isLicensedMethod = Reflect::field(licenseClass,"isLicensed")
|
258
|
+
isLicensedObject = Reflect::callMethod(licenseClass,isLicensedMethod,nil)
|
259
|
+
if Type::getClassName(Type::getClass(isLicensedObject))::indexOf("Boolean") != -1
|
260
|
+
isLicensed = Boolean::valueOf(isLicensedObject::toString())
|
261
|
+
else
|
262
|
+
isLicensed = (isLicensedObject)
|
263
|
+
end
|
264
|
+
return (isLicensed)
|
265
|
+
end
|
266
|
+
return false
|
267
|
+
end
|
268
|
+
def getImageFormatController()
|
269
|
+
if (@configuration::getProperty(ConfigurationKeys::IMAGE_FORMAT,"png") == "svg")
|
270
|
+
imageFormatController = ImageFormatControllerSvg.new()
|
271
|
+
else
|
272
|
+
imageFormatController = ImageFormatControllerPng.new()
|
273
|
+
end
|
274
|
+
return imageFormatController
|
275
|
+
end
|
276
|
+
def newGenericParamsProvider(properties)
|
277
|
+
return GenericParamsProviderImpl.new(properties)
|
278
|
+
end
|
279
|
+
|
280
|
+
@storageAndCacheCacheObject = nil
|
281
|
+
@storageAndCacheCacheFormulaObject = nil
|
282
|
+
@customParamsProvider = nil
|
283
|
+
@accessProvider = nil
|
251
284
|
end
|
252
|
-
end
|
253
285
|
end
|