Package org.apache.cactus

Examples of org.apache.cactus.Cookie


        Enumeration cookies = getCookies().elements();

        while (cookies.hasMoreElements())
        {
            Cookie cookie = (Cookie) cookies.nextElement();

            buffer.append("[" + cookie + "]");
        }

        return buffer.toString();
View Full Code Here


            throw new ChainedRuntimeException("Failed to connect to ["
                + ((WebConfiguration) getConfiguration()).getRedirectorURL(this)
                + "]", e);
        }

        Cookie cookie = response.getCookieIgnoreCase("jsessionid");

        // TODO: Add a constructor to the Cookie class that takes a Cookie
        // as parameter.

        HttpSessionCookie sessionCookie = null;

        if (cookie != null)               
        {
            sessionCookie = new HttpSessionCookie(cookie.getDomain(),
                cookie.getName(), cookie.getValue());
            sessionCookie.setComment(cookie.getComment());
            sessionCookie.setExpiryDate(cookie.getExpiryDate());
            sessionCookie.setPath(cookie.getPath());
            sessionCookie.setSecure(cookie.isSecure());
        }
               
        return sessionCookie;
    }
View Full Code Here

     */
    public void testCreateHttpStateWhenSeveralCactusCookieExist()
        throws Exception
    {
        WebRequest request = new WebRequestImpl();
        request.addCookie(new Cookie("domain1", "name1", "value1"));
        request.addCookie(new Cookie("domain2", "name2", "value2"));
       
        HttpState state = new HttpState();
        state.addCookies(CookieUtil.createHttpClientCookies(request,
            new URL("http://jakarta.apache.org")));

View Full Code Here

     * @exception Exception for backward compatibility with JDK 1.2.2 (not
     *            needed for JDK 1.3+, but needed for URLDecoder.decode())
     */
    public void endReceiveCookie(WebResponse theResponse) throws Exception
    {
        Cookie cookie = theResponse.getCookie("responsecookie");

        assertNotNull("Cannot find [responsecookie]", cookie);
        assertEquals("responsecookie", cookie.getName());


        // Some servers may encode the cookie value (ex: the latest
        // version of Tomcat 4.0). In order for this test to succeed on
        // all servlet engine, we URL decode the cookie value before
        // comparing it.
        assertEquals("this is a response cookie",
            URLDecoder.decode(cookie.getValue()));

        assertEquals("jakarta.apache.org", cookie.getDomain());
    }
View Full Code Here

            throw new ChainedRuntimeException("Failed to connect to ["
                + ((WebConfiguration) getConfiguration()).getRedirectorURL(this)
                + "]", e);
        }

        Cookie cookie = response.getCookieIgnoreCase("jsessionid");

        // TODO: Add a constructor to the Cookie class that takes a Cookie
        // as parameter.

        HttpSessionCookie sessionCookie = null;

        if (cookie != null)               
        {
            sessionCookie = new HttpSessionCookie(cookie.getDomain(),
                cookie.getName(), cookie.getValue());
            sessionCookie.setComment(cookie.getComment());
            sessionCookie.setExpiryDate(cookie.getExpiryDate());
            sessionCookie.setPath(cookie.getPath());
            sessionCookie.setSecure(cookie.isSecure());
        }
               
        return sessionCookie;
    }
View Full Code Here

                int equalsChar = nameValue.indexOf("=");
                String name = nameValue.substring(0, equalsChar);
                String value = nameValue.substring(equalsChar + 1);
                if (name.equalsIgnoreCase(theTarget))
                {
                    return new Cookie(theConnection.getURL().getHost(),
                        name, value);
                }
            }
            key = theConnection.getHeaderFieldKey(++i);
        }
View Full Code Here

     * {@inheritDoc}
     * @see WebRequest#addCookie(String, String, String)
     */
    public void addCookie(String theDomain, String theName, String theValue)
    {
        addCookie(new Cookie(theDomain, theName, theValue));
    }
View Full Code Here

        Enumeration cookies = getCookies().elements();

        while (cookies.hasMoreElements())
        {
            Cookie cookie = (Cookie) cookies.nextElement();

            buffer.append("[" + cookie + "]");
        }

        return buffer.toString();
View Full Code Here

            throw new ChainedRuntimeException("Failed to connect to ["
                + ((WebConfiguration) getConfiguration()).getRedirectorURL(this)
                + "]", e);
        }

        Cookie cookie = response.getCookieIgnoreCase("jsessionid");

        // TODO: Add a constructor to the Cookie class that takes a Cookie
        // as parameter.

        HttpSessionCookie sessionCookie = null;

        if (cookie != null)               
        {
            sessionCookie = new HttpSessionCookie(cookie.getDomain(),
                cookie.getName(), cookie.getValue());
            sessionCookie.setComment(cookie.getComment());
            sessionCookie.setExpiryDate(cookie.getExpiryDate());
            sessionCookie.setPath(cookie.getPath());
            sessionCookie.setSecure(cookie.isSecure());
        }
               
        return sessionCookie;
    }
View Full Code Here

        org.apache.commons.httpclient.Cookie[] httpclientCookies =
            new org.apache.commons.httpclient.Cookie[cactusCookies.size()];

        for (int i = 0; i < cactusCookies.size(); i++)
        {
            Cookie cactusCookie = (Cookie) cactusCookies.elementAt(i);
            httpclientCookies[i] = CookieUtil.createHttpClientCookie(
                theRequest, theUrl, cactusCookie);
        }

        return httpclientCookies;
View Full Code Here

TOP

Related Classes of org.apache.cactus.Cookie

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.