Skip to content

Commit f11915e

Browse files
committed
LPD-52709 Prepare editors to use hashed URLs
Note that we are not hashing the file names yet because they rely on Java tooling but at least we leverage the new configurable time based caching infrastructure.
1 parent 26138c8 commit f11915e

File tree

3 files changed

+13
-13
lines changed
  • modules/apps/frontend-editor

3 files changed

+13
-13
lines changed

modules/apps/frontend-editor/frontend-editor-alloyeditor-web/src/main/resources/META-INF/resources/resources.jsp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
<%@ include file="/init.jsp" %>
99

1010
<%
11+
String alloyEditorServletContextName = PortalWebResourcesUtil.getServletContext(
12+
PortalWebResourceConstants.RESOURCE_TYPE_EDITOR_ALLOYEDITOR
13+
).getServletContextName();
14+
String ckEditorServletContextName = PortalWebResourcesUtil.getServletContext(
15+
PortalWebResourceConstants.RESOURCE_TYPE_EDITOR_CKEDITOR
16+
).getServletContextName();
1117
String editorName = (String)request.getAttribute(AlloyEditorConstants.ATTRIBUTE_NAMESPACE + ":editorName");
1218
%>
1319

@@ -16,18 +22,14 @@ String editorName = (String)request.getAttribute(AlloyEditorConstants.ATTRIBUTE_
1622
>
1723
<aui:link href='<%= PortalUtil.getStaticResourceURL(request, themeDisplay.getCDNHost() + PortalWebResourcesUtil.getContextPath(PortalWebResourceConstants.RESOURCE_TYPE_EDITOR_ALLOYEDITOR) + "/alloyeditor/assets/alloy-editor-atlas.css") %>' rel="stylesheet" senna="temporary" type="text/css" />
1824

19-
<%
20-
long javaScriptLastModified = PortalWebResourcesUtil.getLastModified(PortalWebResourceConstants.RESOURCE_TYPE_EDITOR_ALLOYEDITOR);
21-
%>
22-
2325
<aui:script senna="temporary" type="text/javascript">
2426
window.ALLOYEDITOR_BASEPATH =
2527
'<%= PortalUtil.getPathProxy() + application.getContextPath() %>/alloyeditor/';
2628
</aui:script>
2729

28-
<aui:script id='<%= namespace + "ckEditorScript" %>' senna="temporary" src='<%= HtmlUtil.escapeAttribute(PortalUtil.getStaticResourceURL(request, themeDisplay.getCDNHost() + PortalWebResourcesUtil.getContextPath(PortalWebResourceConstants.RESOURCE_TYPE_EDITOR_CKEDITOR) + "/ckeditor/ckeditor.js", javaScriptLastModified)) %>' type="text/javascript"></aui:script>
30+
<aui:script hashedFile="<%= true %>" id='<%= namespace + "ckEditorScript" %>' senna="temporary" src='<%= ckEditorServletContextName + "/ckeditor/ckeditor.js" %>' type="text/javascript"></aui:script>
2931

30-
<aui:script id='<%= namespace + "alloyEditorScript" %>' senna="temporary" src='<%= HtmlUtil.escapeAttribute(PortalUtil.getStaticResourceURL(request, themeDisplay.getCDNHost() + PortalWebResourcesUtil.getContextPath(PortalWebResourceConstants.RESOURCE_TYPE_EDITOR_ALLOYEDITOR) + "/alloyeditor/alloy-editor-no-ckeditor-min.js", javaScriptLastModified)) %>' type="text/javascript"></aui:script>
32+
<aui:script hashedFile="<%= true %>" id='<%= namespace + "alloyEditorScript" %>' senna="temporary" src='<%= alloyEditorServletContextName + "/alloyeditor/alloy-editor-no-ckeditor-min.js" %>' type="text/javascript"></aui:script>
3133

3234
<liferay-util:dynamic-include key='<%= "com.liferay.frontend.editor.alloyeditor.web#" + editorName + "#additionalResources" %>' />
3335

modules/apps/frontend-editor/frontend-editor-ckeditor-web/src/main/resources/META-INF/resources/init.jsp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ page import="com.liferay.portal.kernel.util.GetterUtil" %><%@
3030
page import="com.liferay.portal.kernel.util.HashMapBuilder" %><%@
3131
page import="com.liferay.portal.kernel.util.HtmlUtil" %><%@
3232
page import="com.liferay.portal.kernel.util.JavaConstants" %><%@
33-
page import="com.liferay.portal.kernel.util.PortalUtil" %><%@
3433
page import="com.liferay.portal.kernel.util.SessionClicks" %><%@
3534
page import="com.liferay.portal.kernel.util.TextFormatter" %><%@
3635
page import="com.liferay.portal.kernel.util.URLCodec" %><%@

modules/apps/frontend-editor/frontend-editor-ckeditor-web/src/main/resources/META-INF/resources/resources.jsp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<%@ include file="/init.jsp" %>
99

1010
<%
11+
String ckEditorServletContextName = PortalWebResourcesUtil.getServletContext(
12+
PortalWebResourceConstants.RESOURCE_TYPE_EDITOR_CKEDITOR
13+
).getServletContextName();
1114
String editorName = (String)request.getAttribute(CKEditorConstants.ATTRIBUTE_NAMESPACE + ":editorName");
1215
boolean inlineEdit = GetterUtil.getBoolean((String)request.getAttribute(CKEditorConstants.ATTRIBUTE_NAMESPACE + ":inlineEdit"));
1316
String inlineEditSaveURL = GetterUtil.getString((String)request.getAttribute(CKEditorConstants.ATTRIBUTE_NAMESPACE + ":inlineEditSaveURL"));
@@ -22,14 +25,10 @@ String inlineEditSaveURL = GetterUtil.getString((String)request.getAttribute(CKE
2225
}
2326
</aui:style>
2427

25-
<%
26-
long javaScriptLastModified = PortalWebResourcesUtil.getLastModified(PortalWebResourceConstants.RESOURCE_TYPE_EDITOR_CKEDITOR);
27-
%>
28-
29-
<aui:script senna="temporary" src='<%= HtmlUtil.escapeAttribute(PortalUtil.getStaticResourceURL(request, themeDisplay.getCDNHost() + PortalWebResourcesUtil.getContextPath(PortalWebResourceConstants.RESOURCE_TYPE_EDITOR_CKEDITOR) + "/ckeditor/ckeditor.js", javaScriptLastModified)) %>' type="text/javascript"></aui:script>
28+
<aui:script hashedFile="<%= true %>" senna="temporary" src='<%= ckEditorServletContextName + "/ckeditor/ckeditor.js" %>' type="text/javascript"></aui:script>
3029

3130
<c:if test="<%= inlineEdit && Validator.isNotNull(inlineEditSaveURL) %>">
32-
<aui:script senna="temporary" src='<%= HtmlUtil.escapeAttribute(PortalUtil.getStaticResourceURL(request, themeDisplay.getCDNHost() + PortalWebResourcesUtil.getContextPath(PortalWebResourceConstants.RESOURCE_TYPE_EDITOR_CKEDITOR) + "/js/legacy/main.js", javaScriptLastModified)) %>' type="text/javascript"></aui:script>
31+
<aui:script hashedFile="<%= true %>" senna="temporary" src='<%= ckEditorServletContextName + "/js/legacy/main.js" %>' type="text/javascript"></aui:script>
3332
</c:if>
3433

3534
<liferay-util:dynamic-include key='<%= "com.liferay.frontend.editor.ckeditor.web#" + editorName + "#additionalResources" %>' />

0 commit comments

Comments
 (0)