use of javax.portlet.BaseURL in project liferay-faces-bridge-impl by liferay.
the class BaseURLRenderer method encodeEnd.
@Override
public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
BaseURL baseURL = createBaseURL(facesContext, uiComponent);
Boolean secure = getSecure(uiComponent);
if (secure != null) {
try {
baseURL.setSecure(secure);
} catch (PortletSecurityException e) {
throw new IOException(e);
}
}
processParamChildren(uiComponent, baseURL);
processPropertyChildren(uiComponent, baseURL);
String varName = getVar(uiComponent);
String url = baseURL.toString();
if (isEscapeXml(uiComponent)) {
url = XMLUtil.escapeXML(url);
}
// If the user didn't specify a value for the "var" attribute, then write the URL to the response.
if (varName == null) {
ResponseWriter responseWriter = facesContext.getResponseWriter();
responseWriter.write(url);
} else // Otherwise, place the url into the request scope so that it can be resolved via EL with the name
// specified in the "var" attribute.
{
ExternalContext externalContext = facesContext.getExternalContext();
Map<String, Object> requestMap = externalContext.getRequestMap();
requestMap.put(varName, url);
}
}
use of javax.portlet.BaseURL in project struts by apache.
the class PortletUrlHelperJSR286 method createUrl.
protected Object createUrl(String scheme, String type, Map<String, String[]> portletParams) {
MimeResponse response = (MimeResponse) PortletActionContext.getResponse();
BaseURL url;
if (URLTYPE_NAME_ACTION.equalsIgnoreCase(type)) {
if (LOG.isDebugEnabled())
LOG.debug("Creating action url");
url = response.createActionURL();
} else if (URLTYPE_NAME_RESOURCE.equalsIgnoreCase(type)) {
if (LOG.isDebugEnabled())
LOG.debug("Creating resource url");
url = response.createResourceURL();
} else {
if (LOG.isDebugEnabled())
LOG.debug("Creating render url");
url = response.createRenderURL();
}
url.setParameters(portletParams);
if ("HTTPS".equalsIgnoreCase(scheme)) {
try {
url.setSecure(true);
} catch (PortletSecurityException e) {
LOG.error("Cannot set scheme to https", e);
}
}
return url;
}
Aggregations