/** * Creates a cookie with the given name, value, domain attribute, * path attribute, expiration attribute, secure attribute, and ports * attribute. * * @param name the cookie name * @param value the cookie value * @param domain the domain this cookie can be sent to * @param path the path prefix for which this cookie can be sent * @param expires the {@link Date} at which this cookie expires, * or <tt>null</tt> if the cookie expires at the end * of the session * @param secure if true this cookie can only be sent over secure * connections * @param ports the ports for which this cookie can be sent * @throws IllegalArgumentException If cookie name is null or blank, * cookie name contains a blank, or cookie name starts with character $ * */ public Cookie2(String domain, String name, String value, String path, Date expires, boolean secure, int[] ports) { super(domain, name, value, path, expires, secure); setPorts(ports); }
/** * Parse cookie port attribute. */ public void parse(final Cookie cookie, final String portValue) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof Cookie2) { Cookie2 cookie2 = (Cookie2) cookie; if ((portValue == null) || (portValue.trim().equals(""))) { // If the Port attribute is present but has no value, the // cookie can only be sent to the request-port. // Since the default port list contains only request-port, we don't // need to do anything here. cookie2.setPortAttributeBlank(true); } else { int[] ports = parsePortAttribute(portValue); cookie2.setPorts(ports); } cookie2.setPortAttributeSpecified(true); } }
/** * Creates a cookie with the given name, value, domain attribute, * path attribute, expiration attribute, secure attribute, and ports * attribute. * * @param name the cookie name * @param value the cookie value * @param domain the domain this cookie can be sent to * @param path the path prefix for which this cookie can be sent * @param expires the {@link Date} at which this cookie expires, * or <tt>null</tt> if the cookie expires at the end * of the session * @param secure if true this cookie can only be sent over secure * connections * @param ports the ports for which this cookie can be sent * @throws IllegalArgumentException If cookie name is null or blank, * cookie name contains a blank, or cookie name starts with character $ * */ public Cookie2(String domain, String name, String value, String path, Date expires, boolean secure, int[] ports) { super(domain, name, value, path, expires, secure); setPorts(ports); }
/** * Creates a cookie with the given name, value, domain attribute, * path attribute, expiration attribute, secure attribute, and ports * attribute. * * @param name the cookie name * @param value the cookie value * @param domain the domain this cookie can be sent to * @param path the path prefix for which this cookie can be sent * @param expires the {@link Date} at which this cookie expires, * or <tt>null</tt> if the cookie expires at the end * of the session * @param secure if true this cookie can only be sent over secure * connections * @param ports the ports for which this cookie can be sent * @throws IllegalArgumentException If cookie name is null or blank, * cookie name contains a blank, or cookie name starts with character $ * */ public Cookie2(String domain, String name, String value, String path, Date expires, boolean secure, int[] ports) { super(domain, name, value, path, expires, secure); setPorts(ports); }
/** * Creates a cookie with the given name, value, domain attribute, * path attribute, expiration attribute, secure attribute, and ports * attribute. * * @param name the cookie name * @param value the cookie value * @param domain the domain this cookie can be sent to * @param path the path prefix for which this cookie can be sent * @param expires the {@link Date} at which this cookie expires, * or <tt>null</tt> if the cookie expires at the end * of the session * @param secure if true this cookie can only be sent over secure * connections * @param ports the ports for which this cookie can be sent * @throws IllegalArgumentException If cookie name is null or blank, * cookie name contains a blank, or cookie name starts with character $ * */ public Cookie2(String domain, String name, String value, String path, Date expires, boolean secure, int[] ports) { super(domain, name, value, path, expires, secure); setPorts(ports); }
/** * Creates a cookie with the given name, value, domain attribute, * path attribute, expiration attribute, secure attribute, and ports * attribute. * * @param name the cookie name * @param value the cookie value * @param domain the domain this cookie can be sent to * @param path the path prefix for which this cookie can be sent * @param expires the {@link Date} at which this cookie expires, * or <tt>null</tt> if the cookie expires at the end * of the session * @param secure if true this cookie can only be sent over secure * connections * @param ports the ports for which this cookie can be sent * @throws IllegalArgumentException If cookie name is null or blank, * cookie name contains a blank, or cookie name starts with character $ * */ public Cookie2(String domain, String name, String value, String path, Date expires, boolean secure, int[] ports) { super(domain, name, value, path, expires, secure); setPorts(ports); }
/** * Parse cookie port attribute. */ public void parse(final Cookie cookie, final String portValue) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof Cookie2) { Cookie2 cookie2 = (Cookie2) cookie; if ((portValue == null) || (portValue.trim().equals(""))) { // If the Port attribute is present but has no value, the // cookie can only be sent to the request-port. // Since the default port list contains only request-port, we don't // need to do anything here. cookie2.setPortAttributeBlank(true); } else { int[] ports = parsePortAttribute(portValue); cookie2.setPorts(ports); } cookie2.setPortAttributeSpecified(true); } }
/** * Parse cookie port attribute. */ public void parse(final Cookie cookie, final String portValue) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof Cookie2) { Cookie2 cookie2 = (Cookie2) cookie; if ((portValue == null) || (portValue.trim().equals(""))) { // If the Port attribute is present but has no value, the // cookie can only be sent to the request-port. // Since the default port list contains only request-port, we don't // need to do anything here. cookie2.setPortAttributeBlank(true); } else { int[] ports = parsePortAttribute(portValue); cookie2.setPorts(ports); } cookie2.setPortAttributeSpecified(true); } }
/** * Parse cookie port attribute. */ public void parse(final Cookie cookie, final String portValue) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof Cookie2) { Cookie2 cookie2 = (Cookie2) cookie; if ((portValue == null) || (portValue.trim().equals(""))) { // If the Port attribute is present but has no value, the // cookie can only be sent to the request-port. // Since the default port list contains only request-port, we don't // need to do anything here. cookie2.setPortAttributeBlank(true); } else { int[] ports = parsePortAttribute(portValue); cookie2.setPorts(ports); } cookie2.setPortAttributeSpecified(true); } }
/** * Parse cookie port attribute. */ public void parse(final Cookie cookie, final String portValue) throws MalformedCookieException { if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } if (cookie instanceof Cookie2) { Cookie2 cookie2 = (Cookie2) cookie; if ((portValue == null) || (portValue.trim().equals(""))) { // If the Port attribute is present but has no value, the // cookie can only be sent to the request-port. // Since the default port list contains only request-port, we don't // need to do anything here. cookie2.setPortAttributeBlank(true); } else { int[] ports = parsePortAttribute(portValue); cookie2.setPorts(ports); } cookie2.setPortAttributeSpecified(true); } }