Coverage Report - org.acegisecurity.ui.savedrequest.SavedCookie
 
Classes in this File Line Coverage Branch Coverage Complexity
SavedCookie
100% 
100% 
1.273
 
 1  
 package org.acegisecurity.ui.savedrequest;
 2  
 
 3  
 import javax.servlet.http.Cookie;
 4  
 import java.io.Serializable;
 5  
 
 6  
 /**
 7  
  * Stores off the values of a cookie in a serializable holder
 8  
  *
 9  
  * @author Ray Krueger
 10  
  */
 11  
 public class SavedCookie implements Serializable {
 12  
     private java.lang.String name;
 13  
     private java.lang.String value;
 14  
     private java.lang.String comment;
 15  
     private java.lang.String domain;
 16  
     private int maxAge;
 17  
     private java.lang.String path;
 18  
     private boolean secure;
 19  
     private int version;
 20  
 
 21  9
     public SavedCookie(String name, String value, String comment, String domain, int maxAge, String path, boolean secure, int version) {
 22  9
         this.name = name;
 23  9
         this.value = value;
 24  9
         this.comment = comment;
 25  9
         this.domain = domain;
 26  9
         this.maxAge = maxAge;
 27  9
         this.path = path;
 28  9
         this.secure = secure;
 29  9
         this.version = version;
 30  9
     }
 31  
 
 32  
     public SavedCookie(Cookie cookie) {
 33  9
         this(cookie.getName(), cookie.getValue(), cookie.getComment(),
 34  
                 cookie.getDomain(), cookie.getMaxAge(), cookie.getPath(), cookie.getSecure(), cookie.getVersion());
 35  9
     }
 36  
 
 37  
     public String getName() {
 38  2
         return name;
 39  
     }
 40  
 
 41  
     public String getValue() {
 42  2
         return value;
 43  
     }
 44  
 
 45  
     public String getComment() {
 46  3
         return comment;
 47  
     }
 48  
 
 49  
     public String getDomain() {
 50  3
         return domain;
 51  
     }
 52  
 
 53  
     public int getMaxAge() {
 54  2
         return maxAge;
 55  
     }
 56  
 
 57  
     public String getPath() {
 58  3
         return path;
 59  
     }
 60  
 
 61  
     public boolean isSecure() {
 62  1
         return secure;
 63  
     }
 64  
 
 65  
     public int getVersion() {
 66  2
         return version;
 67  
     }
 68  
 
 69  
     public Cookie getCookie() {
 70  1
         Cookie c = new Cookie(getName(), getValue());
 71  
 
 72  1
         if (getComment() != null)
 73  1
             c.setComment(getComment());
 74  
 
 75  1
         if (getDomain() != null)
 76  1
             c.setDomain(getDomain());
 77  
 
 78  1
         if (getPath() != null)
 79  1
             c.setPath(getPath());
 80  
 
 81  1
         c.setVersion(getVersion());
 82  1
         c.setMaxAge(getMaxAge());
 83  1
         c.setSecure(isSecure());
 84  1
         return c;
 85  
     }
 86  
 }