Пример #1
0
 /** Adds valid Port attribute value, e.g. "8000,8001,8002" */
 @Override
 protected void formatCookieAsVer(final CharArrayBuffer buffer, final Cookie cookie, int version) {
   super.formatCookieAsVer(buffer, cookie, version);
   // format port attribute
   if (cookie instanceof ClientCookie) {
     // Test if the port attribute as set by the origin server is not blank
     String s = ((ClientCookie) cookie).getAttribute(ClientCookie.PORT_ATTR);
     if (s != null) {
       buffer.append("; $Port");
       buffer.append("=\"");
       if (s.trim().length() > 0) {
         int[] ports = cookie.getPorts();
         if (ports != null) {
           for (int i = 0, len = ports.length; i < len; i++) {
             if (i > 0) {
               buffer.append(",");
             }
             buffer.append(Integer.toString(ports[i]));
           }
         }
       }
       buffer.append("\"");
     }
   }
 }
Пример #2
0
 @Override
 public void validate(final Cookie cookie, final CookieOrigin origin)
     throws MalformedCookieException {
   Args.notNull(cookie, "Cookie");
   Args.notNull(origin, "Cookie origin");
   super.validate(cookie, adjustEffectiveHost(origin));
 }
Пример #3
0
 @Override
 public void validate(final Cookie cookie, CookieOrigin origin) throws MalformedCookieException {
   if (cookie == null) {
     throw new IllegalArgumentException("Cookie may not be null");
   }
   if (origin == null) {
     throw new IllegalArgumentException("Cookie origin may not be null");
   }
   origin = adjustEffectiveHost(origin);
   super.validate(cookie, origin);
 }