You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2017/02/28 20:13:31 UTC

svn commit: r1784803 - in /tomcat/trunk/java: javax/servlet/http/HttpServletRequest.java javax/servlet/http/HttpServletRequestWrapper.java org/apache/catalina/connector/Request.java

Author: markt
Date: Tue Feb 28 20:13:31 2017
New Revision: 1784803

URL: http://svn.apache.org/viewvc?rev=1784803&view=rev
Log:
Servlet 4 EG discussion concluded that it was cleaner to remove isPushSupported() and simply return null from getPushBuilder()

Modified:
    tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java
    tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java
    tomcat/trunk/java/org/apache/catalina/connector/Request.java

Modified: tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java?rev=1784803&r1=1784802&r2=1784803&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java (original)
+++ tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java Tue Feb 28 20:13:31 2017
@@ -240,25 +240,16 @@ public interface HttpServletRequest exte
     public String getPathTranslated();
 
     /**
-     * Does the current request allow push requests. This will return {@code
-     * true} only if the underlying protocol supports server push and if pushes
-     * are permitted from the current request.
-     *
-     * @return {@code true} if server push is supported for the current request
-     *         otherwise {@code false}
-     */
-    public default boolean isPushSupported() {
-        return false;
-    }
-
-    /**
      * Obtain a builder for generating push requests. {@link PushBuilder}
      * documents how this request will be used as the basis for a push request.
      * Each call to this method will return a new instance, independent of any
      * previous instance obtained.
      *
      * @return A builder that can be used to generate push requests based on
-     *         this request.
+     *         this request or {@code null} if push is not supported. Note that
+     *         even if a PushBuilder instance is returned, by the time that
+     *         {@link PushBuilder#push()} is called, it may no longer be valid
+     *         to push a request and the push request will be ignored.
      *
      * @since Servlet 4.0
      */

Modified: tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java?rev=1784803&r1=1784802&r2=1784803&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java (original)
+++ tomcat/trunk/java/javax/servlet/http/HttpServletRequestWrapper.java Tue Feb 28 20:13:31 2017
@@ -388,20 +388,6 @@ public class HttpServletRequestWrapper e
      * {@inheritDoc}
      * <p>
      * The default behavior of this method is to return
-     * {@link HttpServletRequest#isPushSupported()} on the wrapped request object.
-     *
-     * @since Servlet 4.0
-     */
-    @Override
-    public boolean isPushSupported() {
-        return this._getHttpServletRequest().isPushSupported();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * The default behavior of this method is to return
      * {@link HttpServletRequest#getPushBuilder()} on the wrapped request object.
      *
      * @since Servlet 4.0

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1784803&r1=1784802&r2=1784803&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Tue Feb 28 20:13:31 2017
@@ -1887,25 +1887,19 @@ public class Request implements HttpServ
      * @since Servlet 4.0
      */
     @Override
-    public boolean isPushSupported() {
+    public PushBuilder getPushBuilder() {
         AtomicBoolean result = new AtomicBoolean();
         coyoteRequest.action(ActionCode.IS_PUSH_SUPPORTED, result);
-        return result.get();
+        if (result.get()) {
+            return new ApplicationPushBuilder(this);
+        } else {
+            return null;
+        }
     }
 
 
     /**
      * {@inheritDoc}
-     *
-     * @since Servlet 4.0
-     */
-    @Override
-    public PushBuilder getPushBuilder() {
-        return new ApplicationPushBuilder(this);
-    }
-
-    /**
-     * {@inheritDoc}
      *
      * @since Servlet 3.1
      */



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org