Code source wiki de MacroService
Version 8.1 par Xavier Richard le 01/06/2022 à 23:21
Afficher les derniers auteurs
author | version | line-number | content |
---|---|---|---|
1 | {{include reference="CKEditor.VelocityMacros" /}} | ||
2 | |||
3 | {{velocity output="false"}} | ||
4 | ## ================================================================ | ||
5 | ## Returned JSON format: | ||
6 | ## | ||
7 | ## { | ||
8 | ## 'options': { | ||
9 | ## 'allMacrosExcludedCategories': [ | ||
10 | ## (translated category name), ... | ||
11 | ## ] | ||
12 | ## }, | ||
13 | ## 'list': [ | ||
14 | ## { | ||
15 | ## 'id': (macro id), | ||
16 | ## 'name': (translated macro name), | ||
17 | ## 'description': (translated macro description), | ||
18 | ## 'defaultCategory': (translated macro category) | ||
19 | ## }, | ||
20 | ## ... | ||
21 | ## ], | ||
22 | ## 'notinstalled': [ | ||
23 | ## { | ||
24 | ## 'id': (macro id), | ||
25 | ## 'name': (translated macro name), | ||
26 | ## 'description': (translated macro description), | ||
27 | ## 'defaultCategory': '_notinstalled', | ||
28 | ## 'extensionId': (extension id) | ||
29 | ## 'extensionVersion': (extension version) | ||
30 | ## 'extensionType': (extension type) | ||
31 | ## 'extensionRecommended': (is extension recommended) | ||
32 | ## 'extensionName': (extension name) | ||
33 | ## 'extensionSummary': (extension summary) | ||
34 | ## ] | ||
35 | ## }, | ||
36 | ## ... | ||
37 | ## ] | ||
38 | ## } | ||
39 | ## ================================================================ | ||
40 | #macro (getMacroList $syntaxId) | ||
41 | #set ($syntax = $services.rendering.resolveSyntax($syntaxId)) | ||
42 | #set ($macroDescriptors = $services.rendering.getMacroDescriptors($syntax)) | ||
43 | #if (!$macroDescriptors) | ||
44 | ## Before XWiki 9.7RC1 we had to use APIs that require programming rights. | ||
45 | #set ($macroDescriptors = []) | ||
46 | #try() | ||
47 | #set ($macroManager = $services.component.getInstance('org.xwiki.rendering.macro.MacroManager')) | ||
48 | #foreach ($macroId in $macroManager.getMacroIds($syntax)) | ||
49 | #set ($macroDescriptor = $macroManager.getMacro($macroId).descriptor) | ||
50 | #set ($discard = $macroDescriptors.add($macroDescriptor)) | ||
51 | #end | ||
52 | #end | ||
53 | #end | ||
54 | #set ($data = {}) | ||
55 | #set ($allMacrosExcludedCategories = []) | ||
56 | #set ($discard = $allMacrosExcludedCategories.add("#maybeTranslate('rendering.macroCategory.Internal' 'Internal')")) | ||
57 | #set ($discard = $allMacrosExcludedCategories.add("#maybeTranslate('rendering.macroCategory.Deprecated' 'Deprecated')")) | ||
58 | #set ($discard = $data.put('options', { 'allMacrosExcludedCategories' : $allMacrosExcludedCategories })) | ||
59 | #set ($macroList = []) | ||
60 | #foreach ($macroDescriptor in $macroDescriptors) | ||
61 | #set ($macroTranslationKey = "rendering.macro.$macroDescriptor.id") | ||
62 | #set ($macroCategoryTranslationKey = "rendering.macroCategory.$macroDescriptor.defaultCategory") | ||
63 | #set ($discard = $macroList.add({ | ||
64 | 'id': $macroDescriptor.id, | ||
65 | 'name': "#maybeTranslate(""${macroTranslationKey}.name"" $macroDescriptor.name)", | ||
66 | 'description': "#maybeTranslate(""${macroTranslationKey}.description"" $macroDescriptor.description)", | ||
67 | 'defaultCategory': "#maybeTranslate($macroCategoryTranslationKey $macroDescriptor.defaultCategory)" | ||
68 | })) | ||
69 | #end | ||
70 | #set ($macroList = $resolvedSortTool.sort($macroList, 'name')) | ||
71 | #set ($discard = $data.put('list', $macroList)) | ||
72 | ## Get macros provided by compatible available extensions | ||
73 | #set ($macroExtensionsList = []) | ||
74 | #set($extensionQuery = $services.extension.index.newQuery("$!request.search")) | ||
75 | #set ($discard = $extensionQuery.addFilter('components__org.xwiki.rendering.macro.Macro', '', 'MATCH')) | ||
76 | #if ($xcontext.isMainWiki()) | ||
77 | #set ($discard = $extensionQuery.setCompatible(true, '', "wiki:$xcontext.database")) | ||
78 | #else | ||
79 | #set ($discard = $extensionQuery.setCompatible(true, "wiki:$xcontext.database")) | ||
80 | #end | ||
81 | #set ($discard = $extensionQuery.setInstalled(false, '', "wiki:$xcontext.database")) | ||
82 | #set ($extensions = $services.extension.index.repository.search($extensionQuery)) | ||
83 | #if ($extensions.size > 0) | ||
84 | #set ($macroExtensionsMap = {}) | ||
85 | #foreach ($extension in $extensions) | ||
86 | ## TODO: move to a proper generic API to check if an extension can be installed by a given user | ||
87 | #if ($services.security.authorization.hasAccess('programming') | ||
88 | || (($extension.type == 'xar' || $extension.type == 'webjar') | ||
89 | && $services.security.authorization.hasAccess('admin', "wiki:$xcontext.database") && $services.extension.isAllowed($extension, "wiki:$xcontext.database"))) | ||
90 | #foreach ($extensionComponent in $extension.getComponents()) | ||
91 | #if ($extensionComponent.roleType == 'org.xwiki.rendering.macro.Macro') | ||
92 | #set ($discard = $macroExtensionsList.add({ | ||
93 | 'id' : { | ||
94 | 'id' : $extensionComponent.roleHint | ||
95 | }, | ||
96 | 'name': $extensionComponent.roleHint, | ||
97 | 'description': $extension.summary, | ||
98 | 'defaultCategory': '_notinstalled', | ||
99 | 'extensionId' : $extension.id.id, | ||
100 | 'extensionVersion' : $extension.id.version.value, | ||
101 | 'extensionType' : $extension.type, | ||
102 | 'extensionRecommended': $extension.recommended, | ||
103 | 'extensionName': $extension.name, | ||
104 | 'extensionSummary': $extension.summary | ||
105 | })) | ||
106 | #end | ||
107 | #end | ||
108 | #end | ||
109 | #end | ||
110 | #set ($discard = $data.put('notinstalled', $macroExtensionsList)) | ||
111 | #end | ||
112 | #end | ||
113 | |||
114 | #macro (maybeGetMacroDescriptor $macroIdAsString) | ||
115 | #set ($xmacro = $NULL) | ||
116 | #set ($macroDescriptor = $NULL) | ||
117 | #set ($macroId = $services.rendering.resolveMacroId($macroIdAsString)) | ||
118 | #if ($macroId) | ||
119 | #set ($macroDescriptor = $services.rendering.getMacroDescriptor($macroId)) | ||
120 | #if (!$macroDescriptor && $macroId.syntax) | ||
121 | ## Try the macro id without the syntax. | ||
122 | #set ($macroId = $services.rendering.resolveMacroId($macroId.id)) | ||
123 | #set ($macroDescriptor = $services.rendering.getMacroDescriptor($macroId)) | ||
124 | #end | ||
125 | #else | ||
126 | ## Either the macro id could not be resolved (unlikely) or we are on an older XWiki instance (before 10.10RC1) where | ||
127 | ## we had to use APIs that require programming rights. | ||
128 | #getMacroWithPR($macroIdAsString) | ||
129 | #if ($xmacro) | ||
130 | #set ($macroDescriptor = $xmacro.descriptor) | ||
131 | #end | ||
132 | #end | ||
133 | #if ($macroDescriptor) | ||
134 | #getMacroDescriptor($macroDescriptor) | ||
135 | #if ($xmacro) | ||
136 | ## supportsInlineMode was not exposed on the macro descriptor before XWiki 10.10RC1. | ||
137 | #set ($data.supportsInlineMode = $xmacro.supportsInlineMode()) | ||
138 | #end | ||
139 | #end | ||
140 | #end | ||
141 | |||
142 | #macro (getMacroWithPR $macroIdAsString) | ||
143 | #set ($xmacro = $NULL) | ||
144 | #try() | ||
145 | #set ($macroIdFactory = $services.component.getInstance('org.xwiki.rendering.macro.MacroIdFactory')) | ||
146 | #set ($macroId = $macroIdFactory.createMacroId($macroIdAsString)) | ||
147 | #set ($macroManager = $services.component.getInstance('org.xwiki.rendering.macro.MacroManager')) | ||
148 | #if ($macroManager.exists($macroId)) | ||
149 | #set ($xmacro = $macroManager.getMacro($macroId)) | ||
150 | #elseif ($macroId.syntax) | ||
151 | ## Try the macro id without the syntax. | ||
152 | #set ($macroId = $macroIdFactory.createMacroId($macroId.id)) | ||
153 | #if ($macroManager.exists($macroId)) | ||
154 | #set ($xmacro = $macroManager.getMacro($macroId)) | ||
155 | #end | ||
156 | #end | ||
157 | #end | ||
158 | #end | ||
159 | |||
160 | #macro (getMacroDescriptor $macroDescriptor) | ||
161 | ## Translate the macro name and description. | ||
162 | #set ($macroTranslationKey = "rendering.macro.$macroDescriptor.id") | ||
163 | #ckeditor_initRequiredSkinExtensions() | ||
164 | #set ($data = { | ||
165 | 'id': $macroDescriptor.id, | ||
166 | 'name': "#maybeTranslate(""${macroTranslationKey}.name"" $macroDescriptor.name)", | ||
167 | 'description': "#maybeTranslate(""${macroTranslationKey}.description"" $macroDescriptor.description)", | ||
168 | 'defaultCategory': $macroDescriptor.defaultCategory, | ||
169 | 'supportsInlineMode': $macroDescriptor.supportsInlineMode(), | ||
170 | 'parameterDescriptorMap': {} | ||
171 | }) | ||
172 | #if ($macroDescriptor.contentDescriptor) | ||
173 | ## Translate the content label and description. | ||
174 | ## Treat the macro content as if it is the last macro parameter. | ||
175 | #set ($data.contentDescriptor = { | ||
176 | 'name': "#maybeTranslate('rendering.macroContent' 'Content')", | ||
177 | 'description': "#maybeTranslate(""${macroTranslationKey}.content.description"" | ||
178 | $macroDescriptor.contentDescriptor.description)", | ||
179 | 'mandatory': $macroDescriptor.contentDescriptor.mandatory, | ||
180 | 'deprecated': $macroDescriptor.contentDescriptor.deprecated, | ||
181 | 'advanced': $macroDescriptor.contentDescriptor.advanced, | ||
182 | 'defaultValue': $macroDescriptor.contentDescriptor.defaultValue, | ||
183 | 'type': $macroDescriptor.contentDescriptor.type, | ||
184 | 'editTemplate': '<textarea name="$content" rows="7"></textarea>', | ||
185 | 'index': $macroDescriptor.parameterDescriptorMap.size() | ||
186 | }) | ||
187 | #fixDescriptorType($data.contentDescriptor) | ||
188 | #end | ||
189 | #set ($groupDescriptorTree = {}) | ||
190 | #foreach ($entry in $macroDescriptor.parameterDescriptorMap.entrySet()) | ||
191 | #set ($parameterDescriptor = $entry.value) | ||
192 | ## Translate the parameter name and description. | ||
193 | #set ($parameterTranslationKey = "${macroTranslationKey}.parameter.$parameterDescriptor.id") | ||
194 | ## Note: The displayHidden parameter is new in XWiki 12.4RC1 so make sure we set 'hidden' to false if it doesn't | ||
195 | ## exist | ||
196 | #if ("$!parameterDescriptor.displayHidden" != '') | ||
197 | #set ($parameterHidden = $parameterDescriptor.displayHidden) | ||
198 | #else | ||
199 | #set ($parameterHidden = false) | ||
200 | #end | ||
201 | #set ($translatedParameterDescriptor = { | ||
202 | 'id': $parameterDescriptor.id, | ||
203 | 'name': "#maybeTranslate(""${parameterTranslationKey}.name"" $parameterDescriptor.name)", | ||
204 | 'description': "#maybeTranslate(""${parameterTranslationKey}.description"" $parameterDescriptor.description)", | ||
205 | 'mandatory': $parameterDescriptor.mandatory, | ||
206 | 'deprecated': $parameterDescriptor.deprecated, | ||
207 | 'advanced': $parameterDescriptor.advanced, | ||
208 | 'defaultValue': $parameterDescriptor.defaultValue, | ||
209 | 'type': $parameterDescriptor.displayType, | ||
210 | 'hidden' : $parameterHidden, | ||
211 | 'index': $foreach.index | ||
212 | }) | ||
213 | #if ("$!translatedParameterDescriptor.type" == '') | ||
214 | ## displayType is not available before XWiki 11.0 so we need to fall back on parameterType. | ||
215 | #set ($translatedParameterDescriptor.type = $parameterDescriptor.parameterType) | ||
216 | #end | ||
217 | #set ($translatedParameterDescriptor.caseInsensitive = $translatedParameterDescriptor.type.isEnum()) | ||
218 | #set ($groupDescriptor = $parameterDescriptor.groupDescriptor) | ||
219 | #if ($groupDescriptor) | ||
220 | #handleMacroParameterGroup($groupDescriptor $groupDescriptorTree $translatedParameterDescriptor) | ||
221 | #end | ||
222 | #if ($translatedParameterDescriptor.type.getName() == 'java.lang.String' | ||
223 | && ($parameterDescriptor.defaultValue == 'false' || $parameterDescriptor.defaultValue == 'true') | ||
224 | && $macroDescriptor.parametersBeanClass.getSimpleName() == 'WikiMacroParameters') | ||
225 | #set ($translatedParameterDescriptor.defaultValue = $parameterDescriptor.defaultValue == 'true') | ||
226 | #set ($translatedParameterDescriptor.type = $translatedParameterDescriptor.defaultValue.getClass()) | ||
227 | #end | ||
228 | #set ($htmlDisplayerParameters = {'name': $parameterDescriptor.id}) | ||
229 | #if ($translatedParameterDescriptor.group) | ||
230 | #set ($discard = $htmlDisplayerParameters.put('data-property-group', | ||
231 | $stringtool.join($translatedParameterDescriptor.group, '/'))) | ||
232 | #end | ||
233 | #set ($translatedParameterDescriptor.editTemplate = $services.display.html.display( | ||
234 | $translatedParameterDescriptor.type, $translatedParameterDescriptor.defaultValue, $htmlDisplayerParameters, 'edit' | ||
235 | )) | ||
236 | #if ("$!translatedParameterDescriptor.editTemplate" == '') | ||
237 | #set ($translatedParameterDescriptor.editTemplate = "#getMacroParameterEditTemplate( | ||
238 | $translatedParameterDescriptor)") | ||
239 | #end | ||
240 | #set ($translatedParameterDescriptor.editTemplate = $translatedParameterDescriptor.editTemplate.trim()) | ||
241 | #fixDescriptorType($translatedParameterDescriptor) | ||
242 | ## Make sure the key is lowercase (for XWiki <9.0). | ||
243 | ## See XWIKI-13990: Inconsistency between Java-based and Wiki-based rendering macros regarding the parameter | ||
244 | ## descriptor map keys | ||
245 | #set ($discard = $data.parameterDescriptorMap.put($entry.key.toLowerCase(), $translatedParameterDescriptor)) | ||
246 | #end | ||
247 | #if ($groupDescriptorTree.groups) | ||
248 | #set ($data.groupDescriptorTree = $groupDescriptorTree.groups) | ||
249 | #end | ||
250 | #set ($data.requiredSkinExtensions = "#ckeditor_getRequiredSkinExtensions()") | ||
251 | #end | ||
252 | |||
253 | #macro (fixDescriptorType $descriptor) | ||
254 | ## The goal of this code is to obtain a normalized string representation of the type specified in the descriptor. | ||
255 | ## See XCOMMONS-1583: Define a stable way to serialize types | ||
256 | ## | ||
257 | ## The type specified in the descriptor can be any implementation of java.lang.reflect.Type, not necessarily a | ||
258 | ## java.lang.Class. We can't use toString() because the return of Class#toString() is different than Class#getName(). | ||
259 | ## We can't use Type#getTypeName() either because the access to this method is restricted from Velocity. The only | ||
260 | ## option for now is to try #getName() first and fall back on #toString() for types that are not instances of | ||
261 | ## java.lang.Class. | ||
262 | #set ($typeName = $descriptor.type.getName()) | ||
263 | #if ("$!typeName" == '') | ||
264 | ## Probably not a java.lang.Class. Fall back on #toString(). | ||
265 | #set ($typeName = "$!descriptor.type") | ||
266 | #end | ||
267 | ## Remove whitespace from the type name in order to have a single string representation. | ||
268 | #set ($descriptor.type = $typeName.replaceAll('\s+', '')) | ||
269 | #end | ||
270 | |||
271 | ## Builds the group tree with the following structure: | ||
272 | ## | ||
273 | ## { | ||
274 | ## 'parentGroupId': { | ||
275 | ## 'id': 'parentGroupId', | ||
276 | ## 'name': 'Parent Group', | ||
277 | ## 'feature': 'someFeature', | ||
278 | ## 'groups': { | ||
279 | ## 'childGroupId': {...}, | ||
280 | ## ... | ||
281 | ## } | ||
282 | ## }, | ||
283 | ## ... | ||
284 | ## } | ||
285 | #macro (handleMacroParameterGroup $groupDescriptor $groupDescriptorTree $translatedParameterDescriptor) | ||
286 | #if ($groupDescriptor.group && $groupDescriptor.group.size() > 0) | ||
287 | #set ($translatedParameterDescriptor.group = $groupDescriptor.group) | ||
288 | #set ($parentGroup = $groupDescriptorTree) | ||
289 | #foreach ($groupId in $groupDescriptor.group) | ||
290 | #if (!$parentGroup.groups) | ||
291 | #set ($parentGroup.groups = {}) | ||
292 | #end | ||
293 | #set ($childGroup = $parentGroup.groups.get($groupId)) | ||
294 | #if (!$childGroup) | ||
295 | #if ($groupId == $translatedParameterDescriptor.id) | ||
296 | #set ($groupName = $translatedParameterDescriptor.name) | ||
297 | #else | ||
298 | #set ($groupTranslationKey = "${macroTranslationKey}.group.$groupId") | ||
299 | #set ($groupName = "#maybeTranslate(""${groupTranslationKey}.name"" $groupId)") | ||
300 | #end | ||
301 | #set ($childGroup = { | ||
302 | 'id': $groupId, | ||
303 | 'name': $groupName | ||
304 | }) | ||
305 | #set ($discard = $parentGroup.groups.put($groupId, $childGroup)) | ||
306 | #end | ||
307 | #set ($parentGroup = $childGroup) | ||
308 | #end | ||
309 | #if ("$!groupDescriptor.feature" != '') | ||
310 | #set ($parentGroup.feature = $groupDescriptor.feature) | ||
311 | #end | ||
312 | #elseif ($groupDescriptor.feature) | ||
313 | ## This group is made of a single parameter. The feature then refers to this parameter. | ||
314 | #set ($translatedParameterDescriptor.feature = $groupDescriptor.feature) | ||
315 | #end | ||
316 | #end | ||
317 | |||
318 | #macro (getMacroParameterEditTemplate $translatedParameterDescriptor) | ||
319 | #if ($translatedParameterDescriptor.type.getName() == 'boolean' | ||
320 | || $translatedParameterDescriptor.type.getName() == 'java.lang.Boolean') | ||
321 | <input type="checkbox" name="$escapetool.xml($translatedParameterDescriptor.id)" value="true"/>## | ||
322 | ## We need to submit something in case the checkbox is not checked. | ||
323 | <input type="hidden" name="$escapetool.xml($translatedParameterDescriptor.id)" value="false"/> | ||
324 | #elseif ($translatedParameterDescriptor.type.isEnum()) | ||
325 | #if ($translatedParameterDescriptor.defaultValue) | ||
326 | #set ($enumValues = $translatedParameterDescriptor.defaultValue.values()) | ||
327 | #else | ||
328 | ## A parameter of type enum that doesn't have a default value is very unlikely. We attempt to read the list of | ||
329 | ## possible values from the enum type in this case, which is currently forbidden, but at least it will generate | ||
330 | ## a warning in the logs that will help us investigate the problem. | ||
331 | #set ($enumValues = $translatedParameterDescriptor.type.getEnumConstants()) | ||
332 | #end | ||
333 | <select name="$escapetool.xml($translatedParameterDescriptor.id)">## | ||
334 | #foreach ($enumValue in $enumValues) | ||
335 | #set ($value = $enumValue.name()) | ||
336 | #set ($label = "#maybeTranslate(""${parameterTranslationKey}.value.$value"" $enumValue)") | ||
337 | <option value="$escapetool.xml($value)">$escapetool.xml($label)</option>## | ||
338 | #end | ||
339 | </select> | ||
340 | #else | ||
341 | <input type="text" name="$escapetool.xml($translatedParameterDescriptor.id)"/> | ||
342 | #end | ||
343 | #end | ||
344 | |||
345 | #macro (maybeTranslate $key $defaultValue) | ||
346 | #if ($services.localization.get($key)) | ||
347 | $services.localization.render($key)## | ||
348 | #else | ||
349 | $!defaultValue## | ||
350 | #end | ||
351 | #end | ||
352 | |||
353 | #macro (installMacroExtension $extensionId, $extensionVersion) | ||
354 | #set ($extension = $services.extension.index.repository.resolve("$extensionId/$extensionVersion")) | ||
355 | #if ($extension) | ||
356 | ## Find where to install it | ||
357 | ## 1) Check if a diffferent version is already installed | ||
358 | ## 2) Check if it's allowed to install it at current wiki level | ||
359 | #set ($rootNamespace = $NULL) | ||
360 | #set ($currentWikiNamespace = "wiki:$xcontext.database") | ||
361 | #if ($services.extension.installed.getInstalledExtension($extensionId, $rootNamespace)) | ||
362 | #set ($extensionNamespace = $rootNamespace) | ||
363 | #elseif ($services.extension.installed.getInstalledExtension($extensionId, $currentWikiNamespace)) | ||
364 | #set ($extensionNamespace = $currentWikiNamespace) | ||
365 | #else | ||
366 | #if ($services.extension.isAllowed($extension, "wiki:$xcontext.database")) | ||
367 | #set ($extensionNamespace = $currentWikiNamespace) | ||
368 | #else | ||
369 | #set ($extensionNamespace = $NULL) | ||
370 | #end | ||
371 | #end | ||
372 | ## Make the install non interractive | ||
373 | #set ($installRequest = $services.extension.createInstallRequest($extensionId, $extensionVersion, $extensionNamespace)) | ||
374 | #set ($discard = $installRequest.setInteractive(false)) | ||
375 | ## Start the install | ||
376 | #set ($job = $services.extension.install($installRequest)) | ||
377 | ## Wait for the job to finish | ||
378 | #set ($discard = $job.join()) | ||
379 | #if ($job.status.error) | ||
380 | ## The install failed | ||
381 | $response.sendError(500, $exceptiontool.getRootCauseMessage($job.status.error)) | ||
382 | #else | ||
383 | ## The install succeeded | ||
384 | #set ($data = { | ||
385 | 'extensionId': $extensionId, | ||
386 | 'extensionVersion': $extensionVersion, | ||
387 | 'extensionNamespace': $extensionNamespace | ||
388 | }) | ||
389 | #end | ||
390 | #else | ||
391 | $response.sendError(404, $exceptiontool.getRootCauseMessage($job.status.error)) | ||
392 | #end | ||
393 | #end | ||
394 | {{/velocity}} | ||
395 | |||
396 | {{velocity wiki="false"}} | ||
397 | #if ("$!request.action" == 'install') | ||
398 | #if ($services.csrf.isTokenValid($request.form_token)) | ||
399 | #installMacroExtension($request.extensionId, $request.extensionVersion) | ||
400 | #else | ||
401 | $response.sendError(403) | ||
402 | #end | ||
403 | #elseif ("$!request.data" != '') | ||
404 | #set ($data = $NULL) | ||
405 | #if ($request.data == 'list') | ||
406 | #getMacroList($request.syntaxId) | ||
407 | #elseif ($request.data == 'descriptor') | ||
408 | #maybeGetMacroDescriptor($request.macroId) | ||
409 | #end | ||
410 | #if ($data) | ||
411 | #set ($discard = $response.setContentType('application/json')) | ||
412 | $jsontool.serialize($data) | ||
413 | #else | ||
414 | $response.sendError(404) | ||
415 | #end | ||
416 | #end | ||
417 | {{/velocity}} |