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/03/20 09:55:52 UTC

svn commit: r1787701 - in /tomcat/trunk/java: javax/servlet/http/PushBuilder.java org/apache/catalina/core/ApplicationPushBuilder.java

Author: markt
Date: Mon Mar 20 09:55:52 2017
New Revision: 1787701

URL: http://svn.apache.org/viewvc?rev=1787701&view=rev
Log:
PushBuilder updates from Servlet EG
Remove eTag, conditional and lastModified

Modified:
    tomcat/trunk/java/javax/servlet/http/PushBuilder.java
    tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java

Modified: tomcat/trunk/java/javax/servlet/http/PushBuilder.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/PushBuilder.java?rev=1787701&r1=1787700&r2=1787701&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/http/PushBuilder.java (original)
+++ tomcat/trunk/java/javax/servlet/http/PushBuilder.java Mon Mar 20 09:55:52 2017
@@ -34,9 +34,6 @@ import java.util.Set;
  * <li>The referer header will be set to
  *     {@link HttpServletRequest#getRequestURL()} plus, if present, the query
  *     string from {@link HttpServletRequest#getQueryString()}.
- * <li>If either of the headers {@code If-Modified-Since} or
- *     {@code If-None-Match} were present then {@link #isConditional()} will be
- *     set to {@code true}.
  * </ul>
  *
  * @since Servlet 4.0
@@ -87,17 +84,6 @@ public interface PushBuilder {
     PushBuilder sessionId(String sessionId);
 
     /**
-     * Sets if the request will be conditional. If {@code true} the values from
-     * {@link #getETag()} and {@link #getLastModified()} will be used to
-     * construct appropriate headers.
-     *
-     * @param conditional Should generated push requests be conditional
-     *
-     * @return This builder instance
-     */
-    PushBuilder conditional(boolean conditional);
-
-    /**
      * Sets a HTTP header on the request. Any existing headers of the same name
      * are first remove.
      *
@@ -143,28 +129,6 @@ public interface PushBuilder {
     PushBuilder path(String path);
 
     /**
-     * Sets the eTag to be used for conditional push requests. This will be
-     * set to {@code null} after a call to {@link #push()} so it must be
-     * explicitly set for every push request that requires it.
-     *
-     * @param eTag The eTag use for the push request
-     *
-     * @return This builder instance
-     */
-    PushBuilder eTag(String eTag);
-
-    /**
-     * Sets the last modified to be used for conditional push requests. This
-     * will be set to {@code null} after a call to {@link #push()} so it must be
-     * explicitly set for every push request that requires it.
-     *
-     * @param lastModified The last modified value to use for the push request
-     *
-     * @return This builder instance
-     */
-    PushBuilder lastModified(String lastModified);
-
-    /**
      * Generates the push request and sends it to the client unless pushes are
      * not available for some reason. After calling this method the following
      * fields are set to {@code null}:
@@ -205,14 +169,6 @@ public interface PushBuilder {
     String getSessionId();
 
     /**
-     * Will push requests generated by future calls to {@code push()} be
-     * conditional.
-     *
-     * @return {@code true} if push requests will be conditional
-     */
-    boolean isConditional();
-
-    /**
      * @return The current set of names of HTTP headers to be used the next time
      *         {@code push()} is called.
      */
@@ -237,21 +193,4 @@ public interface PushBuilder {
      * @return The path value that will be associated with the next push request
      */
     String getPath();
-
-    /**
-     * Obtain the eTag that will be used for the push request that will be
-     * generated by the next call to {@code push()}.
-     *
-     * @return The eTag value that will be associated with the next push request
-     */
-    String getETag();
-
-    /**
-     * Obtain the last modified that will be used for the push request that will
-     * be generated by the next call to {@code push()}.
-     *
-     * @return The last modified value that will be associated with the next
-     *         push request
-     */
-    String getLastModified();
 }

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java?rev=1787701&r1=1787700&r2=1787701&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java Mon Mar 20 09:55:52 2017
@@ -72,11 +72,8 @@ public class ApplicationPushBuilder impl
     private final List<Cookie> cookies = new ArrayList<>();
     private String method = "GET";
     private String path;
-    private String eTag;
-    private String lastModified;
     private String queryString;
     private String sessionId;
-    private boolean conditional;
 
 
     public ApplicationPushBuilder(HttpServletRequest request) {
@@ -108,12 +105,8 @@ public class ApplicationPushBuilder impl
 
         // Remove the headers
         headers.remove("if-match");
-        if (headers.remove("if-none-match") != null) {
-            conditional = true;
-        }
-        if (headers.remove("if-modified-since") != null) {
-            conditional = true;
-        }
+        headers.remove("if-none-match");
+        headers.remove("if-modified-since");
         headers.remove("if-unmodified-since");
         headers.remove("if-range");
         headers.remove("range");
@@ -228,32 +221,6 @@ public class ApplicationPushBuilder impl
 
 
     @Override
-    public PushBuilder eTag(String eTag) {
-        this.eTag = eTag;
-        return this;
-    }
-
-
-    @Override
-    public String getETag() {
-        return eTag;
-    }
-
-
-    @Override
-    public PushBuilder lastModified(String lastModified) {
-        this.lastModified = lastModified;
-        return this;
-    }
-
-
-    @Override
-    public String getLastModified() {
-        return lastModified;
-    }
-
-
-    @Override
     public PushBuilder queryString(String queryString) {
         this.queryString = queryString;
         return this;
@@ -280,19 +247,6 @@ public class ApplicationPushBuilder impl
 
 
     @Override
-    public PushBuilder conditional(boolean conditional) {
-        this.conditional = conditional;
-        return this;
-    }
-
-
-    @Override
-    public boolean isConditional() {
-        return conditional;
-    }
-
-
-    @Override
     public PushBuilder addHeader(String name, String value) {
         List<String> values = headers.get(name);
         if (values == null) {
@@ -404,14 +358,6 @@ public class ApplicationPushBuilder impl
             pushTarget.queryString().setString(pushQueryString + "&" +queryString);
         }
 
-        if (conditional) {
-            if (eTag != null) {
-                setHeader("if-none-match", eTag);
-            } else if (lastModified != null) {
-                setHeader("if-modified-since", lastModified);
-            }
-        }
-
         // Cookies
         setHeader("cookie", generateCookieHeader(cookies,
                 catalinaRequest.getContext().getCookieProcessor()));
@@ -421,8 +367,6 @@ public class ApplicationPushBuilder impl
         // Reset for next call to this method
         pushTarget = null;
         path = null;
-        eTag = null;
-        lastModified = null;
         headers.remove("if-none-match");
         headers.remove("if-modified-since");
     }



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