< prev index next >
modules/javafx.web/src/main/java/com/sun/webkit/network/Cookie.java
Print this page
*** 23,46 ****
* questions.
*/
package com.sun.webkit.network;
import java.net.URI;
import java.text.ParseException;
- import java.util.logging.Level;
- import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* An RFC 6265-compliant cookie.
*/
final class Cookie {
! private static final Logger logger =
! Logger.getLogger(Cookie.class.getName());
private static final Pattern IP_ADDRESS_PATTERN = Pattern.compile(
"(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})");
private final String name;
--- 23,46 ----
* questions.
*/
package com.sun.webkit.network;
+ import com.sun.javafx.logging.PlatformLogger;
+
import java.net.URI;
import java.text.ParseException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* An RFC 6265-compliant cookie.
*/
final class Cookie {
! private static final PlatformLogger logger =
! PlatformLogger.getLogger(Cookie.class.getName());
private static final Pattern IP_ADDRESS_PATTERN = Pattern.compile(
"(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})");
private final String name;
*** 81,104 ****
/**
* Parses a {@code Set-Cookie} header string into a {@code Cookie}
* object.
*/
static Cookie parse(String setCookieString, ExtendedTime currentTime) {
! logger.log(Level.FINEST, "setCookieString: [{0}]", setCookieString);
String[] items = setCookieString.split(";", -1);
String[] nameValuePair = items[0].split("=", 2);
if (nameValuePair.length != 2) {
! logger.log(Level.FINEST, "Name-value pair string lacks '=', "
+ "ignoring cookie");
return null;
}
String name = nameValuePair[0].trim();
String value = nameValuePair[1].trim();
if (name.length() == 0) {
! logger.log(Level.FINEST, "Name string is empty, ignoring cookie");
return null;
}
Long expires = null;
Long maxAge = null;
--- 81,104 ----
/**
* Parses a {@code Set-Cookie} header string into a {@code Cookie}
* object.
*/
static Cookie parse(String setCookieString, ExtendedTime currentTime) {
! logger.finest("setCookieString: [{0}]", setCookieString);
String[] items = setCookieString.split(";", -1);
String[] nameValuePair = items[0].split("=", 2);
if (nameValuePair.length != 2) {
! logger.finest("Name-value pair string lacks '=', "
+ "ignoring cookie");
return null;
}
String name = nameValuePair[0].trim();
String value = nameValuePair[1].trim();
if (name.length() == 0) {
! logger.finest("Name string is empty, ignoring cookie");
return null;
}
Long expires = null;
Long maxAge = null;
*** 124,138 ****
} else if ("Secure".equalsIgnoreCase(attrName)) {
secure = true;
} else if ("HttpOnly".equalsIgnoreCase(attrName)) {
httpOnly = true;
} else {
! logger.log(Level.FINEST, "Unknown attribute: [{0}], "
+ "ignoring", attrName);
}
} catch (ParseException ex) {
! logger.log(Level.FINEST, "{0}, ignoring", ex.getMessage());
}
}
long expiryTime;
boolean persistent;
--- 124,138 ----
} else if ("Secure".equalsIgnoreCase(attrName)) {
secure = true;
} else if ("HttpOnly".equalsIgnoreCase(attrName)) {
httpOnly = true;
} else {
! logger.finest("Unknown attribute: [{0}], "
+ "ignoring", attrName);
}
} catch (ParseException ex) {
! logger.finest("{0}, ignoring", ex.getMessage());
}
}
long expiryTime;
boolean persistent;
*** 152,162 ****
}
Cookie result = new Cookie(name, value, expiryTime, domain, path,
currentTime, currentTime.baseTime(), persistent, false,
secure, httpOnly);
! logger.log(Level.FINEST, "result: {0}", result);
return result;
}
/**
* Parses the value of the {@code Expires} attribute.
--- 152,162 ----
}
Cookie result = new Cookie(name, value, expiryTime, domain, path,
currentTime, currentTime.baseTime(), persistent, false,
secure, httpOnly);
! logger.finest("result: {0}", result);
return result;
}
/**
* Parses the value of the {@code Expires} attribute.
< prev index next >