use of javax.portlet.PortletSecurityException in project struts by apache.
the class PortletUrlHelper method createUrl.
protected Object createUrl(String scheme, String type, Map<String, String[]> portletParams) {
RenderResponse response = PortletActionContext.getRenderResponse();
PortletURL url;
if (URLTYPE_NAME_ACTION.equalsIgnoreCase(type)) {
if (LOG.isDebugEnabled())
LOG.debug("Creating action url");
url = response.createActionURL();
} 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;
}
use of javax.portlet.PortletSecurityException in project displaytag by hazendaz.
the class PortletHref method toString.
/**
* To string.
*
* @return the string
*
* @see org.displaytag.util.Href#toString()
*/
@Override
public String toString() {
final PortletURL url;
if (this.isAction()) {
url = this.renderResponse.createActionURL();
} else {
url = this.renderResponse.createRenderURL();
}
if (this.isRequestedSecure()) {
try {
url.setSecure(true);
} catch (final PortletSecurityException pse) {
throw new RuntimeException("Creating secure PortletURL Failed.", pse);
}
}
if (this.getRequestedMode() != null) {
try {
url.setPortletMode(this.getRequestedMode());
} catch (final PortletModeException pme) {
final IllegalStateException ise = new IllegalStateException("Requested PortletMode='" + this.getRequestedMode() + "' could not be set.");
ise.initCause(pme);
throw ise;
}
}
if (this.getRequestedState() != null) {
try {
url.setWindowState(this.getRequestedState());
} catch (final WindowStateException wse) {
final IllegalStateException ise = new IllegalStateException("Requested WindowState='" + this.getRequestedState() + "' could not be set.");
ise.initCause(wse);
throw ise;
}
}
for (final Entry<String, String[]> entry : this.parameters.entrySet()) {
final String name = entry.getKey();
final String[] value = entry.getValue();
url.setParameter(name, value);
}
if (this.getAnchor() == null) {
return url.toString();
}
return url.toString() + "#" + this.getAnchor();
}
use of javax.portlet.PortletSecurityException 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.PortletSecurityException 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