Package org.apache.tapestry.internal.services

Examples of org.apache.tapestry.internal.services.CookiesImpl


    CookieSink cookieSink,

    @Inject("${tapestry.default-cookie-max-age}")
    int defaultMaxAge)
    {
        return new CookiesImpl(contextPathSource, cookieSource, cookieSink, defaultMaxAge);
    }
View Full Code Here


    private void attempt(String name, String expected, String[] nameValues)
    {
        // In seconds
        final int ONE_WEEK = 7 * 24 * 60 * 60;
        CookiesImpl cs = new CookiesImpl(null, newCookieSource(nameValues), null, ONE_WEEK);
        String actual = cs.readCookieValue(name);
        assertEquals(actual, expected);
    }
View Full Code Here

    }

    public void test_Write_Cookie_Domain()
    {
        final List<Cookie> cookies = CollectionFactory.newList();
        CookiesImpl cs = new CookiesImpl(new ContextPathSource()
        {

            public String getContextPath()
            {
                return "/context";
            }

        }, null, new CookieSink()
        {

            public void addCookie(Cookie cookie)
            {
                cookies.add(cookie);
            }

        }, 1000);

        cs.writeDomainCookieValue("foo", "bar", "fobar.com", 1234);
        Cookie expectedCookie = new ComparableCookie("foo", "bar", 1234);
        expectedCookie.setPath("/context/");
        expectedCookie.setDomain("fobar.com");
        assertEquals(cookies.size(), 1);
        assertEquals(cookies.get(0), expectedCookie);
View Full Code Here

    }

    public void test_Write_Cookie_With_Max_Age()
    {
        final List<Cookie> cookies = CollectionFactory.newList();
        CookiesImpl cs = new CookiesImpl(new ContextPathSource()
        {

            public String getContextPath()
            {
                return "/ctx";
            }

        }, null, new CookieSink()
        {

            public void addCookie(Cookie cookie)
            {
                cookies.add(cookie);
            }

        }, 1000);
        cs.writeCookieValue("foo", "bar", -1);
        Cookie expectedCookie = new ComparableCookie("foo", "bar", -1);
        expectedCookie.setPath("/ctx/");
        assertEquals(cookies.size(), 1);
        assertEquals(cookies.get(0), expectedCookie);
    }
View Full Code Here

    }

    public void test_Write_Cookie()
    {
        final List<Cookie> cookies = CollectionFactory.newList();
        CookiesImpl cs = new CookiesImpl(new ContextPathSource()
        {

            public String getContextPath()
            {
                return "/ctx";
            }

        }, null, new CookieSink()
        {

            public void addCookie(Cookie cookie)
            {
                cookies.add(cookie);
            }

        }, 1000);
        cs.writeCookieValue("foo", "bar");
        Cookie expectedCookie = new ComparableCookie("foo", "bar", 1000);
        expectedCookie.setPath("/ctx/");
        assertEquals(cookies.size(), 1);
        assertEquals(cookies.get(0), expectedCookie);
    }
View Full Code Here

    }

    public void test_Remove_Cookie()
    {
        final List<Cookie> cookies = CollectionFactory.newList();
        CookiesImpl cs = new CookiesImpl(new ContextPathSource()
        {

            public String getContextPath()
            {
                return "/ctx";
            }

        }, null, new CookieSink()
        {

            public void addCookie(Cookie cookie)
            {
                cookies.add(cookie);
            }

        }, 1000);
        cs.removeCookieValue("foo");
        Cookie expectedCookie = new ComparableCookie("foo", null, 0);
        expectedCookie.setPath("/ctx/");
        assertEquals(cookies.size(), 1);
        assertEquals(cookies.get(0), expectedCookie);
    }
View Full Code Here

    CookieSink cookieSink,

    @Inject("${tapestry.default-cookie-max-age}")
    int defaultMaxAge)
    {
        return new CookiesImpl(contextPathSource, cookieSource, cookieSink, defaultMaxAge);
    }
View Full Code Here

    ContextPathSource contextPathSource, @InjectService("tapestry.internal.CookieSource")
    CookieSource cookieSource, @InjectService("tapestry.internal.CookieSink")
    CookieSink cookieSink, @Inject("${tapestry.default-cookie-max-age}")
    int defaultMaxAge)
    {
        return new CookiesImpl(contextPathSource, cookieSource, cookieSink, defaultMaxAge);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.internal.services.CookiesImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.