Package java.net

Examples of java.net.HttpCookie$Setter


    protected CreditCardAuthorizationResult run() {
        // Simulate transitive dependency from CreditCardCommand to GetUserAccountCommand.
        // UserAccount could be injected into this command as an argument (and that would be more accurate)
        // but often in large codebase that ends up not happening and each library fetches common data
        // such as user information directly such as this example.
        UserAccount user = new GetUserAccountCommand(new HttpCookie("mockKey", "mockValueFromHttpRequest")).execute();
        if (user.getAccountType() == 1) {
            // do something
        } else {
            // do something else
        }
View Full Code Here


    public Order(int orderId) {
        this.orderId = orderId;

        /* a contrived example of calling GetUserAccount again */
        user = new GetUserAccountCommand(new HttpCookie("mockKey", "mockValueFromHttpRequest")).execute();
    }
View Full Code Here

        BayeuxClient client = newBayeuxClient();
        client.handshake();
        assertTrue(client.waitFor(5000, BayeuxClient.State.CONNECTED));

        long maxAge = 1;
        HttpCookie cookie = new HttpCookie("foo", "bar");
        cookie.setMaxAge(maxAge);
        client.putCookie(cookie);
        assertNotNull(client.getCookie(cookie.getName()));

        // Allow cookie to expire
        TimeUnit.SECONDS.sleep(maxAge * 2);

        assertNull(client.getCookie(cookie.getName()));

        cookie = new HttpCookie("foo", "bar");
        client.putCookie(cookie);
        assertNotNull(client.getCookie(cookie.getName()));

        TimeUnit.SECONDS.sleep(maxAge * 2);

        assertNotNull(client.getCookie(cookie.getName()));

        disconnectBayeuxClient(client);
    }
View Full Code Here

                return true;
            }
        });

        BayeuxClient client = newBayeuxClient();
        client.putCookie(new HttpCookie(cookieName, cookieValue));
        client.handshake();

        Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));

        disconnectBayeuxClient(client);
View Full Code Here

        BayeuxClient client = newBayeuxClient();
        client.handshake();

        Assert.assertTrue(client.waitFor(5000, BayeuxClient.State.CONNECTED));

        HttpCookie cookie = client.getCookie(CookieConstants.COOKIE_NAME);
        Assert.assertEquals(CookieConstants.COOKIE_VALUE, cookie.getValue());

        disconnectBayeuxClient(client);
    }
View Full Code Here

                .send();
        Assert.assertEquals(200, response.getStatus());

        List<HttpCookie> cookies = httpClient.getCookieStore().get(uri);
        Assert.assertNotNull(cookies);
        HttpCookie sessionCookie = null;
        for (HttpCookie cookie : cookies)
        {
            if ("jsessionid".equalsIgnoreCase(cookie.getName()))
                sessionCookie = cookie;
        }
View Full Code Here

        final CountDownLatch publishLatch = new CountDownLatch(1);
        new CookieService(bayeux, channelName, cookie1, cookie2, handshakeLatch, connectLatch, subscribeLatch, unsubscribeLatch, publishLatch);

        BayeuxClient client = newBayeuxClient();

        client.putCookie(new HttpCookie(cookie1, "value1"));
        client.putCookie(new HttpCookie(cookie2, "value2"));

        client.handshake();

        assertTrue(handshakeLatch.await(5, TimeUnit.SECONDS));
        assertTrue(connectLatch.await(5, TimeUnit.SECONDS));
View Full Code Here

            }
        });
        client1.handshake();

        assertTrue(client1.waitFor(5000, BayeuxClient.State.CONNECTED));
        HttpCookie cookie = client1.getCookie("BAYEUX_BROWSER");
        assertNotNull(cookie);

        // Give some time to the first client to establish the long poll before the second client
        Thread.sleep(1000);
View Full Code Here

                    connects1.offer(message);
            }
        });
        client1.handshake();
        assertTrue(client1.waitFor(5000, BayeuxClient.State.CONNECTED));
        HttpCookie cookie = client1.getCookie("BAYEUX_BROWSER");
        assertNotNull(cookie);

        // Give some time to the first client to establish the long poll before the second client
        Thread.sleep(1000);
View Full Code Here

                    connects1.offer(message);
            }
        });
        client1.handshake();
        assertTrue(client1.waitFor(5000, BayeuxClient.State.CONNECTED));
        HttpCookie cookie = client1.getCookie("BAYEUX_BROWSER");
        assertNotNull(cookie);

        // Give some time to the first client to establish the long poll before the second client
        Thread.sleep(1000);
View Full Code Here

TOP

Related Classes of java.net.HttpCookie$Setter

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.