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 2015/10/15 12:55:02 UTC
svn commit: r1708786 - in /tomcat/trunk:
java/javax/servlet/http/PushBuilder.java
java/org/apache/catalina/core/ApplicationPushBuilder.java
webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java
Author: markt
Date: Thu Oct 15 10:55:01 2015
New Revision: 1708786
URL: http://svn.apache.org/viewvc?rev=1708786&view=rev
Log:
Servlet 4.0
Re-order methods in PushBuilder interface to make javap checks between spec API definition and Tomcat's API definition easier.
Correct method name setPath() -> path()
Modified:
tomcat/trunk/java/javax/servlet/http/PushBuilder.java
tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java
tomcat/trunk/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.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=1708786&r1=1708785&r2=1708786&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/http/PushBuilder.java (original)
+++ tomcat/trunk/java/javax/servlet/http/PushBuilder.java Thu Oct 15 10:55:01 2015
@@ -25,7 +25,7 @@ import java.util.Set;
* <ul>
* <li>The request method is set to <code>GET</code></li>
* <li>The path will not be set. This must be set explicitly via a call to
- * {@link #setPath(String)}</li>
+ * {@link #path(String)}</li>
* </ul>
*
* @since Servlet 4.0
@@ -42,6 +42,36 @@ public interface PushBuilder {
PushBuilder method(String method);
/**
+ * Sets a HTTP header on the request. Any existing headers of the same name
+ * are first remove.
+ *
+ * @param name The name of the header to set
+ * @param value The value of the header to set
+ *
+ * @return This builder instance
+ */
+ PushBuilder setHeader(String name, String value);
+
+ /**
+ * Adds a HTTP header to the request.
+ *
+ * @param name The name of the header to add
+ * @param value The value of the header to add
+ *
+ * @return This builder instance
+ */
+ PushBuilder addHeader(String name, String value);
+
+ /**
+ * Removes an HTTP header from the request.
+ *
+ * @param name The name of the header to remove
+ *
+ * @return This builder instance
+ */
+ PushBuilder removeHeader(String name);
+
+ /**
* Sets the URI path to be used for the push request. This must be called
* before every call to {@link #push()}. If the path includes a query
* string, the query string will be appended to the existing query string
@@ -54,7 +84,7 @@ public interface PushBuilder {
*
* @return This builder instance
*/
- PushBuilder setPath(String path);
+ PushBuilder path(String path);
/**
* Generates the push request. After calling this method the following
@@ -80,36 +110,6 @@ public interface PushBuilder {
String getMethod();
/**
- * Adds a HTTP header to the request.
- *
- * @param name The name of the header to add
- * @param value The value of the header to add
- *
- * @return This builder instance
- */
- PushBuilder addHeader(String name, String value);
-
- /**
- * Sets a HTTP header on the request. Any existing headers of the same name
- * are first remove.
- *
- * @param name The name of the header to set
- * @param value The value of the header to set
- *
- * @return This builder instance
- */
- PushBuilder setHeader(String name, String value);
-
- /**
- * Removes an HTTP header from the request.
- *
- * @param name The name of the header to remove
- *
- * @return This builder instance
- */
- PushBuilder removeHeader(String name);
-
- /**
* @return The current set of names of HTTP headers to be used the next time
* {@code push()} is called.
*/
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=1708786&r1=1708785&r2=1708786&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java Thu Oct 15 10:55:01 2015
@@ -75,7 +75,7 @@ public class ApplicationPushBuilder impl
@Override
- public PushBuilder setPath(String path) {
+ public PushBuilder path(String path) {
if (path.startsWith("/")) {
this.path = path;
} else {
Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java?rev=1708786&r1=1708785&r2=1708786&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java Thu Oct 15 10:55:01 2015
@@ -33,7 +33,7 @@ public class SimpleImagePush extends Htt
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
- PushBuilder pb = req.getPushBuilder().setPath("servlets/images/code.gif");
+ PushBuilder pb = req.getPushBuilder().path("servlets/images/code.gif");
pb.push();
resp.setCharacterEncoding("UTF-8");
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org