mobile/android/thirdparty/ch/boye/httpclientandroidlib/impl/cookie/BasicClientCookie2.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/impl/cookie/BasicClientCookie2.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,103 @@
     1.4 +/*
     1.5 + * ====================================================================
     1.6 + * Licensed to the Apache Software Foundation (ASF) under one
     1.7 + * or more contributor license agreements.  See the NOTICE file
     1.8 + * distributed with this work for additional information
     1.9 + * regarding copyright ownership.  The ASF licenses this file
    1.10 + * to you under the Apache License, Version 2.0 (the
    1.11 + * "License"); you may not use this file except in compliance
    1.12 + * with the License.  You may obtain a copy of the License at
    1.13 + *
    1.14 + *   http://www.apache.org/licenses/LICENSE-2.0
    1.15 + *
    1.16 + * Unless required by applicable law or agreed to in writing,
    1.17 + * software distributed under the License is distributed on an
    1.18 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    1.19 + * KIND, either express or implied.  See the License for the
    1.20 + * specific language governing permissions and limitations
    1.21 + * under the License.
    1.22 + * ====================================================================
    1.23 + *
    1.24 + * This software consists of voluntary contributions made by many
    1.25 + * individuals on behalf of the Apache Software Foundation.  For more
    1.26 + * information on the Apache Software Foundation, please see
    1.27 + * <http://www.apache.org/>.
    1.28 + *
    1.29 + */
    1.30 +
    1.31 +package ch.boye.httpclientandroidlib.impl.cookie;
    1.32 +
    1.33 +import java.io.Serializable;
    1.34 +import java.util.Date;
    1.35 +
    1.36 +import ch.boye.httpclientandroidlib.annotation.NotThreadSafe;
    1.37 +
    1.38 +import ch.boye.httpclientandroidlib.cookie.SetCookie2;
    1.39 +
    1.40 +/**
    1.41 + * Default implementation of {@link SetCookie2}.
    1.42 + *
    1.43 + * @since 4.0
    1.44 + */
    1.45 +@NotThreadSafe
    1.46 +public class BasicClientCookie2 extends BasicClientCookie implements SetCookie2, Serializable {
    1.47 +
    1.48 +    private static final long serialVersionUID = -7744598295706617057L;
    1.49 +
    1.50 +    private String commentURL;
    1.51 +    private int[] ports;
    1.52 +    private boolean discard;
    1.53 +
    1.54 +    /**
    1.55 +     * Default Constructor taking a name and a value. The value may be null.
    1.56 +     *
    1.57 +     * @param name The name.
    1.58 +     * @param value The value.
    1.59 +     */
    1.60 +    public BasicClientCookie2(final String name, final String value) {
    1.61 +        super(name, value);
    1.62 +    }
    1.63 +
    1.64 +    @Override
    1.65 +    public int[] getPorts() {
    1.66 +        return this.ports;
    1.67 +    }
    1.68 +
    1.69 +    public void setPorts(final int[] ports) {
    1.70 +        this.ports = ports;
    1.71 +    }
    1.72 +
    1.73 +    @Override
    1.74 +    public String getCommentURL() {
    1.75 +        return this.commentURL;
    1.76 +    }
    1.77 +
    1.78 +    public void setCommentURL(final String commentURL) {
    1.79 +        this.commentURL = commentURL;
    1.80 +    }
    1.81 +
    1.82 +    public void setDiscard(boolean discard) {
    1.83 +        this.discard = discard;
    1.84 +    }
    1.85 +
    1.86 +    @Override
    1.87 +    public boolean isPersistent() {
    1.88 +        return !this.discard && super.isPersistent();
    1.89 +    }
    1.90 +
    1.91 +    @Override
    1.92 +    public boolean isExpired(final Date date) {
    1.93 +        return this.discard || super.isExpired(date);
    1.94 +    }
    1.95 +
    1.96 +    @Override
    1.97 +    public Object clone() throws CloneNotSupportedException {
    1.98 +        BasicClientCookie2 clone = (BasicClientCookie2) super.clone();
    1.99 +        if (this.ports != null) {
   1.100 +            clone.ports = this.ports.clone();
   1.101 +        }
   1.102 +        return clone;
   1.103 +    }
   1.104 +
   1.105 +}
   1.106 +

mercurial