You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by ms...@apache.org on 2016/04/08 15:40:24 UTC
[12/34] portals-pluto git commit: added code to path infor portlet
for extended display
added code to path infor portlet for extended display
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/70f96425
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/70f96425
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/70f96425
Branch: refs/heads/V3Prototype
Commit: 70f96425712712ee199fe07a5ef28277254b2b03
Parents: ba9ee3b
Author: Scott Nicklous <ms...@apache.org>
Authored: Thu Mar 24 16:19:59 2016 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Thu Mar 24 16:19:59 2016 +0100
----------------------------------------------------------------------
.../apache/portals/samples/PathInfoPortlet.java | 31 ++++++++++++++++++++
1 file changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/70f96425/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathInfoPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathInfoPortlet.java b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathInfoPortlet.java
index 2b1391c..473a943 100644
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathInfoPortlet.java
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathInfoPortlet.java
@@ -22,6 +22,8 @@ import java.io.IOException;
import java.util.ArrayList;
import javax.inject.Inject;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;
import javax.portlet.ResourceURL;
@@ -50,6 +52,7 @@ public class PathInfoPortlet {
StringBuilder txt = new StringBuilder(128);
txt.append("<h3>Path Info Portlet</h3>");
+ txt.append("<h5>Include:</h5>");
ResourceURL resurl = uf.createResourceURL();
@@ -68,6 +71,26 @@ public class PathInfoPortlet {
txt.append("})();\n");
txt.append("</script>\n");
+ txt.append("<h5>Forward:</h5>");
+
+ resurl = uf.createResourceURL();
+ resurl.setResourceID("fwd");
+
+ txt.append("<div class='infobox' id='").append(pid).append("-puReHe'></div>\n");
+ txt.append("<script>\n");
+ txt.append("(function () {\n");
+ txt.append(" var xhr = new XMLHttpRequest();\n");
+ txt.append(" xhr.onreadystatechange=function() {\n");
+ txt.append(" if (xhr.readyState==4 && xhr.status==200) {\n");
+ txt.append(" document.getElementById('").append(pid)
+ .append("-puReHe').innerHTML=xhr.responseText;\n");
+ txt.append(" }\n");
+ txt.append(" };\n");
+ txt.append(" xhr.open(\"GET\",\"").append(resurl.toString()).append("\",true);\n");
+ txt.append(" xhr.send();\n");
+ txt.append("})();\n");
+ txt.append("</script>\n");
+
return txt.toString();
}
@@ -100,4 +123,12 @@ public class PathInfoPortlet {
}
+ @ServeResourceMethod(portletNames = { "PathInfoPortlet" }, resourceID="fwd")
+ public void getPathInfo2(ResourceRequest req, ResourceResponse resp) throws IOException, PortletException {
+
+ PortletRequestDispatcher prd = req.getPortletContext().getRequestDispatcher("/WEB-INF/jsp/pathinfo.jsp");
+ prd.forward(req, resp);
+
+ }
+
}