Author: markt
Date: Tue Feb 28 20:34:43 2017
New Revision: 1784806

URL: http://svn.apache.org/viewvc?rev=1784806&view=rev
Log:
Servlet 4 EG made the following changes
- etag -> eTag
- change return of push() from boolean to void

Removed:
    tomcat/trunk/java/org/apache/coyote/PushToken.java
Modified:
    tomcat/trunk/java/javax/servlet/http/PushBuilder.java
    tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java
    tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java
    tomcat/trunk/java/org/apache/coyote/http2/Stream.java
    tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.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=1784806&r1=1784805&r2=1784806&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/http/PushBuilder.java (original)
+++ tomcat/trunk/java/javax/servlet/http/PushBuilder.java Tue Feb 28 20:34:43 
2017
@@ -82,7 +82,7 @@ public interface PushBuilder {
 
     /**
      * Sets if the request will be conditional. If {@code true} the values from
-     * {@link #getEtag()} and {@link #getLastModified()} will be used to
+     * {@link #getETag()} and {@link #getLastModified()} will be used to
      * construct appropriate headers.
      *
      * @param conditional Should generated push requests be conditional
@@ -137,15 +137,15 @@ public interface PushBuilder {
     PushBuilder path(String path);
 
     /**
-     * Sets the etag to be used for conditional push requests. This will be
+     * 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
+     * @param eTag The eTag use for the push request
      *
      * @return This builder instance
      */
-    PushBuilder etag(String etag);
+    PushBuilder eTag(String eTag);
 
     /**
      * Sets the last modified to be used for conditional push requests. This
@@ -168,14 +168,11 @@ public interface PushBuilder {
      * <li>{@code lastModified}</li>
      * </ul>
      *
-     * @return {@code true} if the push request was sent to the client,
-     *         otherwise {@code false}
-     *
      * @throws IllegalStateException If this method is called when {@code path}
      *         is {@code null}
      * @throws IllegalArgumentException If the request to push requires a body
      */
-    boolean push();
+    void push();
 
     /**
      * Obtain the name of the HTTP method that will be used for push requests
@@ -236,12 +233,12 @@ public interface PushBuilder {
     String getPath();
 
     /**
-     * Obtain the etag that will be used for the push request that will be
+     * 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
+     * @return The eTag value that will be associated with the next push 
request
      */
-    String getEtag();
+    String getETag();
 
     /**
      * Obtain the last modified that will be used for the push request that 
will

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=1784806&r1=1784805&r2=1784806&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java Tue 
Feb 28 20:34:43 2017
@@ -38,7 +38,6 @@ import org.apache.catalina.Context;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.util.SessionConfig;
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.PushToken;
 import org.apache.tomcat.util.buf.B2CConverter;
 import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.collections.CaseInsensitiveKeyMap;
@@ -61,7 +60,7 @@ public class ApplicationPushBuilder impl
     private final List<Cookie> cookies = new ArrayList<>();
     private String method = "GET";
     private String path;
-    private String etag;
+    private String eTag;
     private String lastModified;
     private String queryString;
     private String sessionId;
@@ -205,15 +204,15 @@ public class ApplicationPushBuilder impl
 
 
     @Override
-    public PushBuilder etag(String etag) {
-        this.etag = etag;
+    public PushBuilder eTag(String eTag) {
+        this.eTag = eTag;
         return this;
     }
 
 
     @Override
-    public String getEtag() {
-        return etag;
+    public String getETag() {
+        return eTag;
     }
 
 
@@ -323,7 +322,7 @@ public class ApplicationPushBuilder impl
 
 
     @Override
-    public boolean push() {
+    public void push() {
         if (path == null) {
             throw new 
IllegalStateException(sm.getString("pushBuilder.noPath"));
         }
@@ -382,8 +381,8 @@ public class ApplicationPushBuilder impl
         }
 
         if (conditional) {
-            if (etag != null) {
-                setHeader("if-none-match", etag);
+            if (eTag != null) {
+                setHeader("if-none-match", eTag);
             } else if (lastModified != null) {
                 setHeader("if-modified-since", lastModified);
             }
@@ -393,18 +392,15 @@ public class ApplicationPushBuilder impl
         setHeader("cookie", generateCookieHeader(cookies,
                 catalinaRequest.getContext().getCookieProcessor()));
 
-        PushToken pushToken = new PushToken(pushTarget);
-        coyoteRequest.action(ActionCode.PUSH_REQUEST, pushToken);
+        coyoteRequest.action(ActionCode.PUSH_REQUEST, pushTarget);
 
         // Reset for next call to this method
         pushTarget = null;
         path = null;
-        etag = null;
+        eTag = null;
         lastModified = null;
         headers.remove("if-none-match");
         headers.remove("if-modified-since");
-
-        return pushToken.getResult();
     }
 
 

Modified: tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java?rev=1784806&r1=1784805&r2=1784806&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java Tue Feb 28 
20:34:43 2017
@@ -482,7 +482,7 @@ public abstract class AbstractProcessor
             break;
         }
         case PUSH_REQUEST: {
-            doPush((PushToken) param);
+            doPush((Request) param);
             break;
         }
         }
@@ -747,13 +747,13 @@ public abstract class AbstractProcessor
      * Process a push. Processors that support push should override this method
      * and process the provided token.
      *
-     * @param pushToken Contains all the information necessary for the 
Processor
-     *                  to process the push request
+     * @param pushTarget Contains all the information necessary for the 
Processor
+     *                   to process the push request
      *
      * @throws UnsupportedOperationException if the protocol does not support
      *         push
      */
-    protected void doPush(PushToken pushToken) {
+    protected void doPush(Request pushTarget) {
         throw new UnsupportedOperationException(
                 sm.getString("abstractProcessor.pushrequest.notsupported"));
     }

Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Stream.java?rev=1784806&r1=1784805&r2=1784806&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Tue Feb 28 20:34:43 
2017
@@ -478,9 +478,9 @@ class Stream extends AbstractStream impl
     }
 
 
-    final boolean push(Request request) throws IOException {
+    final void push(Request request) throws IOException {
         if (!isPushSupported()) {
-            return false;
+            return;
         }
         // Set the special HTTP/2 headers
         
request.getMimeHeaders().addValue(":method").duplicate(request.method());
@@ -503,8 +503,6 @@ class Stream extends AbstractStream impl
         }
 
         push(handler, request, this);
-
-        return true;
     }
 
 

Modified: tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java?rev=1784806&r1=1784805&r2=1784806&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java Tue Feb 28 
20:34:43 2017
@@ -24,7 +24,7 @@ import org.apache.coyote.ActionCode;
 import org.apache.coyote.Adapter;
 import org.apache.coyote.ContainerThreadMarker;
 import org.apache.coyote.ErrorState;
-import org.apache.coyote.PushToken;
+import org.apache.coyote.Request;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.buf.ByteChunk;
@@ -203,9 +203,9 @@ class StreamProcessor extends AbstractPr
 
 
     @Override
-    protected final void doPush(PushToken pushToken) {
+    protected final void doPush(Request pushTarget) {
         try {
-            pushToken.setResult(stream.push(pushToken.getPushTarget()));
+            stream.push(pushTarget);
         } catch (IOException ioe) {
             setErrorState(ErrorState.CLOSE_CONNECTION_NOW, ioe);
             response.setErrorException(ioe);



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

Reply via email to