Se ha producido un error al procesar la plantilla.
Denied access to method or field getParameter of class org.apache.catalina.core.ApplicationHttpRequest
----
FTL stack trace ("~" means nesting-related):
- Failed at: #local paramValue = request.getParame... [in template "34352066712900#33336#65816767" in function "findMatchedItem" at line 55, column 5]
----
1<#--
2 LANGUAGE HEADER DROPDOWN
3 -->
4<#assign currentURL = themeDisplay.getURLCurrent()>
5<#assign baseURL = themeDisplay.getPortalURL()>
6<#assign relativeURL = currentURL?replace(baseURL, "")>
7
8<#assign translatableParams = ["ics", "ctn"] />
9<#assign matchedItemsCache = buildMatchedItemsCache(translatableParams, locale) />
10
11<#assign desc = themeDisplay.getLanguageId()?split("_")?first >
12<div class="select-btn" id="language-select" role="button" aria-haspopup="listbox" aria-expanded="false" tabindex="0">
13 <#assign siteLanguage = themeDisplay.getLocale().getDisplayLanguage( themeDisplay.getLocale() )?cap_first>
14 <span
15 class="sBtn-text text-uppercase d-flex align-content-center align-items-center">${desc} <span
16 class="fa-solid fa-chevron-down" aria-hidden="true"></span></span>
17</div>
18 <ul class="options hide" role="listbox" aria-labelledby="language-select">
19 <li class="option actives" style="pointer-events:none" role="option" aria-selected="true">
20 <span class="option-text">
21 <svg aria-hidden="true" class="lexicon-icon mr-2 lexicon-icon-${themeDisplay.getLanguageId()?replace('_', '-')?lower_case}">
22 <use href="/o/classic-theme/images/clay/icons.svg#${themeDisplay.getLanguageId()?replace('_', '-')?lower_case}"></use>
23 </svg>
24 ${siteLanguage}
25 </span>
26 </li>
27 <#if entries?has_content>
28 <#list entries as curLanguage>
29
30 <#if !curLanguage.isSelected()>
31
32 <p>url:${curLanguage.getURL()}</p>
33 <p>parameter ics:${request.getParameter("ics")}</p>
34 <p>matchedItem en_us:${matchedItemsCache["ics"].value_i18n["en_US"]}</p>
35 <p>${urlCodec}</p>
36 <p>${urlCodec.decodeURL("%2Fnormas%3Fics%3Dtest")}</p>
37 <p>${urlCodec.encodeURL("01 - General Aspects. Terminology.")}</p>
38
39
40 <#assign entryHref = buildTranslatedHref(curLanguage.getURL(), curLanguage.getLanguageId(), translatableParams, matchedItemsCache) />
41 <li class="option" role="option"><span class="option-text"> <a href="${entryHref}" class="language-entry-short-text"
42 lang="${curLanguage.getLanguageId()}">${curLanguage.getLongDisplayName()?capitalize}</a> </span></li>
43
44 </#if>
45 </#list>
46 </#if>
47</ul>
48
49
50<#-- ============================================================
51 Traduccion de parametros de la URL al cambiar de idioma
52 ============================================================ -->
53
54<#function findMatchedItem paramName locale>
55 <#local paramValue = request.getParameter(paramName)! />
56 <#if !paramValue?has_content>
57 <#return "" />
58 </#if>
59
60 <#local paramValueTrim = paramValue?trim />
61 <#local paramType = paramName?upper_case />
62 <#local endpointURL = "/c/selectoptions/?languageId=" + locale?string + "&sort=name:asc&filter=optionsType eq '" + paramType + "'" />
63 <#local optionsResponse = restClient.get(endpointURL) />
64
65 <#list optionsResponse.items![] as item>
66 <#local valueI18n = item.value_i18n![] />
67 <#local found = false />
68
69 <#list valueI18n?keys as key>
70 <#if valueI18n[key]! == paramValueTrim>
71 <#local found = true />
72 <#break />
73 </#if>
74 </#list>
75
76 <#if !found && (item.value!"") == paramValueTrim>
77 <#local found = true />
78 </#if>
79
80 <#if found>
81 <#return item />
82 </#if>
83 </#list>
84
85 <#return "" />
86</#function>
87
88<#function buildMatchedItemsCache paramNames locale>
89 <#local cache = {} />
90 <#list paramNames as paramName>
91 <#local cache = cache + {paramName: findMatchedItem(paramName, locale)} />
92 </#list>
93 <#return cache />
94</#function>
95
96<#function translateParamInURL originalURL paramName targetLanguageId matchedItemsCache>
97
98 <#local matchedItem = matchedItemsCache[paramName]!"" />
99
100 <#if !matchedItem?has_content>
101 <#return originalURL />
102 </#if>
103
104 <#local translatedValue =
105 matchedItem.value_i18n[targetLanguageId]!matchedItem.value!""
106 />
107
108 <#if !translatedValue?has_content>
109 <#return originalURL />
110 </#if>
111
112 <#-- Caso 1: URL de cambio de idioma con redirect -->
113 <#if originalURL?contains("redirect=")>
114
115 <#local redirectEncoded = originalURL?replace(
116 ".*redirect=([^&]+).*",
117 "$1",
118 "r"
119 ) />
120
121 <#local redirectDecoded = urlCodec.decodeURL(redirectEncoded) />
122
123 <#if redirectDecoded?matches(".*[?&]" + paramName + "=.*")>
124
125 <#local newRedirectDecoded = redirectDecoded?replace(
126 "([?&])" + paramName + "=[^&]*",
127 "$1" + paramName + "=" + translatedValue,
128 "r"
129 ) />
130
131 <#local newRedirectEncoded =
132 urlCodec.encodeURL(newRedirectDecoded)
133 />
134
135 <#return originalURL?replace(
136 redirectEncoded,
137 newRedirectEncoded
138 ) />
139
140 </#if>
141
142 <#return originalURL />
143
144 </#if>
145
146 <#-- Caso 2: URL normal -->
147 <#if originalURL?matches(".*[?&]" + paramName + "=.*")>
148
149 <#return originalURL?replace(
150 "([?&])" + paramName + "=[^&]*",
151 "$1" + paramName + "=" + translatedValue,
152 "r"
153 ) />
154
155 </#if>
156
157 <#return originalURL />
158
159</#function>
160
161<#function buildTranslatedHref originalURL targetLanguageId paramNames matchedItemsCache>
162 <#local resultURL = originalURL />
163
164 <#list paramNames as paramName>
165 <#local resultURL = translateParamInURL(resultURL, paramName, targetLanguageId, matchedItemsCache) />
166 </#list>
167
168 <#return resultURL />
169</#function>
170
171<#-- ============================================================ -->
172
173<script>
174 $(document).ready(function () {
175 // Toggle el estado del menu de idiomas
176 $('.select-btn').on('click', function () {
177 var expanded = $(this).attr('aria-expanded') === 'true';
178 $(this).attr('aria-expanded', !expanded);
179 $('.options').toggleClass('hide', expanded);
180 });
181
182 // Acciones de teclado para la lupa
183 $('.select-btn').on('keydown', function (e) {
184 if (e.key === 'Enter' || e.key === ' ') {
185 e.preventDefault(); // Evitar desplazamiento al presionar espacio
186 $(this).click(); // Simula el click para abrir/cerrar el menu
187 }
188 });
189
190 // Cerrar el menu al hacer clic en cualquier parte fuera de el
191 $(document).on('click', function (event) {
192 if (!$(event.target).closest('.select-btn, .options').length) {
193 $('.options').addClass('hide');
194 $('.select-btn').attr('aria-expanded', 'false');
195 }
196 });
197
198 // Navegar con las teclas de flecha
199 let options = $('.option');
200 let selectedIndex = 0;
201
202 options.on('keydown', function (e) {
203 if (e.key === 'ArrowDown') {
204 selectedIndex = (selectedIndex + 1) % options.length;
205 options.eq(selectedIndex).focus();
206 }
207 if (e.key === 'ArrowUp') {
208 selectedIndex = (selectedIndex - 1 + options.length) % options.length;
209 options.eq(selectedIndex).focus();
210 }
211 if (e.key === 'Enter') {
212 window.location.href = $(this).find('a').attr('href'); // Redirige a la opcion seleccionada
213 }
214 });
215 });
216</script>
El producto se ha añadido a la cesta de la compra
Listado normas citadas
-
URL del producto:
https://aenorportalesweb-uat.lxc.liferay.com/web/tienda/e/{friendlyURL_display-page-template}/{ClassNameId-CPDefinition}/{CPDefinition ID (Field: product.id)}
por ejemplo: https://aenorportalesweb-uat.lxc.liferay.com/web/tienda/e/producto-tienda/30025/${cpDefinitionId}










