Code example for CookieOrigin

Methods: getHost, getPath, getPort

0
 
/** 
 * <p>RFC 2965 specific cookie management functions.</p> 
 *  
 * @author jain.samit@gmail.com (Samit Jain) 
 * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a> 
 * 
 * @since 3.1 
 */ 
public class RFC2965Spec extends RFC2109Spec {
 
    /**  
     * Default constructor  
     *  
     */ 
    public RFC2965Spec() { 
        this(null, false); 
    } 
     
    public RFC2965Spec(final String[] datepatterns, boolean oneHeader) {
        super(datepatterns, oneHeader);
        registerAttribHandler(ClientCookie.DOMAIN_ATTR, new RFC2965DomainAttributeHandler());
        registerAttribHandler(ClientCookie.PORT_ATTR, new RFC2965PortAttributeHandler());
        registerAttribHandler(ClientCookie.COMMENTURL_ATTR, new RFC2965CommentUrlAttributeHandler());
        registerAttribHandler(ClientCookie.DISCARD_ATTR, new RFC2965DiscardAttributeHandler());
        registerAttribHandler(ClientCookie.VERSION_ATTR, new RFC2965VersionAttributeHandler());
    } 
     
    private BasicClientCookie createCookie(
            final String name, final String value, final CookieOrigin origin) {
        BasicClientCookie cookie = new BasicClientCookie(name, value);
        cookie.setPath(getDefaultPath(origin));
        cookie.setDomain(getDefaultDomain(origin));
        return cookie;
    } 
     
    private BasicClientCookie createCookie2(
            final String name, final String value, final CookieOrigin origin) {
        BasicClientCookie2 cookie = new BasicClientCookie2(name, value);
        cookie.setPath(getDefaultPath(origin));
        cookie.setDomain(getDefaultDomain(origin));
        cookie.setPorts(new int [] { origin.getPort() });
        return cookie;
    } 
     
    @Override 
    public List<Cookie> parse(