private void populateComponentMetaData(final HstRequest request, final HstResponse response, final HstComponentWindow window) { final HstComponentConfiguration config = (HstComponentConfiguration)window.getComponentInfo(); if (!config.getCanonicalStoredLocation().contains(WORKSPACE_PATH_ELEMENT)) { log.debug("Component '{}' not editable as not part of hst:workspace configuration", config.toString()); return; } final Map<String, String> preambleAttributes = new HashMap<>(); final Map<String, String> epilogueAttributes = new HashMap<>(); populateAttributes(window, request, preambleAttributes, epilogueAttributes); response.addPreamble(createCommentWithAttr(preambleAttributes, response)); response.addEpilogue(createCommentWithAttr(epilogueAttributes, response)); }
@Override public void processWindowBeforeRender(HstComponentWindow window, HstRequest request, HstResponse response) { HstRequestContext requestContext = request.getRequestContext(); HstURL compUrl = createAsyncComponentRenderingURL(request, response); String url = HstRequestUtils.getFullyQualifiedHstURL(requestContext, compUrl, false); Element esiElem = response.createElement("esi:include"); esiElem.setAttribute("src", url); esiElem.setAttribute("onerror", "continue"); response.addPreamble(esiElem); }
@Override public void processWindowBeforeRender(HstComponentWindow window, HstRequest request, HstResponse response) { HstURL compUrl = createAsyncComponentRenderingURL(request, response); final Comment ssiComment = response.createComment("#include virtual=\"" + compUrl.toString() + "\" "); response.addPreamble(ssiComment); } }
@Override public void processWindowBeforeRender(HstComponentWindow window, HstRequest request, HstResponse response) { HstURL url = createAsyncComponentRenderingURL(request, response); Element hiddenDiv = response.createElement("div"); hiddenDiv.setAttribute("id", url.toString()); hiddenDiv.setAttribute("class", OBFUSCATED_ASYNC_VAR); hiddenDiv.setAttribute("style", "display:none;"); response.addPreamble(hiddenDiv); if (!response.containsHeadElement(HEAD_SCRIPT_KEY_HINT)) { Element headScript = response.createElement("script"); headScript.setAttribute("type","text/javascript"); headScript.setTextContent(getIOScript()); response.addHeadElement(headScript, HEAD_SCRIPT_KEY_HINT); Element endBodyScript = response.createElement("script"); endBodyScript.setAttribute(ContainerConstants.HEAD_ELEMENT_CONTRIBUTION_CATEGORY_HINT_ATTRIBUTE, "scripts"); endBodyScript.setAttribute("type", "text/javascript"); endBodyScript.setTextContent(OBFUSCATED_HIPPO_HST_VAR + ".AsyncPage.load();"); response.addHeadElement(endBodyScript, "asyncLoad"); } }