Author: markt
Date: Thu Oct 15 10:51:55 2015
New Revision: 1708785
URL: http://svn.apache.org/viewvc?rev=1708785&view=rev
Log:
Servlet 4.0
Add the ability to get/set the HTTP method to the PushBuilder
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=1708785&r1=1708784&r2=1708785&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/http/PushBuilder.java (original)
+++ tomcat/trunk/java/javax/servlet/http/PushBuilder.java Thu Oct 15 10:51:55
2015
@@ -33,6 +33,15 @@ import java.util.Set;
public interface PushBuilder {
/**
+ * Specify the HTTP method to use for the push request.
+ *
+ * @param method The method to use for the push request
+ *
+ * @return This builder instance
+ */
+ PushBuilder method(String method);
+
+ /**
* 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
@@ -63,6 +72,14 @@ public interface PushBuilder {
void push();
/**
+ * Obtain the name of the HTTP method that will be used for push requests
+ * generated by future calls to {@code push()}.
+ *
+ * @return The HTTP method to be used for future push requests
+ */
+ String getMethod();
+
+ /**
* Adds a HTTP header to the request.
*
* @param name The name of the header to add
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=1708785&r1=1708784&r2=1708785&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:51:55 2015
@@ -40,6 +40,7 @@ public class ApplicationPushBuilder impl
private final HttpServletRequest baseRequest;
private final org.apache.coyote.Request coyoteRequest;
+ private String method = "GET";
private String path;
private Map<String,List<String>> headers = new CaseInsensitiveKeyMap<>();
@@ -91,6 +92,19 @@ public class ApplicationPushBuilder impl
@Override
+ public PushBuilder method(String method) {
+ this.method = method;
+ return this;
+ }
+
+
+ @Override
+ public String getMethod() {
+ return method;
+ }
+
+
+ @Override
public PushBuilder addHeader(String name, String value) {
List<String> values = headers.get(name);
if (values == null) {
@@ -151,7 +165,7 @@ public class ApplicationPushBuilder impl
org.apache.coyote.Request pushTarget = new org.apache.coyote.Request();
- pushTarget.method().setString("GET");
+ pushTarget.method().setString(method);
// The next three are implied by the Javadoc getPath()
pushTarget.serverName().setString(baseRequest.getServerName());
pushTarget.setServerPort(baseRequest.getServerPort());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]