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/18 09:33:32 UTC
portals-pluto git commit: Based on feedback from the EG,
the implementation of PORTLETSPEC3-63 'Make user agent available to
the portlet' was changed. Removed PortletRequest#USER_AGENT constant. Added
PortletRequest#getUserAgent()method. Made correspondi
Repository: portals-pluto
Updated Branches:
refs/heads/master 713a70959 -> 8a89cc49f
Based on feedback from the EG, the implementation of PORTLETSPEC3-63 'Make
user agent available to the portlet' was changed. Removed
PortletRequest#USER_AGENT constant. Added
PortletRequest#getUserAgent()method. Made corresponding changes in the
implementation and test classes.
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/8a89cc49
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/8a89cc49
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/8a89cc49
Branch: refs/heads/master
Commit: 8a89cc49f57be5dea401f8f45209f81952fa6a93
Parents: 713a709
Author: Scott Nicklous <ms...@apache.org>
Authored: Mon Apr 18 09:26:24 2016 +0200
Committer: Scott Nicklous <ms...@apache.org>
Committed: Mon Apr 18 09:26:24 2016 +0200
----------------------------------------------------------------------
.../portals/samples/HelloWorldRender.java | 3 +--
.../container/impl/PortletRequestImpl.java | 7 +++++-
.../fixtures/mocks/MockPortletRequest.java | 5 ++++
.../java/javax/portlet/PortletAsyncContext.java | 4 ++--
.../main/java/javax/portlet/PortletRequest.java | 25 +++++++++-----------
.../portlet/filter/PortletRequestWrapper.java | 5 ++++
portlet-api/src/main/javadoc/overview.html | 9 ++++++-
7 files changed, 38 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8a89cc49/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 b9c1394..c9615f3 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,6 @@
package org.apache.portals.samples;
import javax.inject.Inject;
-import javax.portlet.PortletRequest;
import javax.portlet.RenderRequest;
import javax.portlet.annotations.RenderMethod;
@@ -89,7 +88,7 @@ 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>");
+ txt.append("<p>User agent: ").append(req.getUserAgent()).append("</p>");
return txt.toString();
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8a89cc49/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 af3dbb4..a3897e1 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
@@ -65,7 +65,8 @@ import org.slf4j.LoggerFactory;
*/
public abstract class PortletRequestImpl implements PortletRequest
{
- public static final String ACCEPT_LANGUAGE = "Accept-Language";
+ public static final String ACCEPT_LANGUAGE = "Accept-Language";
+ public static final String USER_AGENT = "User-Agent";
private static final Logger LOG = LoggerFactory.getLogger(PortletRequestImpl.class);
private static boolean isDebug = LOG.isDebugEnabled();
@@ -723,4 +724,8 @@ public abstract class PortletRequestImpl implements PortletRequest
public RenderParameters getRenderParameters() {
return requestContext.getRenderParameters();
}
+
+ public String getUserAgent() {
+ return getProperty(USER_AGENT);
+ }
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8a89cc49/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 c259aaa..7716126 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
@@ -372,4 +372,9 @@ public class MockPortletRequest implements PortletRequest {
public void setAttribute(String arg0, Object arg1) {
}
+ @Override
+ public String getUserAgent() {
+ return null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8a89cc49/portlet-api/src/main/java/javax/portlet/PortletAsyncContext.java
----------------------------------------------------------------------
diff --git a/portlet-api/src/main/java/javax/portlet/PortletAsyncContext.java b/portlet-api/src/main/java/javax/portlet/PortletAsyncContext.java
index 8469c45..f94c006 100644
--- a/portlet-api/src/main/java/javax/portlet/PortletAsyncContext.java
+++ b/portlet-api/src/main/java/javax/portlet/PortletAsyncContext.java
@@ -325,7 +325,7 @@ public interface PortletAsyncContext {
*
* @since 3.0
*
- * @return
+ * @return The resource request object
* @throws IllegalStateException
* if one of the dispatch methods has been called but the <code>startAsync</code> method has not
* been called during the resulting dispatch, or if <code>complete()</code> was called
@@ -340,7 +340,7 @@ public interface PortletAsyncContext {
*
* @since 3.0
*
- * @return
+ * @return The resource response object
* @throws IllegalStateException
* if one of the dispatch methods has been called but the <code>startAsync</code> method has not
* been called during the resulting dispatch, or if <code>complete()</code> was called
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8a89cc49/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 780d9c3..0557e2e 100644
--- a/portlet-api/src/main/java/javax/portlet/PortletRequest.java
+++ b/portlet-api/src/main/java/javax/portlet/PortletRequest.java
@@ -303,20 +303,6 @@ 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";
-
/**
@@ -1015,4 +1001,15 @@ public interface PortletRequest extends RenderState
@Deprecated
public java.util.Map<String, String[]> getPublicParameterMap();
+
+ /**
+ * <div class="changed_added_3_0">
+ * Returns the user agent for the request.
+ * </div>
+ *
+ * @return The user agent string.
+ * @since 3.0
+ */
+ public String getUserAgent();
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8a89cc49/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 46fdd25..232c158 100644
--- a/portlet-api/src/main/java/javax/portlet/filter/PortletRequestWrapper.java
+++ b/portlet-api/src/main/java/javax/portlet/filter/PortletRequestWrapper.java
@@ -408,4 +408,9 @@ public class PortletRequestWrapper extends RenderStateWrapper implements Portlet
return ((PortletRequest)wrapped).getPublicParameterMap();
}
+ @Override
+ public String getUserAgent() {
+ return ((PortletRequest)wrapped).getUserAgent();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/8a89cc49/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 4e6f55b..3e4cbbe 100644
--- a/portlet-api/src/main/javadoc/overview.html
+++ b/portlet-api/src/main/javadoc/overview.html
@@ -21,6 +21,14 @@
<div class="indexContainer-not">
<ul>
<li>
+ 20160418:
+ Added new method to implement
+ <a href="https://java.net/jira/browse/PORTLETSPEC3-63">PORTLETSPEC3-63 Make user agent available to Portlets</a>:
+ {@link javax.portlet.PortletRequest#getUserAgent() PortletRequest#getUserAgent()}.
+ and altered the corresponding wrapper class accordingly.
+ Removed the PortletRequest#USER_AGENT constant, as an alternative implementation was agreed upon.
+ </li>
+ <li>
20160406:
Added new classes to implement
<a href="https://java.net/jira/browse/PORTLETSPEC3-68">PORTLETSPEC3-68 Add Async Support</a>:
@@ -55,7 +63,6 @@
<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.ClientDataRequest#getContentLengthLong() ClientDataRequest#getContentLengthLong()}.
Updated affected wrapper classes accordingly.