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/14 14:28:56 UTC
[16/50] [abbrv] portals-pluto git commit: Added fields and methods as
described in PORTLETSPEC3-63 and PORTLETSPEC3-64: PortletRequest#USER_AGENT,
PortletRequest#getPortletContext,
and ClientDataRequest#getContentLengthLong. Implemented the methods in th
Added fields and methods as described in PORTLETSPEC3-63
and PORTLETSPEC3-64: PortletRequest#USER_AGENT,
PortletRequest#getPortletContext, and
ClientDataRequest#getContentLengthLong. Implemented the methods in the Pluto
RI. Implemented functionality in the PortletV3AnnotatedDemo to display the
user agent string obtained from PortletRequest#getProperty(USER_AGENT).
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/7e04857a
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/7e04857a
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/7e04857a
Branch: refs/heads/master
Commit: 7e04857a7340819c64ff8547e0877febe26669e5
Parents: 5a59b41
Author: Scott Nicklous <ms...@apache.org>
Authored: Thu Mar 10 15:48:51 2016 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Thu Mar 10 15:48:51 2016 +0100
----------------------------------------------------------------------
.../portals/samples/HelloWorldRender.java | 8 +-
.../org/apache/portals/samples/PathDisplay.java | 188 +++++++
.../apache/portals/samples/PathInfoPortlet.java | 100 ++++
.../src/main/webapp/WEB-INF/jsp/pathinfo.jsp | 21 +
.../container/impl/ClientDataRequestImpl.java | 224 ++++----
.../container/impl/PortletRequestImpl.java | 15 +-
.../fixtures/mocks/MockClientDataRequest.java | 5 +
.../fixtures/mocks/MockPortletRequest.java | 6 +
.../apache/pluto/tags/DefineObjectsTag286.java | 526 ++++++++++---------
.../java/javax/portlet/ClientDataRequest.java | 21 +-
.../main/java/javax/portlet/PortletRequest.java | 32 +-
.../portlet/annotations/PortletListener.java | 2 +-
.../filter/ClientDataRequestWrapper.java | 11 +
.../portlet/filter/PortletRequestWrapper.java | 6 +
portlet-api/src/main/javadoc/overview.html | 11 +
15 files changed, 797 insertions(+), 379 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
index 4c08a1b..b9c1394 100644
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
@@ -20,7 +20,8 @@
package org.apache.portals.samples;
import javax.inject.Inject;
-
+import javax.portlet.PortletRequest;
+import javax.portlet.RenderRequest;
import javax.portlet.annotations.RenderMethod;
/**
@@ -50,6 +51,9 @@ public class HelloWorldRender {
@Inject
private ApplicationRandomNumberBean apprn;
+
+ @Inject
+ private RenderRequest req;
/**
* Bean portlet render method for "BeanHelloWorld" portlet.
@@ -85,6 +89,8 @@ public class HelloWorldRender {
txt.append("Request number:</td><td>").append(reqrn.getRandomNumber());
txt.append("</td></tr></table></p>\n");
+ txt.append("<p>User agent: ").append(req.getProperty(PortletRequest.USER_AGENT)).append("</p>");
+
return txt.toString();
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathDisplay.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathDisplay.java b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathDisplay.java
new file mode 100644
index 0000000..dbf1cf4
--- /dev/null
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathDisplay.java
@@ -0,0 +1,188 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.portals.samples;
+
+import javax.portlet.PortletRequest;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author Scott Nicklous
+ *
+ */
+public class PathDisplay {
+
+ private String async_request_uri;
+ private String async_context_path;
+ private String async_servlet_path;
+ private String async_path_info;
+ private String async_query_string;
+
+ private String forward_request_uri;
+ private String forward_context_path;
+ private String forward_servlet_path;
+ private String forward_path_info;
+ private String forward_query_string;
+
+ private String include_request_uri;
+ private String include_context_path;
+ private String include_servlet_path;
+ private String include_path_info;
+ private String include_query_string;
+
+ private String method_request_uri;
+ private String method_context_path;
+ private String method_servlet_path;
+ private String method_path_info;
+ private String method_query_string;
+
+ private String type;
+ private String caller;
+
+ public PathDisplay(HttpServletRequest req, String caller) {
+ this.caller = caller;
+
+ async_request_uri = (String) req.getAttribute("javax.servlet.async.request_uri");
+ async_context_path = (String) req.getAttribute("javax.servlet.async.context_path");
+ async_servlet_path = (String) req.getAttribute("javax.servlet.async.servlet_path");
+ async_path_info = (String) req.getAttribute("javax.servlet.async.path_info");
+ async_query_string = (String) req.getAttribute("javax.servlet.async.query_string");
+
+ forward_request_uri = (String) req.getAttribute("javax.servlet.forward.request_uri");
+ forward_context_path = (String) req.getAttribute("javax.servlet.forward.context_path");
+ forward_servlet_path = (String) req.getAttribute("javax.servlet.forward.servlet_path");
+ forward_path_info = (String) req.getAttribute("javax.servlet.forward.path_info");
+ forward_query_string = (String) req.getAttribute("javax.servlet.forward.query_string");
+
+ include_request_uri = (String) req.getAttribute("javax.servlet.include.request_uri");
+ include_context_path = (String) req.getAttribute("javax.servlet.include.context_path");
+ include_servlet_path = (String) req.getAttribute("javax.servlet.include.servlet_path");
+ include_path_info = (String) req.getAttribute("javax.servlet.include.path_info");
+ include_query_string = (String) req.getAttribute("javax.servlet.include.query_string");
+
+ method_request_uri = req.getRequestURI();
+ method_context_path = req.getContextPath();
+ method_servlet_path = req.getServletPath();
+ method_path_info = req.getPathInfo();
+ method_query_string = req.getQueryString();
+
+ type = req.getDispatcherType().name();
+}
+
+ public PathDisplay(PortletRequest req, String caller) {
+ this.caller = caller;
+
+ async_request_uri = (String) req.getAttribute("javax.servlet.async.request_uri");
+ async_context_path = (String) req.getAttribute("javax.servlet.async.context_path");
+ async_servlet_path = (String) req.getAttribute("javax.servlet.async.servlet_path");
+ async_path_info = (String) req.getAttribute("javax.servlet.async.path_info");
+ async_query_string = (String) req.getAttribute("javax.servlet.async.query_string");
+
+ forward_request_uri = (String) req.getAttribute("javax.servlet.forward.request_uri");
+ forward_context_path = (String) req.getAttribute("javax.servlet.forward.context_path");
+ forward_servlet_path = (String) req.getAttribute("javax.servlet.forward.servlet_path");
+ forward_path_info = (String) req.getAttribute("javax.servlet.forward.path_info");
+ forward_query_string = (String) req.getAttribute("javax.servlet.forward.query_string");
+
+ include_request_uri = (String) req.getAttribute("javax.servlet.include.request_uri");
+ include_context_path = (String) req.getAttribute("javax.servlet.include.context_path");
+ include_servlet_path = (String) req.getAttribute("javax.servlet.include.servlet_path");
+ include_path_info = (String) req.getAttribute("javax.servlet.include.path_info");
+ include_query_string = (String) req.getAttribute("javax.servlet.include.query_string");
+
+ method_request_uri = "undefined";
+ method_context_path = req.getContextPath();
+ method_servlet_path = "undefined";
+ method_path_info = "undefined";
+ method_query_string = "undefined";
+
+ type = "undefined";
+}
+
+ public String toMarkup() {
+ StringBuilder txt = new StringBuilder(128);
+ txt.append("<hr>");
+ txt.append("<h5>").append(caller).append(" Path Info:</h5>");
+ txt.append("<table border='0' cellpadding='0'><tr>");
+
+ txt.append("<td>Dispatch type:</td><td>").append(type).append("</td>\n");
+ txt.append("</tr><tr><td style='padding-top:8px;'/></tr><tr>");
+
+ if ((async_request_uri == null) && (async_context_path == null) && (async_servlet_path == null)
+ && (async_path_info == null) && (async_query_string == null)) {
+ txt.append("<td>Async values:</td><td>null.</td>\n");
+ } else {
+ txt.append("<td>async_request_uri:</td><td>").append(async_request_uri).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>async_context_path:</td><td>").append(async_context_path).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>async_servlet_path:</td><td>").append(async_servlet_path).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>async_path_info:</td><td>").append(async_path_info).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>async_query_string:</td><td>").append(async_query_string).append("</td>\n");
+ }
+ txt.append("</tr><tr><td style='padding-top:8px;'/></tr><tr>");
+
+ if ((forward_request_uri == null) && (forward_context_path == null) && (forward_servlet_path == null)
+ && (forward_path_info == null) && (forward_query_string == null)) {
+ txt.append("<td>Forward values:</td><td>null.</td>\n");
+ } else {
+ txt.append("<td>forward_request_uri:</td><td>").append(forward_request_uri).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>forward_context_path:</td><td>").append(forward_context_path).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>forward_servlet_path:</td><td>").append(forward_servlet_path).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>forward_path_info:</td><td>").append(forward_path_info).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>forward_query_string:</td><td>").append(forward_query_string).append("</td>\n");
+ }
+ txt.append("</tr><tr><td style='padding-top:8px;'/></tr><tr>");
+
+ if ((include_request_uri == null) && (include_context_path == null) && (include_servlet_path == null)
+ && (include_path_info == null) && (include_query_string == null)) {
+ txt.append("<td>Include values:</td><td>null.</td>\n");
+ } else {
+ txt.append("<td>include_request_uri:</td><td>").append(include_request_uri).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>include_context_path:</td><td>").append(include_context_path).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>include_servlet_path:</td><td>").append(include_servlet_path).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>include_path_info:</td><td>").append(include_path_info).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>include_query_string:</td><td>").append(include_query_string).append("</td>\n");
+ }
+ txt.append("</tr><tr><td style='padding-top:8px;'/></tr><tr>");
+
+ txt.append("<td>method_request_uri:</td><td>").append(method_request_uri).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>method_context_path:</td><td>").append(method_context_path).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>method_servlet_path:</td><td>").append(method_servlet_path).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>method_path_info:</td><td>").append(method_path_info).append("</td>\n");
+ txt.append("</tr><tr>");
+ txt.append("<td>method_query_string:</td><td>").append(method_query_string).append("</td>\n");
+
+ txt.append("</tr></table>");
+ return txt.toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/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
new file mode 100644
index 0000000..1f42b14
--- /dev/null
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathInfoPortlet.java
@@ -0,0 +1,100 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.portals.samples;
+
+import java.util.ArrayList;
+
+import javax.inject.Inject;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceURL;
+import javax.portlet.annotations.Namespace;
+import javax.portlet.annotations.RenderMethod;
+import javax.portlet.annotations.ServeResourceMethod;
+import javax.portlet.annotations.URLFactory;
+import javax.servlet.http.HttpServletRequest;
+
+
+/**
+ * Resource portlet for viewing path information.
+ */
+public class PathInfoPortlet {
+
+ public static final String RESPARAM_DISPLAY = "display";
+
+ // Injecting the namespace & URLFactory
+ @Inject @Namespace private String pid;
+ @Inject private URLFactory uf;
+
+ @RenderMethod(portletNames = {"PathInfoPortlet"}, ordinal=100)
+ public String getImageInclude() {
+
+ StringBuilder txt = new StringBuilder(128);
+ txt.append("<h3>Path Info Portlet</h3>");
+
+ ResourceURL resurl = uf.createResourceURL();
+
+ txt.append("<div class='infobox' id='").append(pid).append("-putResourceHere'></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("-putResourceHere').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();
+ }
+
+ @Inject private ResourceRequest resReq;
+
+ /**
+ * This resource method generates some output directly, then includes output
+ * from a JSP as specified in the annotation.
+ *
+ * @return The string for inclusion in the output.
+ */
+ @ServeResourceMethod(portletNames={"PathInfoPortlet"}, include="/WEB-INF/jsp/pathinfo.jsp")
+ public void getPathInfo() {
+
+ @SuppressWarnings("unchecked")
+ ArrayList<String> pathInfo = (ArrayList<String>) resReq.getAttribute("pathInfo");
+ if (pathInfo == null) {
+ pathInfo = new ArrayList<String>();
+ }
+
+ HttpServletRequest hreq = (HttpServletRequest) resReq.getAttribute("javax.portlet.debug.ServletRequest");
+ PathDisplay pd;
+ if (hreq != null) {
+ pd = new PathDisplay(hreq, "Resource Method (Servlet)");
+ } else {
+ pd = new PathDisplay(resReq, "Resource Method (Resource)");
+ }
+ pathInfo.add(pd.toMarkup());
+
+ resReq.setAttribute("pathInfo", pathInfo);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/pathinfo.jsp
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/pathinfo.jsp b/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/pathinfo.jsp
new file mode 100644
index 0000000..099b153
--- /dev/null
+++ b/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/pathinfo.jsp
@@ -0,0 +1,21 @@
+<%@ page session="false" %>
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ page import="org.apache.portals.samples.*" %>
+<%@ page import="java.util.*" %>
+
+<portlet:defineObjects />
+
+<p>Message from included JSP.</p>
+<%
+ArrayList<String> pathInfo = (ArrayList<String>) request.getAttribute("pathInfo");
+if (pathInfo != null) {
+ for (String item : pathInfo) {
+ out.append(item);
+ }
+}
+
+PathDisplay pd = new PathDisplay(request, "JSP");
+out.append(pd.toMarkup());
+ %>
+<hr>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/pluto-container/src/main/java/org/apache/pluto/container/impl/ClientDataRequestImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/ClientDataRequestImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/impl/ClientDataRequestImpl.java
index 6606089..0fff3a6 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/ClientDataRequestImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/ClientDataRequestImpl.java
@@ -1,109 +1,115 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.pluto.container.impl;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-
-import javax.portlet.ClientDataRequest;
-
-import org.apache.pluto.container.PortletRequestContext;
-import org.apache.pluto.container.PortletResponseContext;
-
-/**
- * Implementation of the <code>javax.portlet.ClientDataRequest</code> interface.
- */
-public abstract class ClientDataRequestImpl extends PortletRequestImpl implements ClientDataRequest
-{
- /** Flag indicating if the HTTP body reader has been accessed. */
- protected boolean readerAccessed = false;
-
- public ClientDataRequestImpl(PortletRequestContext requestContext, PortletResponseContext responseContext, String lifecyclePhase)
- {
- super(requestContext, responseContext, lifecyclePhase);
- }
-
- private void checkPostedFormData()
- {
- if (getMethod().equals("POST"))
- {
- String contentType = getContentType();
- if (contentType == null || contentType.equals("application/x-www-form-urlencoded"))
- {
- throw new IllegalStateException("User request HTTP POST data is of type "
- + "application/x-www-form-urlencoded. "
- + "This data has been already processed "
- + "by the portlet-container and is available "
- + "as request parameters.");
- }
- }
- }
-
- public java.lang.String getCharacterEncoding()
- {
- return getServletRequest().getCharacterEncoding();
- }
-
- public int getContentLength()
- {
- return getServletRequest().getContentLength();
- }
-
- public java.lang.String getContentType()
- {
- return getServletRequest().getContentType();
- }
-
- public String getMethod()
- {
- return getServletRequest().getMethod();
- }
-
- public InputStream getPortletInputStream() throws IOException
- {
- checkPostedFormData();
- // the HttpServletRequest will ensure that a IllegalStateException is thrown
- // if getReader() was called earlier
- return getServletRequest().getInputStream();
- }
-
- public BufferedReader getReader()
- throws UnsupportedEncodingException, IOException
- {
- checkPostedFormData();
- // the HttpServletRequest will ensure that a IllegalStateException is thrown
- // if getInputStream() was called earlier
- BufferedReader reader = getServletRequest().getReader();
- readerAccessed = true;
- return reader;
-
- }
-
- public void setCharacterEncoding(String encoding)
- throws UnsupportedEncodingException
- {
- if (readerAccessed)
- {
- throw new IllegalStateException("Cannot set character encoding "
- + "after HTTP body reader is accessed.");
- }
- getServletRequest().setCharacterEncoding(encoding);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.pluto.container.impl;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+import javax.portlet.ClientDataRequest;
+
+import org.apache.pluto.container.PortletRequestContext;
+import org.apache.pluto.container.PortletResponseContext;
+
+/**
+ * Implementation of the <code>javax.portlet.ClientDataRequest</code> interface.
+ */
+public abstract class ClientDataRequestImpl extends PortletRequestImpl implements ClientDataRequest
+{
+ /** Flag indicating if the HTTP body reader has been accessed. */
+ protected boolean readerAccessed = false;
+
+ public ClientDataRequestImpl(PortletRequestContext requestContext, PortletResponseContext responseContext, String lifecyclePhase)
+ {
+ super(requestContext, responseContext, lifecyclePhase);
+ }
+
+ private void checkPostedFormData()
+ {
+ if (getMethod().equals("POST"))
+ {
+ String contentType = getContentType();
+ if (contentType == null || contentType.equals("application/x-www-form-urlencoded"))
+ {
+ throw new IllegalStateException("User request HTTP POST data is of type "
+ + "application/x-www-form-urlencoded. "
+ + "This data has been already processed "
+ + "by the portlet-container and is available "
+ + "as request parameters.");
+ }
+ }
+ }
+
+ public java.lang.String getCharacterEncoding()
+ {
+ return getServletRequest().getCharacterEncoding();
+ }
+
+ public int getContentLength()
+ {
+ return getServletRequest().getContentLength();
+ }
+
+ @Override
+ public long getContentLengthLong()
+ {
+ return getServletRequest().getContentLengthLong();
+ }
+
+ public java.lang.String getContentType()
+ {
+ return getServletRequest().getContentType();
+ }
+
+ public String getMethod()
+ {
+ return getServletRequest().getMethod();
+ }
+
+ public InputStream getPortletInputStream() throws IOException
+ {
+ checkPostedFormData();
+ // the HttpServletRequest will ensure that a IllegalStateException is thrown
+ // if getReader() was called earlier
+ return getServletRequest().getInputStream();
+ }
+
+ public BufferedReader getReader()
+ throws UnsupportedEncodingException, IOException
+ {
+ checkPostedFormData();
+ // the HttpServletRequest will ensure that a IllegalStateException is thrown
+ // if getInputStream() was called earlier
+ BufferedReader reader = getServletRequest().getReader();
+ readerAccessed = true;
+ return reader;
+
+ }
+
+ public void setCharacterEncoding(String encoding)
+ throws UnsupportedEncodingException
+ {
+ if (readerAccessed)
+ {
+ throw new IllegalStateException("Cannot set character encoding "
+ + "after HTTP body reader is accessed.");
+ }
+ getServletRequest().setCharacterEncoding(encoding);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
index ee05621..c25b437 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
@@ -181,11 +181,6 @@ public abstract class PortletRequestImpl implements PortletRequest
return requestContext;
}
- protected PortletContext getPortletContext()
- {
- return requestContext.getPortletConfig().getPortletContext();
- }
-
protected PortletWindow getPortletWindow()
{
return requestContext.getPortletWindow();
@@ -262,6 +257,10 @@ public abstract class PortletRequestImpl implements PortletRequest
}
return ccppProfile;
}
+ else if (name.equals("javax.portlet.debug.ServletRequest"))
+ {
+ return requestContext.getServletRequest();
+ }
return requestContext.getAttribute(name);
}
@@ -352,6 +351,12 @@ public abstract class PortletRequestImpl implements PortletRequest
return portalContext;
}
+ @Override
+ public PortletContext getPortletContext()
+ {
+ return requestContext.getPortletConfig().getPortletContext();
+ }
+
public PortletMode getPortletMode()
{
return getPortletWindow().getPortletMode();
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockClientDataRequest.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockClientDataRequest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockClientDataRequest.java
index 3a48052..fdfc572 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockClientDataRequest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockClientDataRequest.java
@@ -48,6 +48,11 @@ public class MockClientDataRequest extends MockPortletRequest implements ClientD
return 0;
}
+ @Override
+ public long getContentLengthLong() {
+ return 0;
+ }
+
/* (non-Javadoc)
* @see javax.portlet.ClientDataRequest#getContentType()
*/
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockPortletRequest.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockPortletRequest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockPortletRequest.java
index 6826522..c259aaa 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockPortletRequest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/mocks/MockPortletRequest.java
@@ -25,6 +25,7 @@ import java.util.Locale;
import java.util.Map;
import javax.portlet.PortalContext;
+import javax.portlet.PortletContext;
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequest;
@@ -176,6 +177,11 @@ public class MockPortletRequest implements PortletRequest {
return null;
}
+ @Override
+ public PortletContext getPortletContext() {
+ return null;
+ }
+
/* (non-Javadoc)
* @see javax.portlet.PortletRequest#getPortletSession()
*/
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag286.java
----------------------------------------------------------------------
diff --git a/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag286.java b/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag286.java
index 8185e7c..73cd2d3 100644
--- a/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag286.java
+++ b/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag286.java
@@ -1,260 +1,266 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.tags;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.EventRequest;
-import javax.portlet.EventResponse;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletPreferences;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-import javax.portlet.PortletSession;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.ResourceRequest;
-import javax.portlet.ResourceResponse;
-import javax.servlet.ServletRequest;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.PageContext;
-import javax.servlet.jsp.tagext.TagData;
-import javax.servlet.jsp.tagext.TagExtraInfo;
-import javax.servlet.jsp.tagext.TagSupport;
-import javax.servlet.jsp.tagext.VariableInfo;
-
-/**
- * A tag handler for the <CODE>defineObjects</CODE> tag as defined in the JSR 286.
- * Creates the following variables to be used in the JSP:
- * <UL>
- * <LI><CODE>{@link RenderRequest} renderRequest</CODE>,
- * when included from within the <CODE>render</CODE> method, <code>null</code> otherwise
- * <LI><CODE>{@link ResourceRequest} resourceRequest</CODE>,
- * when included from within the <CODE>serveResource</CODE> method, <code>null</code> otherwise
- * <LI><CODE>{@link ActionRequest} actionRequest</CODE>,
- * when included from within the <CODE>processAction</CODE> method, <code>null</code> otherwise
- * <LI><CODE>{@link EventRequest} eventRequest</CODE>,
- * when included from within the <CODE>processEvent</CODE> method, <code>null</code> otherwise
- * <LI><CODE>{@link RenderResponse} renderResponse</CODE>,
- * when included from within the <CODE>render</CODE> method, <code>null</code> otherwise
- * <LI><CODE>{@link ResourceResponse} resourceResponse</CODE>,
- * when included from within the <CODE>serveResource</CODE> method, <code>null</code> otherwise
- * <LI><CODE>{@link ActionResponse} actionResponse</CODE>,
- * when included from within the <CODE>processAction</CODE> method, <code>null</code> otherwise
- * <LI><CODE>{@link EventResponse} eventResponse</CODE>,
- * when included from within the <CODE>processEvent</CODE> method, <code>null</code> otherwise
- * <LI><CODE>{@link PortletConfig} portletConfig</CODE>
- * <LI><CODE>{@link PortletSession} portletSession</CODE>, providing access to the portletSession,
- * does not create a new session, only returns an existing session
- * <LI><CODE>{@link Map<String, Object>} portletSessionScope</CODE>, providing access to the
- * portletSession attributes as a Map.
- * <LI><CODE>{@link PortletPreferences} portletPreferences</CODE>, providing access to
- * the portlet preferences
- * <LI> <CODE>{@link Map<String, String[]>} portletPreferencesValues</CODE>, providing access to the
- * portlet preferences as a Map
- * </UL>
- *
- * @version 2.0
- */
-public class DefineObjectsTag286 extends TagSupport {
-
- private static final long serialVersionUID = 286L;
-
- /**
- * Helper method.
- * <p>
- * Sets an pageContext attribute with <CODE>PAGE_SCOPE</CODE>.
- *
- * @param attribute - the attribute object to set
- * @param attributeName - the name of the attribute object
- *
- * @return void
- */
- private void setAttribute(Object attribute, String attributeName){
- if (pageContext.getAttribute(attributeName) == null){ //Set attributes only once
-
- pageContext.setAttribute(attributeName,
- attribute,
- PageContext.PAGE_SCOPE);
- }
- }
-
- /**
- * Helper method.
- * <p>
- * Sets the portlet render and request attribute with
- * the names described in the JSR 286 - PLT 26.1 (defineObjects Tag).
- *
- * @param request PortletRequest
- * @param response PortletResponse
- */
- private void setPortletRequestResponseAttribute(PortletRequest request,
- PortletResponse response ){
-
- String phase = (
- String)request.getAttribute(PortletRequest.LIFECYCLE_PHASE);
-
- //check where request and response where included from
- if(PortletRequest.ACTION_PHASE.equals(phase)){
- setAttribute(request, "actionRequest");
- setAttribute(response, "actionResponse");
- }
- else if(PortletRequest.EVENT_PHASE.equals(phase)){
- setAttribute(request, "eventRequest");
- setAttribute(response, "eventResponse");
- }
- else if(PortletRequest.RENDER_PHASE.equals(phase)){
- setAttribute(request, "renderRequest");
- setAttribute(response, "renderResponse");
- }
- else if(PortletRequest.RESOURCE_PHASE.equals(phase)){
- setAttribute(request, "resourceRequest");
- setAttribute(response, "resourceResponse");
- }
- }
-
-
- /**
- * Processes the <CODE>defineObjects</CODE> tag.
- * @return <CODE>SKIP_BODY</CODE>
- */
- public int doStartTag() throws JspException {
-
- ServletRequest servletRequest = pageContext.getRequest();
-
- PortletRequest portletRequest =
- (PortletRequest) servletRequest.getAttribute(Constants.PORTLET_REQUEST);
-
- PortletResponse portletResponse =
- (PortletResponse) servletRequest.getAttribute(Constants.PORTLET_RESPONSE);
-
- PortletConfig portletConfig =
- (PortletConfig) servletRequest.getAttribute(Constants.PORTLET_CONFIG);
-
- PortletSession portletSession = portletRequest.getPortletSession(false);
-
- Map<String, Object> portletSessionScope = null;
- if(portletSession != null){
- portletSessionScope = (Map<String, Object>)portletSession.getAttributeMap();// getMap();
- }
- else{
- portletSessionScope = new HashMap<String, Object>();
- }
-
- PortletPreferences portletPreferences = portletRequest.getPreferences();
-
- Map<String, String[]> portletPreferencesValues = null;
- if(portletPreferences != null){
- portletPreferencesValues = portletPreferences.getMap();
- }
- else{
- portletPreferencesValues = new HashMap<String, String[]>();
- }
-
- // set attributes render and request
- setPortletRequestResponseAttribute(portletRequest, portletResponse);
-
- // set attribute portletConfig
- setAttribute(portletConfig, "portletConfig");
-
- // set attribute portletSession
- setAttribute(portletSession, "portletSession");
-
- //set attribute portletSession
- setAttribute(portletSessionScope, "portletSessionScope");
-
- // set attribute portletPreferences
- setAttribute(portletPreferences, "portletPreferences");
-
- // set attribute portletPreferences
- setAttribute(portletPreferencesValues, "portletPreferencesValues");
-
- return SKIP_BODY;
- }
-
-
-
- /**
- * TagExtraInfo class for DefineObjectsTag.
- *
- */
- public static class TEI extends TagExtraInfo {
-
- public VariableInfo[] getVariableInfo(TagData tagData) {
- VariableInfo[] info = new VariableInfo[]{
- new VariableInfo("actionRequest",
- "javax.portlet.ActionRequest",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("actionResponse",
- "javax.portlet.ActionResponse",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("eventRequest",
- "javax.portlet.EventRequest",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("eventResponse",
- "javax.portlet.EventResponse",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("renderRequest",
- "javax.portlet.RenderRequest",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("renderResponse",
- "javax.portlet.RenderResponse",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("resourceRequest",
- "javax.portlet.ResourceRequest",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("resourceResponse",
- "javax.portlet.ResourceResponse",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("portletConfig",
- "javax.portlet.PortletConfig",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("portletSession",
- "javax.portlet.PortletSession",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("portletSessionScope",
- "java.util.Map",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("portletPreferences",
- "javax.portlet.PortletPreferences",
- true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("portletPreferencesValues",
- "java.util.Map",
- true,
- VariableInfo.AT_BEGIN),
-
- };
- return info;
- }
- }
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.servlet.ServletRequest;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.TagData;
+import javax.servlet.jsp.tagext.TagExtraInfo;
+import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.tagext.VariableInfo;
+
+/**
+ * A tag handler for the <CODE>defineObjects</CODE> tag as defined in the JSR 286.
+ * Creates the following variables to be used in the JSP:
+ * <UL>
+ * <LI><CODE>{@link RenderRequest} renderRequest</CODE>,
+ * when included from within the <CODE>render</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ResourceRequest} resourceRequest</CODE>,
+ * when included from within the <CODE>serveResource</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ActionRequest} actionRequest</CODE>,
+ * when included from within the <CODE>processAction</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link EventRequest} eventRequest</CODE>,
+ * when included from within the <CODE>processEvent</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link RenderResponse} renderResponse</CODE>,
+ * when included from within the <CODE>render</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ResourceResponse} resourceResponse</CODE>,
+ * when included from within the <CODE>serveResource</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ActionResponse} actionResponse</CODE>,
+ * when included from within the <CODE>processAction</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link EventResponse} eventResponse</CODE>,
+ * when included from within the <CODE>processEvent</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link PortletConfig} portletConfig</CODE>
+ * <LI><CODE>{@link PortletSession} portletSession</CODE>, providing access to the portletSession,
+ * does not create a new session, only returns an existing session
+ * <LI><CODE>{@link Map<String, Object>} portletSessionScope</CODE>, providing access to the
+ * portletSession attributes as a Map.
+ * <LI><CODE>{@link PortletPreferences} portletPreferences</CODE>, providing access to
+ * the portlet preferences
+ * <LI> <CODE>{@link Map<String, String[]>} portletPreferencesValues</CODE>, providing access to the
+ * portlet preferences as a Map
+ * </UL>
+ *
+ * @version 2.0
+ */
+public class DefineObjectsTag286 extends TagSupport {
+
+ private static final long serialVersionUID = 286L;
+
+ /**
+ * Helper method.
+ * <p>
+ * Sets an pageContext attribute with <CODE>PAGE_SCOPE</CODE>.
+ *
+ * @param attribute - the attribute object to set
+ * @param attributeName - the name of the attribute object
+ *
+ * @return void
+ */
+ private void setAttribute(Object attribute, String attributeName){
+ if (pageContext.getAttribute(attributeName) == null){ //Set attributes only once
+
+ pageContext.setAttribute(attributeName,
+ attribute,
+ PageContext.PAGE_SCOPE);
+ }
+ }
+
+ /**
+ * Helper method.
+ * <p>
+ * Sets the portlet render and request attribute with
+ * the names described in the JSR 286 - PLT 26.1 (defineObjects Tag).
+ *
+ * @param request PortletRequest
+ * @param response PortletResponse
+ */
+ private void setPortletRequestResponseAttribute(PortletRequest request,
+ PortletResponse response ){
+
+ String phase = (String)request.getAttribute(PortletRequest.LIFECYCLE_PHASE);
+
+ setAttribute(request, "portletRequest");
+ setAttribute(response, "portletResponse");
+
+ //check where request and response where included from
+ if(PortletRequest.ACTION_PHASE.equals(phase)){
+ setAttribute(request, "actionRequest");
+ setAttribute(response, "actionResponse");
+ }
+ else if(PortletRequest.EVENT_PHASE.equals(phase)){
+ setAttribute(request, "eventRequest");
+ setAttribute(response, "eventResponse");
+ }
+ else if(PortletRequest.RENDER_PHASE.equals(phase)){
+ setAttribute(request, "renderRequest");
+ setAttribute(response, "renderResponse");
+ }
+ else if(PortletRequest.HEADER_PHASE.equals(phase)){
+ setAttribute(request, "headerRequest");
+ setAttribute(response, "headerResponse");
+ }
+ else if(PortletRequest.RESOURCE_PHASE.equals(phase)){
+ setAttribute(request, "resourceRequest");
+ setAttribute(response, "resourceResponse");
+ }
+ }
+
+
+ /**
+ * Processes the <CODE>defineObjects</CODE> tag.
+ * @return <CODE>SKIP_BODY</CODE>
+ */
+ public int doStartTag() throws JspException {
+
+ ServletRequest servletRequest = pageContext.getRequest();
+
+ PortletRequest portletRequest =
+ (PortletRequest) servletRequest.getAttribute(Constants.PORTLET_REQUEST);
+
+ PortletResponse portletResponse =
+ (PortletResponse) servletRequest.getAttribute(Constants.PORTLET_RESPONSE);
+
+ PortletConfig portletConfig =
+ (PortletConfig) servletRequest.getAttribute(Constants.PORTLET_CONFIG);
+
+ PortletSession portletSession = portletRequest.getPortletSession(false);
+
+ Map<String, Object> portletSessionScope = null;
+ if(portletSession != null){
+ portletSessionScope = (Map<String, Object>)portletSession.getAttributeMap();// getMap();
+ }
+ else{
+ portletSessionScope = new HashMap<String, Object>();
+ }
+
+ PortletPreferences portletPreferences = portletRequest.getPreferences();
+
+ Map<String, String[]> portletPreferencesValues = null;
+ if(portletPreferences != null){
+ portletPreferencesValues = portletPreferences.getMap();
+ }
+ else{
+ portletPreferencesValues = new HashMap<String, String[]>();
+ }
+
+ // set attributes render and request
+ setPortletRequestResponseAttribute(portletRequest, portletResponse);
+
+ // set attribute portletConfig
+ setAttribute(portletConfig, "portletConfig");
+
+ // set attribute portletSession
+ setAttribute(portletSession, "portletSession");
+
+ //set attribute portletSession
+ setAttribute(portletSessionScope, "portletSessionScope");
+
+ // set attribute portletPreferences
+ setAttribute(portletPreferences, "portletPreferences");
+
+ // set attribute portletPreferences
+ setAttribute(portletPreferencesValues, "portletPreferencesValues");
+
+ return SKIP_BODY;
+ }
+
+
+
+ /**
+ * TagExtraInfo class for DefineObjectsTag.
+ *
+ */
+ public static class TEI extends TagExtraInfo {
+
+ public VariableInfo[] getVariableInfo(TagData tagData) {
+ VariableInfo[] info = new VariableInfo[]{
+ new VariableInfo("actionRequest",
+ "javax.portlet.ActionRequest",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("actionResponse",
+ "javax.portlet.ActionResponse",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("eventRequest",
+ "javax.portlet.EventRequest",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("eventResponse",
+ "javax.portlet.EventResponse",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("renderRequest",
+ "javax.portlet.RenderRequest",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("renderResponse",
+ "javax.portlet.RenderResponse",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("resourceRequest",
+ "javax.portlet.ResourceRequest",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("resourceResponse",
+ "javax.portlet.ResourceResponse",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletConfig",
+ "javax.portlet.PortletConfig",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletSession",
+ "javax.portlet.PortletSession",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletSessionScope",
+ "java.util.Map",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletPreferences",
+ "javax.portlet.PortletPreferences",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletPreferencesValues",
+ "java.util.Map",
+ true,
+ VariableInfo.AT_BEGIN),
+
+ };
+ return info;
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/portlet-api/src/main/java/javax/portlet/ClientDataRequest.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/ClientDataRequest.java b/portlet-api/src/main/java/javax/portlet/ClientDataRequest.java
index 4b837a9..e51a318 100644
--- a/portlet-api/src/main/java/javax/portlet/ClientDataRequest.java
+++ b/portlet-api/src/main/java/javax/portlet/ClientDataRequest.java
@@ -140,8 +140,7 @@ public interface ClientDataRequest extends PortletRequest {
/**
* Returns the length, in bytes, of the request body
* which is made available by the input stream, or -1 if the
- * length is not known.
- *
+ * length is not known.
*
* @return an integer containing the length of the
* request body or -1 if the length is not known
@@ -149,6 +148,24 @@ public interface ClientDataRequest extends PortletRequest {
*/
public int getContentLength();
+
+
+ /**
+ * <div class="changed_added_3_0">
+ * Returns the length, in bytes, of the request body
+ * which is made available by the input stream, or -1 if the
+ * length is not known.
+ * </div>
+ *
+ *
+ * @return a <code>long</code> containing the length of the
+ * request body or -1 if the length is not known
+ *
+ * @since 3.0
+ *
+ */
+
+ public long getContentLengthLong();
/**
* Returns the name of the HTTP method with which this request was made,
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/portlet-api/src/main/java/javax/portlet/PortletRequest.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/PortletRequest.java b/portlet-api/src/main/java/javax/portlet/PortletRequest.java
index 001f277..780d9c3 100644
--- a/portlet-api/src/main/java/javax/portlet/PortletRequest.java
+++ b/portlet-api/src/main/java/javax/portlet/PortletRequest.java
@@ -303,7 +303,20 @@ public interface PortletRequest extends RenderState
* @since 2.0
*/
public static final String ACTION_SCOPE_ID = "javax.portlet.as";
-
+
+ /**
+ * <div class="changed_added_3_0">
+ * A constant that can be used as the property name to obtain
+ * the user agent string
+ * through the <code>getProperty</code> and <code>getProperties</code>
+ * methods.
+ * </div>
+ * <p>
+ * The value is <code>User-Agent</code>.
+ * @since 3.0
+ */
+ public static final String USER_AGENT = "User-Agent";
+
/**
@@ -480,6 +493,23 @@ public interface PortletRequest extends RenderState
/**
+ * <div class="changed_added_3_0">
+ * Returns the <code>PortletContext</code> of the portlet application
+ * the portlet is in.
+ * </div>
+ *
+ * @return a <code>PortletContext</code> object, used by the
+ * caller to interact with its portlet container
+ *
+ * @see PortletContext
+ * @since 3.0
+ *
+ */
+
+ public PortletContext getPortletContext ();
+
+
+ /**
* Returns the name of the authentication scheme used for the
* connection between client and portal,
* for example, <code>BASIC_AUTH</code>, <code>CLIENT_CERT_AUTH</code>,
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/portlet-api/src/main/java/javax/portlet/annotations/PortletListener.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/annotations/PortletListener.java b/portlet-api/src/main/java/javax/portlet/annotations/PortletListener.java
index 77ead30..d5d9a99 100644
--- a/portlet-api/src/main/java/javax/portlet/annotations/PortletListener.java
+++ b/portlet-api/src/main/java/javax/portlet/annotations/PortletListener.java
@@ -37,7 +37,7 @@ import static java.lang.annotation.RetentionPolicy.*;
* The listener method will be invoked before a URL of the corresponding type is
* generated.
* <p>
- * The annotated method must implement the <code>PortletListener</code> interface.
+ * The annotated method must implement the <code>PortletURLGenerationListener</code> interface.
* </div>
*
* @see javax.portlet.PortletURLGenerationListener
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/portlet-api/src/main/java/javax/portlet/filter/ClientDataRequestWrapper.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/filter/ClientDataRequestWrapper.java b/portlet-api/src/main/java/javax/portlet/filter/ClientDataRequestWrapper.java
index 95e0deb..cddd18e 100644
--- a/portlet-api/src/main/java/javax/portlet/filter/ClientDataRequestWrapper.java
+++ b/portlet-api/src/main/java/javax/portlet/filter/ClientDataRequestWrapper.java
@@ -24,6 +24,7 @@ import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import javax.portlet.ClientDataRequest;
+import javax.portlet.PortletContext;
/**
* <div class="changed_added_3_0"> The <code>ClientDataRequestWrapper</code>
@@ -117,6 +118,11 @@ public class ClientDataRequestWrapper extends PortletRequestWrapper implements C
return ((ClientDataRequest)wrapped).getContentLength();
}
+ @Override
+ public long getContentLengthLong() {
+ return ((ClientDataRequest)wrapped).getContentLengthLong();
+ }
+
/*
* (non-Javadoc)
*
@@ -126,4 +132,9 @@ public class ClientDataRequestWrapper extends PortletRequestWrapper implements C
return ((ClientDataRequest)wrapped).getMethod();
}
+ @Override
+ public PortletContext getPortletContext() {
+ return null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/portlet-api/src/main/java/javax/portlet/filter/PortletRequestWrapper.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/filter/PortletRequestWrapper.java b/portlet-api/src/main/java/javax/portlet/filter/PortletRequestWrapper.java
index 57bd3d6..46fdd25 100644
--- a/portlet-api/src/main/java/javax/portlet/filter/PortletRequestWrapper.java
+++ b/portlet-api/src/main/java/javax/portlet/filter/PortletRequestWrapper.java
@@ -30,6 +30,7 @@ import java.util.Locale;
import java.util.Map;
import javax.portlet.PortalContext;
+import javax.portlet.PortletContext;
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequest;
@@ -184,6 +185,11 @@ public class PortletRequestWrapper extends RenderStateWrapper implements Portlet
return ((PortletRequest)wrapped).getPortalContext();
}
+ @Override
+ public PortletContext getPortletContext() {
+ return ((PortletRequest)wrapped).getPortletContext();
+ }
+
/**
* The default behavior of this method is to call
* <code>getPortletMode()</code> on the wrapped request object.
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/7e04857a/portlet-api/src/main/javadoc/overview.html
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/javadoc/overview.html b/portlet-api/src/main/javadoc/overview.html
index f76f263..1a8e986 100644
--- a/portlet-api/src/main/javadoc/overview.html
+++ b/portlet-api/src/main/javadoc/overview.html
@@ -21,6 +21,17 @@
<div class="indexContainer-not">
<ul>
<li>
+ 20160315:
+ Added new methods to implement
+ <a href="https://java.net/jira/browse/PORTLETSPEC3-63">PORTLETSPEC3-63</a>
+ and
+ <a href="https://java.net/jira/browse/PORTLETSPEC3-64">PORTLETSPEC3-64</a>:
+ {@link javax.portlet.PortletRequest#USER_AGENT PortletRequest#USER_AGENT},
+ {@link javax.portlet.PortletRequest#getPortletContext() PortletRequest#getPortletContext()} and
+ {@link javax.portlet.annotations.ClientDataRequest#getContentLengthLong() ClientDataRequest#getContentLengthLong()}.
+ Updated affected wrapper classes accordingly.
+ </li>
+ <li>
20160226:
Renamed PortletState to RenderState and MutablePortletState to MutableRenderState.
Updated references in affected files.