Get the relevant cookie jar

@return CookieJar|FileCookieJar|SessionCookieJar
@throws YouHostingException
961252
private function setCookieJar()
    {
        switch($this->options['cookie_type']){
            case 'array':
                $this->cookiejar = new CookieJar();
                break;
            case 'file':
                $this->cookiejar = new FileCookieJar($this->options['cookie_file_name']);
                break;
            case 'session':
                $this->cookiejar = new SessionCookieJar($this->options['cookie_session_key']);
                break;
            default:
                throw new YouHostingException("You didn't specify a valid cookie type!");
        }
    }
229241
function() {
            var cookieString = "";

            utils.forEach(this._cookieStore, function (cookieValue, cookieKey) {
                cookieString += cookieKey;
                cookieString += '=';
                cookieString += cookieValue;
                cookieString += '; ';
            });

            return cookieString;

        }
1211633
private File getJarPath() {
        String decodedPath = ".";
        String jarPath = "";
        final ProtectionDomain domain = Settings.class.getProtectionDomain();
        if (domain != null && domain.getCodeSource() != null && domain.getCodeSource().getLocation() != null) {
            jarPath = Settings.class.getProtectionDomain().getCodeSource().getLocation().getPath();
        }
        try {
            decodedPath = URLDecoder.decode(jarPath, StandardCharsets.UTF_8.name());
        } catch (UnsupportedEncodingException ex) {
            LOGGER.trace("", ex);
        }

        final File path = new File(decodedPath);
        if (path.getName().toLowerCase().endsWith(".jar")) {
            return path.getParentFile();
        } else {
            return new File(".");
        }
    }
407117
public function regenerate(): SessionId
    {
        $this->id = $this->create();
        $this->response->addCookie(
                Cookie::create($this->sessionName, $this->id)->forPath('/')
        );
        return $this;
    }
896088
def cookiejar(name='session'):
    
    log = logging.getLogger('ipsv.common.cookiejar')
    spath = os.path.join(config().get('Paths', 'Data'), '{n}.txt'.format(n=name))
    cj = cookielib.LWPCookieJar(spath)
    log.debug('Attempting to load session file: %s', spath)
    if os.path.exists(spath):
        try:
            cj.load()
            log.info('Successfully loaded a saved session / cookie file')
        except cookielib.LoadError as e:
            log.warn('Session / cookie file exists, but could not be loaded', exc_info=e)

    return cj
580092
@Override
    public Cookie toCookie() {
        Cookie cookie = new Cookie(this.name, this.value);
        cookie.setComment(this.comment);
        if (this.domain != null) {
            // FYI: setDomain requires non-null argument (requirement not documented)
            cookie.setDomain(this.domain);
        }

        final int maxAge;
        if (this.expires == null) {
            maxAge = -1;
        } else {
            maxAge =
                    (int)
                            TimeUnit.MILLISECONDS.toSeconds(
                                    this.expires.getMillis() - System.currentTimeMillis());
        }
        cookie.setMaxAge(maxAge);
        cookie.setPath(this.path);
        cookie.setSecure(this.secure);
        cookie.setVersion(this.version);
        return cookie;
    }
907499
def _build_cookie_jar(cls, session: AppSession):
        ''''''

        if not session.args.cookies:
            return

        if session.args.load_cookies or session.args.save_cookies:
            session.factory.set('CookieJar', BetterMozillaCookieJar)

            cookie_jar = session.factory.new('CookieJar')

            if session.args.load_cookies:
                cookie_jar.load(session.args.load_cookies, ignore_discard=True)
        else:
            cookie_jar = session.factory.new('CookieJar')

        policy = session.factory.new('CookiePolicy', cookie_jar=cookie_jar)

        cookie_jar.set_policy(policy)

        _logger.debug(__('Loaded cookies: {0}', list(cookie_jar)))

        cookie_jar_wrapper = session.factory.new(
            'CookieJarWrapper',
            cookie_jar,
            save_filename=session.args.save_cookies,
            keep_session_cookies=session.args.keep_session_cookies,
        )

        return cookie_jar_wrapper
1093481
public function getSession()
    {
        if (is_null($this->_session)) {
            $this->_session = $this->getContainer()->get('session');
        }
        return $this->_session;
    }
47686
public function serialize()
    {
        //Unsets the event class and event manager. For the `Client` instance,
        //  it takes only configuration and cookies
        $properties = get_object_vars($this);
        unset($properties['_eventClass'], $properties['_eventManager']);
        $properties['Client'] = $this->Client->getConfig() + ['cookieJar' => $this->Client->cookies()];

        return serialize($properties);
    }
101120
@Override
    public String getSessionCookieName() {
        String result = getSessionCookieNameFromContext((Context) getContainer());
        if ( result == null ) {
            result = Globals.SESSION_COOKIE_NAME;
            _log.debug( "Using session cookie name from context: " + result );
        }
        return result;
    }
235754
public function withCookies(): self
    {
        return tap($this, function ($request) {
            return $this->options = array_merge_recursive($this->options, [
                'cookies' => static::getCookieJar(),
            ]);
        });
    }
235680
public function getJs()
    {
        $sJsLibUri = $this->getJsLibUri();
        $sJsLibExt = $this->getJsLibExt();
        $sJsCoreUrl = $sJsLibUri . 'jaxon.core' . $sJsLibExt;
        $sJsDebugUrl = $sJsLibUri . 'jaxon.debug' . $sJsLibExt;
        // $sJsVerboseUrl = $sJsLibUri . 'jaxon.verbose' . $sJsLibExt;
        $sJsLanguageUrl = $sJsLibUri . 'lang/jaxon.' . $this->getOption('core.language') . $sJsLibExt;

        // Add component files to the javascript file array;
        $aJsFiles = array($sJsCoreUrl);
        if($this->getOption('core.debug.on'))
        {
            $aJsFiles[] = $sJsDebugUrl;
            $aJsFiles[] = $sJsLanguageUrl;
            /*if($this->getOption('core.debug.verbose'))
            {
                $aJsFiles[] = $sJsVerboseUrl;
            }*/
        }

        // Set the template engine cache dir
        $this->setTemplateCacheDir();
        $this->makePluginsCode();

        return $this->render('jaxon::plugins/includes.js', [
            'sJsOptions' => $this->getOption('js.app.options'),
            'aUrls' => $aJsFiles,
        ]) . $this->sJsCode;
    }
159398
public URI buildJar() {
        if (option.getName() == null) {
            option.name(UUID.randomUUID().toString());
        }
        try {
            File explodedJarDir = getExplodedJarDir();
            File probeJar = new File(tempDir, option.getName() + ".jar");
            ZipBuilder builder = new ZipBuilder(probeJar);
            builder.addDirectory(explodedJarDir, "");
            builder.close();
            URI warUri = probeJar.toURI();
            LOG.info("JAR probe = {}", warUri);
            return warUri;
        }
        catch (IOException exc) {
            throw new TestContainerException(exc);
        }
    }
696600
@Override
    public Cookie toCookie() {
        Cookie cookie = new Cookie(name, value);
        cookie.setComment(comment);
        if (domain != null) {
            cookie.setDomain(domain);
        }
        cookie.setMaxAge(getMaxAge());
        cookie.setPath(path);
        cookie.setSecure(secure);
        cookie.setVersion(version);
        return cookie;
    }
666952
public function getCookie(): ?Factory
    {
        if (!$this->hasCookie()) {
            $this->setCookie($this->getDefaultCookie());
        }
        return $this->cookie;
    }
682748
public static function getLifetime()
    {
        Base::checkOpen();
        if (Base::driver() == 'file') {
            return intval(ini_get('session.cookie_lifetime'));
        }
        return Base::getSessionObject()->getLifetime();
    }
1352067
public Cookie getSessionCookie(HttpSession session,boolean requestIsSecure)
    {
        if (_handler.isUsingCookies())
        {
            Cookie cookie = _handler.getSessionManager().getHttpOnly()
                ?new HttpOnlyCookie(SessionManager.__SessionCookie,session.getId())
                :new Cookie(SessionManager.__SessionCookie,session.getId());    
            String domain=_handler.getServletContext().getInitParameter(SessionManager.__SessionDomain);
            String maxAge=_handler.getServletContext().getInitParameter(SessionManager.__MaxAge);
            String path=_handler.getServletContext().getInitParameter(SessionManager.__SessionPath);
            if (path==null)
                path=getCrossContextSessionIDs()?"/":_handler.getHttpContext().getContextPath();
            if (path==null || path.length()==0)
                path="/";
            
            if (domain!=null)
                cookie.setDomain(domain);       
            if (maxAge!=null)
                cookie.setMaxAge(Integer.parseInt(maxAge));
            else
                cookie.setMaxAge(-1);
            
            cookie.setSecure(requestIsSecure && getSecureCookies());
            cookie.setPath(path);
            
            return cookie;    
        }
        return null;
    }