url.setResourceID(getResourceId());
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; }
@Override public int doEndTag() throws JspException{ try { HstURL url = getUrl(); if (url == null) { throw new IllegalStateException("internal error: url not set"); } url.setResourceID(getResourceId()); setUrlParameters(url); HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); // properly encoding urls to allow non-cookie enabled sessions - ref.) PLUTO-252 String urlString = response.encodeURL(url.toString()); if (escapeXml) { urlString = doEscapeXml(urlString); } HstRequestContext requestContext = HstRequestUtils.getHstRequestContext((HttpServletRequest) pageContext.getRequest()); if (mustURLBeFullyQualified(requestContext)) { urlString = HstRequestUtils.getFullyQualifiedHstURL(requestContext, url, true); } TagUtils.writeOrSetVar(urlString, var, pageContext, scope); return EVAL_PAGE; } finally { cleanup(); } }
if (isContainerResource()) { HstURL hstUrl = requestContext.getURLFactory().createURL(HstURL.RESOURCE_TYPE, ContainerConstants.CONTAINER_REFERENCE_NAMESPACE, null, requestContext, explicitContextPath); hstUrl.setResourceID(path); urlString = hstUrl.toString(); } else {