@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"); } }
@Override protected HstURL getUrl() { if (this.url == null) { // if hstResponse is retrieved, then this servlet has been dispatched by hst component. HstResponse hstResponse = (HstResponse) pageContext.getRequest().getAttribute(ContainerConstants.HST_RESPONSE); if (hstResponse == null && pageContext.getResponse() instanceof HstResponse) { hstResponse = (HstResponse) pageContext.getResponse(); } if (hstResponse != null) { this.url = hstResponse.createComponentRenderingURL(); } } return this.url; }
@Override protected HstURL getUrl() { if (this.url == null) { // if hstResponse is retrieved, then this servlet has been dispatched by hst component. HstResponse hstResponse = (HstResponse) pageContext.getRequest().getAttribute(ContainerConstants.HST_RESPONSE); if (hstResponse == null && pageContext.getResponse() instanceof HstResponse) { hstResponse = (HstResponse) pageContext.getResponse(); } if (hstResponse != null) { this.url = hstResponse.createResourceURL(); } } return this.url; }
@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); }
if (this.keyHint != null && hstResponse.containsHeadElement(this.keyHint)) { return SKIP_BODY; this.keyHint = xmlText; if (hstResponse.containsHeadElement(this.keyHint)) { return SKIP_BODY; this.keyHint = HeadElementUtils.toHtmlString(new HeadElementImpl(element)); if (hstResponse.containsHeadElement(this.keyHint)) { return SKIP_BODY; hstResponse.addHeadElement(element, this.keyHint);
public Element createElement(String tagName) { Element element = null; if (this.topParentHstResponse != null) { element = this.topParentHstResponse.createElement(tagName); } else { element = this.responseState.createElement(tagName); } return element; }
response.setRenderPath(dispatchPath); String sharedAttributeName = sharedAttributeNamePrefix + response.getNamespace(); Map<String, Object> sharedAttrMap = (Map<String, Object>) session.getAttribute(sharedAttributeName);
public String toUrlForm(HstRequest request, HstResponse response, boolean external) { String characterEncoding = response.getCharacterEncoding(); if (characterEncoding == null) { characterEncoding = "UTF-8"; } if(path == null) { log.warn("Unable to rewrite link. Return EVAL_PAGE"); return null; } String urlString = null; if (this.containerResource) { HstURL hstUrl = response.createResourceURL(ContainerConstants.CONTAINER_REFERENCE_NAMESPACE); hstUrl.setResourceID(path); urlString = hstUrl.toString(); } else { urlString = response.createNavigationalURL(path).toString(); } if(external) { VirtualHost vhost = request.getRequestContext().getResolvedSiteMapItem().getResolvedSiteMount().getSiteMount().getVirtualHost(); urlString = vhost.getBaseURL(request) + urlString; } return urlString; }
public int doStartTag() throws JspException { String namespace = ""; // if hstResponse is retrieved, then this servlet has been dispatched by hst component. HstResponse hstResponse = (HstResponse) pageContext.getRequest().getAttribute(ContainerConstants.HST_RESPONSE); if (hstResponse == null && pageContext.getResponse() instanceof HstResponse) { hstResponse = (HstResponse) pageContext.getResponse(); } if (hstResponse != null) { namespace = hstResponse.getNamespace(); } JspWriter writer = pageContext.getOut(); try { writer.print(namespace); } catch (IOException ioe) { throw new JspException("Unable to write namespace", ioe); } return SKIP_BODY; } }
public boolean containsHeadElement(String keyHint) { boolean contained = false; if (this.topParentHstResponse == null) { contained = this.responseState.containsHeadElement(keyHint); } else if (this != this.topParentHstResponse) { contained = this.topParentHstResponse.containsHeadElement(keyHint); } return contained; }
protected void addResponseHeadElement(Element element, String keyHint) { if (this.response instanceof HstResponse) { ((HstResponse) this.response).addHeadElement(element, keyHint); } }
public void doBeforeServeResource(HstRequest request, HstResponse response) throws HstComponentException { if (componentConfig.getServeResourcePath() == null && request.getResourceID() != null) { response.setServeResourcePath(request.getResourceID()); } }
public void doBeforeRender(HstRequest request, HstResponse response) throws HstComponentException { response.setRenderPath(this.renderPath); }
public int doEndTag() throws JspException { try { // if hstRequest is retrieved, then this servlet has been dispatched by hst component. HstResponse hstResponse = (HstResponse) pageContext.getRequest().getAttribute(ContainerConstants.HST_RESPONSE); if (hstResponse == null && pageContext.getResponse() instanceof HstResponse) { hstResponse = (HstResponse) pageContext.getResponse(); } List<Element> headElements = hstResponse != null ? hstResponse.getHeadElements() : null; if (headElements == null) { return SKIP_BODY; } for (Element headElement : headElements) { if (shouldBeIncludedInOutput(headElement)) { outputHeadElement(headElement); hstResponse.addProcessedHeadElement(headElement); } } try { pageContext.getOut().flush(); } catch (IOException e) { throw new JspException("Cannot flush the output", e); } return SKIP_BODY; } finally { cleanup(); } }
List<Element> headElements = hstResponse.getHeadElements();
@Override protected HstURL getUrl() { if (this.url == null) { // if hstResponse is retrieved, then this servlet has been dispatched by hst component. HstResponse hstResponse = (HstResponse) pageContext.getRequest().getAttribute(ContainerConstants.HST_RESPONSE); if (hstResponse == null && pageContext.getResponse() instanceof HstResponse) { hstResponse = (HstResponse) pageContext.getResponse(); } if (hstResponse != null) { this.url = hstResponse.createActionURL(); } } return this.url; }
if (this.keyHint != null && hstResponse.containsHeadElement(this.keyHint)) { return SKIP_BODY; this.keyHint = xmlText; if (hstResponse.containsHeadElement(this.keyHint)) { return SKIP_BODY; this.keyHint = HeadElementUtils.toHtmlString(new HeadElementImpl(element)); if (hstResponse.containsHeadElement(this.keyHint)) { return SKIP_BODY; hstResponse.addHeadElement(element, this.keyHint);
public Element createElement(String tagName) { Element element = null; if (this.topParentHstResponse != null) { element = this.topParentHstResponse.createElement(tagName); } else { element = this.responseState.createElement(tagName); } return element; }
response.setRenderPath(dispatchPath); String sharedAttributeName = sharedAttributeNamePrefix + response.getNamespace(); Map<String, Object> sharedAttrMap = (Map<String, Object>) session.getAttribute(sharedAttributeName);
public int doStartTag() throws JspException { String namespace = ""; // if hstResponse is retrieved, then this servlet has been dispatched by hst component. HstResponse hstResponse = (HstResponse) pageContext.getRequest().getAttribute(ContainerConstants.HST_RESPONSE); if (hstResponse == null && pageContext.getResponse() instanceof HstResponse) { hstResponse = (HstResponse) pageContext.getResponse(); } if (hstResponse != null) { namespace = hstResponse.getNamespace(); } JspWriter writer = pageContext.getOut(); try { writer.print(namespace); } catch (IOException ioe) { throw new JspException("Unable to write namespace", ioe); } return SKIP_BODY; } }