Author: jaz
Date: Tue Jan 6 09:49:52 2009
New Revision: 732023
URL:
http://svn.apache.org/viewvc?rev=732023&view=revLog:
found a few more instances of cookie.setVersion(1) which is experimental (from javadoc) and does not work in safari. Added event method to remove ACCESS code cookies
Modified:
ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java
Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java?rev=732023&r1=732022&r2=732023&view=diff==============================================================================
--- ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java (original)
+++ ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java Tue Jan 6 09:49:52 2009
@@ -265,14 +265,12 @@
Cookie siteIdCookie = new Cookie("Ofbiz.TKCD.SiteId" ,siteId);
siteIdCookie.setMaxAge(siteIdCookieAge);
siteIdCookie.setPath("/");
- siteIdCookie.setVersion(1);
if (cookieDomain.length() > 0) siteIdCookie.setDomain(cookieDomain);
response.addCookie(siteIdCookie);
// if trackingCode.siteId is not null write a trackable cookie with name in the form: Ofbiz.TKCSiteId and timeout will be 60 * 60 * 24 * 365
Cookie updatedTimeStampCookie = new Cookie("Ofbiz.TKCD.UpdatedTimeStamp" ,UtilDateTime.nowTimestamp().toString());
updatedTimeStampCookie.setMaxAge(siteIdCookieAge);
updatedTimeStampCookie.setPath("/");
- updatedTimeStampCookie.setVersion(1);
if (cookieDomain.length() > 0) updatedTimeStampCookie.setDomain(cookieDomain);
response.addCookie(updatedTimeStampCookie);
}
@@ -421,7 +419,21 @@
// no tracking code or tracking code invalid; redirect to the access page (i.e. request named 'protect')
return ":_protect_:";
}
-
+
+ /** Removes the ACCESS tracking code cookie */
+ public static String removeAccesTrackingCodeCookie(HttpServletRequest request, HttpServletResponse response) {
+ Cookie[] cookies = request.getCookies();
+ if (cookies != null) {
+ for (Cookie cookie : cookies) {
+ if (cookie.getName().endsWith("_ACCESS")) {
+ cookie.setMaxAge(0);
+ response.addCookie(cookie);
+ }
+ }
+ }
+ return "success";
+ }
+
/** Makes a list of TrackingCodeOrder entities to be attached to the current order; called by the createOrder event; the values in the returned List will not have the orderId set */
public static List makeTrackingCodeOrders(HttpServletRequest request) {
GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");