use of javax.portlet.ResourceURL in project gatein-portal by Meeds-io.
the class UISitemapPortlet method toJSON.
private JSONObject toJSON(TreeNode tnode, MimeResponse res) throws Exception {
UIPortalNavigation uiPortalNavigation = getChild(UIPortalNavigation.class);
JSONObject json = new JSONObject();
UserNode node = tnode.getNode();
String nodeId = node.getId();
json.put("label", node.getEncodedResolvedLabel());
json.put("hasChild", tnode.hasChild());
json.put("isExpanded", tnode.isExpanded());
json.put("collapseURL", uiPortalNavigation.url("CollapseNode", nodeId));
ResourceURL rsURL = res.createResourceURL();
rsURL.setResourceID(nodeId);
json.put("getNodeURL", rsURL.toString());
if (node.getPageRef() != null) {
NavigationResource resource = new NavigationResource(node);
NodeURL url = Util.getPortalRequestContext().createURL(NodeURL.TYPE, resource);
url.setAjax(isUseAjax());
json.put("actionLink", url.toString());
}
JSONArray childs = new JSONArray();
for (TreeNode child : tnode.getChildren()) {
childs.put(toJSON(child, res));
}
json.put("childs", childs);
return json;
}
use of javax.portlet.ResourceURL in project gatein-portal by Meeds-io.
the class BasePartialUpdateToolbar method toJSON.
protected JSONObject toJSON(UserNode node, String navId, MimeResponse res) throws Exception {
JSONObject json = new JSONObject();
String nodeId = node.getId();
json.put("label", node.getEncodedResolvedLabel());
json.put("hasChild", node.getChildrenCount() > 0);
json.put("isSelected", nodeId.equals(getSelectedNode().getId()));
json.put("icon", node.getIcon());
ResourceURL rsURL = res.createResourceURL();
rsURL.setResourceID(getResourceIdFromNode(node, navId));
json.put("getNodeURL", rsURL.toString());
if (node.getPageRef() != null) {
NavigationResource resource = new NavigationResource(node);
NodeURL url = Util.getPortalRequestContext().createURL(NodeURL.TYPE, resource);
json.put("actionLink", url.setAjax(false).toString());
}
JSONArray childs = new JSONArray();
for (UserNode child : node.getChildren()) {
childs.put(toJSON(child, navId, res));
}
json.put("childs", childs);
return json;
}
use of javax.portlet.ResourceURL in project gatein-portal by Meeds-io.
the class UICaptcha method processRender.
public void processRender(WebuiRequestContext context) throws Exception {
RenderResponse resp = context.getResponse();
//
ResourceURL url = resp.createResourceURL();
// context.getPortalContextPath() + "/captcha?v=" + Calendar.getInstance().getTimeInMillis()
String random = "&v=" + Calendar.getInstance().getTimeInMillis();
context.getWriter().write("<div id='" + getId() + "'><img src=\"" + url.toString() + random + "\" alt=\"Captcha image for visual validation\" /><br/>");
super.processRender(context);
context.getWriter().write("</div>");
}
use of javax.portlet.ResourceURL in project social by Meeds-io.
the class UIIntranetNotificationsPortlet method buildResourceURL.
protected String buildResourceURL(String key) {
try {
WebuiRequestContext ctx = WebuiRequestContext.getCurrentInstance();
MimeResponse res = ctx.getResponse();
ResourceURL rsURL = res.createResourceURL();
rsURL.setResourceID(key);
return rsURL.toString();
} catch (Exception e) {
return "";
}
}
use of javax.portlet.ResourceURL in project WebproxyPortlet by uPortal-Project.
the class URLRewritingFilter method createResourceUrl.
protected String createResourceUrl(final RenderResponse response, final String url) {
final ResourceURL resourceUrl = response.createResourceURL();
resourceUrl.setParameter(HttpContentServiceImpl.URL_PARAM, url);
return resourceUrl.toString();
}
Aggregations