Examples of CookieImpl


Examples of com.caucho.server.session.CookieImpl

        cb.append("; Comment=");
        cb.append(cookie.getComment());
      }

      if (cookie instanceof CookieImpl) {
        CookieImpl extCookie = (CookieImpl) cookie;
        String port = extCookie.getPort();

        if (port != null && isCookie2) {
          cb.append("; Port=\"");
          cb.append(port);
          cb.append("\"");
View Full Code Here

Examples of com.caucho.server.session.CookieImpl

    if (_request.isSecure())
      cookieName = manager.getSSLCookieName();
    else
      cookieName = manager.getCookieName();

    CookieImpl cookie = new CookieImpl(cookieName, _sessionId);
    cookie.setVersion(manager.getCookieVersion());
    String domain = webApp.generateCookieDomain(_request);
    if (domain != null)
      cookie.setDomain(domain);
    long maxAge = manager.getCookieMaxAge();
    if (maxAge > 0)
      cookie.setMaxAge((int) (maxAge / 1000));
    cookie.setPath(manager.getPath());

    if (manager.getComment() != null)
      cookie.setComment(manager.getComment());

    cookie.setPort(manager.getCookiePort());

    if (manager.isSecure()) {
      // server/12zc (tck) vs server/01io (#4372)
      /*
      if (_request.isSecure())
        cookie.setSecure(true);
        */

      cookie.setSecure(true);
    }
    else if (manager.isCookieSecure()) {
      if (_request.isSecure())
        cookie.setSecure(true);
    }
   
    if (manager.isCookieHttpOnly())
      cookie.setHttpOnly(true);

    return cookie;
  }
View Full Code Here

Examples of com.volantis.shared.net.http.cookies.CookieImpl

        request.setCookies(cookies);

        HTTPMessageEntities entities = factory.createCookies(request);

        Cookie cookieArray [] = new Cookie[2];
        cookieArray[0] = new CookieImpl("One", null, null);
        cookieArray[1] = new CookieImpl("Two", null, null);

        // enusre that a SimpleHTTPMessageEntities is factored
        assertEquals("createCookies should return a " +
                     "SimpleHTTPMessageEntities instance",
                     SimpleHTTPMessageEntities.class,
View Full Code Here

Examples of com.volantis.shared.net.http.cookies.CookieImpl

                    "TEST", "test.domain", "/testdir");
            checkEquality(entity);
        }
        {
            // test WebRequestCookie
            CookieImpl entity = new WebRequestCookie();
            entity.setName("TEST");
            entity.setMaxAge(1);
            entity.setComment("comment");
            entity.setValue("test");
            checkEquality(entity);
        }
        {
            // test WebRequestHeader
            HeaderImpl entity = new WebRequestHeader();
            entity.setName("TEST");
            entity.setValue("test");
            checkEquality(entity);
        }
        {
            // test WebRequestParameter
            RequestParameterImpl entity = new WebRequestParameter();
            entity.setName("TEST");
            entity.setValue("test");
            checkEquality(entity);
        }

    }
View Full Code Here

Examples of com.volantis.shared.net.http.cookies.CookieImpl

     * @param maxAge - max age of the coookie
     * @return new Cookie                               
     */
    private Cookie createCookie(String name, String domain, String path,
                                String value, int maxAge) {
        CookieImpl cookie = new CookieImpl(name, domain, path);
        cookie.setValue(value);
        cookie.setMaxAge(maxAge);
        return cookie;
    }
View Full Code Here

Examples of com.volantis.shared.net.http.cookies.CookieImpl

        CookieImpl[] cookies = new CookieImpl[2];
        int count = 0;
        Iterator cookiesIterator = responseCookies.iterator();
        while (cookiesIterator.hasNext()) {
            CookieImpl cookie = (CookieImpl) cookiesIterator.next();
            cookies[count] = cookie;
            count++;
        }

        assertEquals("Checking cookie 1 name", "name1",
View Full Code Here

Examples of com.volantis.shared.net.http.cookies.CookieImpl

        String cookieName = "Set-Cookie";
        String cookieValue = "name1=value1";
        CookieVersion cookieVersion = CookieVersion.RFC2109;

        final Cookie cookieHeader =
                    new CookieImpl(cookieName, "localhost", ".");
        cookieHeader.setValue(cookieValue);
        cookieHeader.setVersion(cookieVersion);

        String headerName = "Other-Header";
        String headerValue = "o-h-value";
        final Header otherHeader = new HeaderImpl(headerName);
        otherHeader.setValue(headerValue);

        String method = "populateWebDriverResponse";
        Class paramTypes [] = {
            WebDriverResponse.class,
            HTTPResponseAccessor.class,
            HTTPMessageEntities.class};
        Object args [] = {
            response,
            new HTTPResponseAccessor() {
                public HTTPMessageEntities getCookies() {
                    HTTPMessageEntities cookies =
                                new SimpleHTTPMessageEntities();
                    cookies.add(cookieHeader);
                    return cookies;
                }

                public HTTPMessageEntities getHeaders() {
                    HTTPMessageEntities headers =
                                new SimpleHTTPMessageEntities();
                    headers.add(otherHeader);
                    return headers;
                }

                public InputStream getResponseStream() {
                    return null;
                }

                public int getStatusCode() {
                    return 200;
                }

                /**
                 * Get the HTTP version returned by the server.
                 * @return The HTTP version returned by the server.
                 */
                public HTTPVersion getHTTPVersion() {
                    return HTTPVersion.HTTP_1_1;
                }

            },
            new SimpleHTTPMessageEntities()
        };
        PrivateAccessor.invoke(manager, method, paramTypes, args);

        HTTPMessageEntities responseHeaders = response.getHeaders();
        HTTPMessageEntities responseCookies = response.getCookies();

        assertTrue("Expected one header.", responseHeaders.size() == 1);
        assertTrue("Expected one cookies.", responseCookies.size() == 1);

        Iterator headers = responseHeaders.iterator();
        while (headers.hasNext()) {
            HeaderImpl header = (HeaderImpl) headers.next();
            assertEquals("Unexpected header name.",
                         headerName, header.getName());
            assertEquals("Unexpected header value.",
                         headerValue, header.getValue());
        }

        Iterator cookiesIterator = responseCookies.iterator();
        while (cookiesIterator.hasNext()) {
            CookieImpl cookie = (CookieImpl) cookiesIterator.next();
            assertEquals("Checking cookie name",
                         cookieName,
                         cookie.getName());
            assertEquals("Checking cookie value",
                         cookieValue,
                         cookie.getValue());
            assertEquals("checking cookie version",
                         cookieVersion,
                         cookie.getVersion());
        }
    }
View Full Code Here

Examples of com.volantis.shared.net.http.cookies.CookieImpl

        WebDriverAccessor accessor = createWebDriverAccessor(request, response);
        container.setProperty(WebDriverAccessor.class, accessor, false);

        String cookieName = "Set-Cookie";
        String cookieValue = "name1=value1";
        final Cookie cookie1 = new CookieImpl(cookieName, "localhost", "/");
        cookie1.setValue(cookieValue);

        String headerName = "Other-Header";
        String headerValue = "o-h-value";
        final Header otherHeader = new HeaderImpl(headerName);
        otherHeader.setValue(headerValue);

        HTTPMessageEntities additionalCookies = new SimpleHTTPMessageEntities();
        Cookie additionalCookie = new CookieImpl("additionalName",
                                                 "localhost",
                                                 "/");
        additionalCookie.setValue("additionalValue");
        additionalCookies.add(additionalCookie);

        String method = "populateWebDriverResponse";

        Class paramTypes [] = {
            WebDriverResponse.class,
            HTTPResponseAccessor.class,
            HTTPMessageEntities.class};

        Object[] args  = {
            response,
            new HTTPResponseAccessor() {
                public HTTPMessageEntities getCookies() {
                    HTTPMessageEntities cookies =
                                new SimpleHTTPMessageEntities();
                    cookies.add(cookie1);
                    return cookies;
                }

                public HTTPMessageEntities getHeaders() {
                    HTTPMessageEntities headers =
                                new SimpleHTTPMessageEntities();
                    headers.add(otherHeader);
                    return headers;
                }

                public InputStream getResponseStream() {
                    return null;
                }

                public int getStatusCode() {
                    return 200;
                }

                /**
                 * Get the HTTP version returned by the server.
                 * @return The HTTP version returned by the server.
                 */
                public HTTPVersion getHTTPVersion() {
                    return HTTPVersion.HTTP_1_1;
                }
            },
            additionalCookies
        };
        PrivateAccessor.invoke(manager, method, paramTypes, args);

        HTTPMessageEntities responseHeaders = response.getHeaders();
        HTTPMessageEntities responseCookies = response.getCookies();

        final int expectedCookies = 2;
        assertEquals("Expected one header.", 1, responseHeaders.size());
        assertEquals("Expected number of cookies to match", expectedCookies,
                     responseCookies.size());

        Iterator headers = responseHeaders.iterator();
        while (headers.hasNext()) {
            HeaderImpl header = (HeaderImpl) headers.next();
            assertEquals("Unexpected header name.",
                         headerName, header.getName());
            assertEquals("Unexpected header value.",
                         headerValue, header.getValue());
        }

        CookieImpl[] cookies = new CookieImpl[expectedCookies];

        int count = 0;
        Iterator cookiesIterator = responseCookies.iterator();
        while (cookiesIterator.hasNext()) {
            CookieImpl cookie = (CookieImpl) cookiesIterator.next();
            cookies[count] = cookie;
            count++;
        }

        assertEquals("Checking cookie 1 name",
View Full Code Here

Examples of com.volantis.shared.net.http.cookies.CookieImpl

        return new SimpleHTTPMessageEntities();
    }

    // javadoc inherited
    public Cookie createCookie(String name, String domain, String path) {
        return new CookieImpl(name, domain, path);
    }
View Full Code Here

Examples of io.undertow.server.handlers.CookieImpl

                cookies.put(name, value);
            }
        }

        for (final Map.Entry<String, String> entry : cookies.entrySet()) {
            Cookie c = new CookieImpl(entry.getKey(), entry.getValue());
            if (additional.containsKey(DOMAIN)) {
                c.setDomain(additional.get(DOMAIN));
            }
            if (additional.containsKey(VERSION)) {
                c.setVersion(Integer.parseInt(additional.get(VERSION)));
            }
            if (additional.containsKey(PATH)) {
                c.setPath(additional.get(PATH));
            }
            parsedCookies.put(c.getName(), c);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.