Author: remy.maucherat(a)jboss.com
Date: 2009-01-16 11:11:42 -0500 (Fri, 16 Jan 2009)
New Revision: 906
Removed:
trunk/java/org/apache/tomcat/util/http/TomcatCookie.java
Modified:
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/connector/Response.java
trunk/java/org/jboss/web/rewrite/RewriteValve.java
trunk/webapps/docs/changelog.xml
Log:
- Remove TomcatCookie, the standard Cookie API adds httpOnly.
- Use standard Cookie in the rewrite valve.
- Still won't build due to unimplemented methods; use an IDE for now.
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-01-16 16:10:23 UTC (rev
905)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-01-16 16:11:42 UTC (rev
906)
@@ -67,7 +67,6 @@
import org.apache.tomcat.util.http.FastHttpDateFormat;
import org.apache.tomcat.util.http.Parameters;
import org.apache.tomcat.util.http.ServerCookie;
-import org.apache.tomcat.util.http.TomcatCookie;
import org.apache.tomcat.util.http.mapper.MappingData;
@@ -2371,7 +2370,7 @@
if ( (session != null) && (getContext() != null)
&& getContext().getCookies()
&& !(isRequestedSessionIdFromCookie() &&
(session.getIdInternal().equals(getRequestedSessionId()))) ) {
- TomcatCookie cookie = new TomcatCookie(Globals.SESSION_COOKIE_NAME,
+ Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,
session.getIdInternal());
configureSessionCookie(cookie);
response.addCookieInternal(cookie);
@@ -2391,7 +2390,7 @@
*
* @param cookie The JSESSIONID cookie to be configured
*/
- protected void configureSessionCookie(TomcatCookie cookie) {
+ protected void configureSessionCookie(Cookie cookie) {
cookie.setMaxAge(-1);
if (context.getSessionCookie().getPath() != null) {
cookie.setPath(context.getSessionCookie().getPath());
Modified: trunk/java/org/apache/catalina/connector/Response.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Response.java 2009-01-16 16:10:23 UTC (rev
905)
+++ trunk/java/org/apache/catalina/connector/Response.java 2009-01-16 16:11:42 UTC (rev
906)
@@ -51,7 +51,6 @@
import org.apache.tomcat.util.http.FastHttpDateFormat;
import org.apache.tomcat.util.http.MimeHeaders;
import org.apache.tomcat.util.http.ServerCookie;
-import org.apache.tomcat.util.http.TomcatCookie;
import org.apache.tomcat.util.net.URL;
/**
@@ -986,23 +985,6 @@
*
* @param cookie Cookie to be added
*/
- public void addTomcatCookie(final TomcatCookie cookie) {
-
- // Ignore any call from an included servlet
- if (included)
- return;
-
- addCookieInternal(cookie);
-
- }
-
-
- /**
- * Add the specified Cookie to those that will be included with
- * this Response.
- *
- * @param cookie Cookie to be added
- */
public void addCookieInternal(final Cookie cookie) {
if (isCommitted())
@@ -1018,7 +1000,7 @@
(sb, cookie.getVersion(), cookie.getName(),
cookie.getValue(), cookie.getPath(),
cookie.getDomain(), cookie.getComment(),
- cookie.getMaxAge(), cookie.getSecure(), false);
+ cookie.getMaxAge(), cookie.getSecure(), cookie.isHttpOnly());
return null;
}
});
@@ -1026,7 +1008,7 @@
ServerCookie.appendCookieValue
(sb, cookie.getVersion(), cookie.getName(), cookie.getValue(),
cookie.getPath(), cookie.getDomain(), cookie.getComment(),
- cookie.getMaxAge(), cookie.getSecure(), false);
+ cookie.getMaxAge(), cookie.getSecure(), cookie.isHttpOnly());
}
// if we reached here, no exception, cookie is valid
// the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
@@ -1039,47 +1021,6 @@
/**
- * Add the specified Cookie to those that will be included with
- * this Response.
- *
- * @param cookie Cookie to be added
- */
- public void addCookieInternal(final TomcatCookie cookie) {
-
- if (isCommitted())
- return;
-
- final StringBuffer sb = new StringBuffer();
- // web application code can receive a IllegalArgumentException
- // from the appendCookieValue invocation
- if (SecurityUtil.isPackageProtectionEnabled()) {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run(){
- ServerCookie.appendCookieValue
- (sb, cookie.getVersion(), cookie.getName(),
- cookie.getValue(), cookie.getPath(),
- cookie.getDomain(), cookie.getComment(),
- cookie.getMaxAge(), cookie.getSecure(), cookie.getHttpOnly());
- return null;
- }
- });
- } else {
- ServerCookie.appendCookieValue
- (sb, cookie.getVersion(), cookie.getName(), cookie.getValue(),
- cookie.getPath(), cookie.getDomain(), cookie.getComment(),
- cookie.getMaxAge(), cookie.getSecure(), cookie.getHttpOnly());
- }
- // if we reached here, no exception, cookie is valid
- // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
- // RFC2965 is not supported by browsers and the Servlet spec
- // asks for 2109.
- addHeader("Set-Cookie", sb.toString());
-
- cookies.add(cookie);
- }
-
-
- /**
* Add the specified date header to the specified value.
*
* @param name Name of the header to set
Deleted: trunk/java/org/apache/tomcat/util/http/TomcatCookie.java
===================================================================
--- trunk/java/org/apache/tomcat/util/http/TomcatCookie.java 2009-01-16 16:10:23 UTC (rev
905)
+++ trunk/java/org/apache/tomcat/util/http/TomcatCookie.java 2009-01-16 16:11:42 UTC (rev
906)
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *
http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tomcat.util.http;
-
-import javax.servlet.http.Cookie;
-
-public class TomcatCookie extends Cookie {
-
- boolean httpOnly = false;
-
- public TomcatCookie(String name, String value) {
- super(name, value);
- }
-
- public boolean getHttpOnly() {
- return httpOnly;
- }
-
- public void setHttpOnly(boolean httpOnly) {
- this.httpOnly = httpOnly;
- }
-
-}
Modified: trunk/java/org/jboss/web/rewrite/RewriteValve.java
===================================================================
--- trunk/java/org/jboss/web/rewrite/RewriteValve.java 2009-01-16 16:10:23 UTC (rev 905)
+++ trunk/java/org/jboss/web/rewrite/RewriteValve.java 2009-01-16 16:11:42 UTC (rev 906)
@@ -53,7 +53,6 @@
import org.apache.catalina.valves.ValveBase;
import org.apache.tomcat.util.buf.CharChunk;
import org.apache.tomcat.util.buf.MessageBytes;
-import org.apache.tomcat.util.http.TomcatCookie;
import org.apache.tomcat.util.net.URL;
public class RewriteValve extends ValveBase
@@ -357,7 +356,7 @@
// - cookie
if (rules[i].isCookie() && newtest != null) {
- TomcatCookie cookie = new TomcatCookie(rules[i].getCookieName(),
+ Cookie cookie = new Cookie(rules[i].getCookieName(),
rules[i].getCookieResult());
cookie.setDomain(rules[i].getCookieDomain());
cookie.setMaxAge(rules[i].getCookieLifetime());
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-01-16 16:10:23 UTC (rev 905)
+++ trunk/webapps/docs/changelog.xml 2009-01-16 16:11:42 UTC (rev 906)
@@ -16,6 +16,27 @@
<body>
+<section name="JBoss Web 3.0.0.CR1 (remm)">
+ <subsection name="General">
+ <changelog>
+ <update>
+ Servlet 3.0 API. (markt, remm)
+ </update>
+ </changelog>
+ </subsection>
+ <subsection name="Catalina">
+ <changelog>
+ <update>
+ Replace TomcatCookie class with the new Cookie API. (remm)
+ </update>
+ </changelog>
+ </subsection>
+ <subsection name="Coyote">
+ <changelog>
+ </changelog>
+ </subsection>
+</section>
+
<section name="JBoss Web 2.1.2.CR1 (remm)">
<subsection name="General">
<changelog>