Author: markt
Date: Thu Oct 15 20:29:11 2015
New Revision: 1708886
URL: http://svn.apache.org/viewvc?rev=1708886&view=rev
Log:
Keep a reference to the cookie objects that are added to the response. It makes
generating HTTP/2 server push requests a lot simpler.
Modified:
tomcat/trunk/java/org/apache/catalina/connector/Response.java
Modified: tomcat/trunk/java/org/apache/catalina/connector/Response.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Response.java?rev=1708886&r1=1708885&r2=1708886&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Response.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Response.java Thu Oct 15
20:29:11 2015
@@ -250,6 +250,12 @@ public class Response
protected final CharChunk redirectURLCC = new CharChunk();
+ /*
+ * Not strictly required but it makes generating HTTP/2 push requests a lot
+ * easier if these are retained until the response is recycled.
+ */
+ private final List<Cookie> cookies = new ArrayList<>();
+
// --------------------------------------------------------- Public Methods
@@ -259,6 +265,7 @@ public class Response
*/
public void recycle() {
+ cookies.clear();
outputBuffer.recycle();
usingOutputStream = false;
usingWriter = false;
@@ -287,6 +294,11 @@ public class Response
}
+ public List<Cookie> getCookies() {
+ return cookies;
+ }
+
+
// ------------------------------------------------------- Response Methods
/**
@@ -894,6 +906,8 @@ public class Response
return;
}
+ cookies.add(cookie);
+
String header = generateCookieString(cookie);
//if we reached here, no exception, cookie is valid
// the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]