Examples of Cookie


Examples of org.apache.cactus.Cookie

     * @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

Examples of org.apache.cocoon.environment.Cookie

        Element cookiesElement = doc.createElementNS(null, "cookies");
        root.appendChild(cookiesElement);

        Cookie[] cookies = this.request.getCookies();
        if (cookies != null) {
            Cookie current;
            Element node;
            Element parent;
            for(int i = 0; i < cookies.length; i++) {
                current = cookies[i];
                parent = doc.createElementNS(null, "cookie");
                parent.setAttributeNS(null, "name", current.getName());
                cookiesElement.appendChild(parent);
                node = doc.createElementNS(null, "comment");
                node.appendChild(this.createTextNode(doc, current.getComment()));
                parent.appendChild(node);
                node = doc.createElementNS(null, "domain");
                node.appendChild(this.createTextNode(doc, current.getDomain()));
                parent.appendChild(node);
                node = doc.createElementNS(null, "maxAge");
                node.appendChild(this.createTextNode(doc, ""+current.getMaxAge()));
                parent.appendChild(node);
                node = doc.createElementNS(null, "name");
                node.appendChild(this.createTextNode(doc, current.getName()));
                parent.appendChild(node);
                node = doc.createElementNS(null, "path");
                node.appendChild(this.createTextNode(doc, current.getPath()));
                parent.appendChild(node);
                node = doc.createElementNS(null, "secure");
                node.appendChild(doc.createTextNode(current.getSecure() ? "true" : "false"));
                parent.appendChild(node);
                node = doc.createElementNS(null, "value");
                node.appendChild(this.createTextNode(doc, current.getValue()));
                parent.appendChild(node);
                node = doc.createElementNS(null, "version");
                node.appendChild(this.createTextNode(doc, ""+current.getVersion()));
                parent.appendChild(node);
            }
        }
    }
View Full Code Here

Examples of org.apache.commons.httpclient.Cookie

    */
   public void testCustomHeaderBaseAuth() throws Exception
   {
      String serverHost = getServerHost();
      //Siteminder usecase
      performCustomAuth("sm_ssoid", new Cookie(serverHost,
                  "SMSESSION", "theduke", "/", null, false), "SiteMinder");
     
      //Cleartrust usecase
      performCustomAuth("ct-remote-user", new Cookie(serverHost,
            "CTSESSION", "theduke", "/", null, false), "Cleartrust");
     
      //Oblix usecase
      performCustomAuth("HTTP_OBLIX_UID", new Cookie(serverHost,
            "ObSSOCookie", "theduke", "/", null, false), "Oblix");
   }
View Full Code Here

Examples of org.apache.commons.httpclient.Cookie

      HttpState state = httpConn.getState();
      Cookie[] cookies = state.getCookies();
      String sessionID = null;
      for(int c = 0; c < cookies.length; c ++)
      {
         Cookie k = cookies[c];
         if( k.getName().equalsIgnoreCase("JSESSIONID") )
            sessionID = k.getValue();
      }
      getLog().debug("Saw JSESSIONID="+sessionID);

      // Submit the login form
      PostMethod formPost = new PostMethod(baseURLNoAuth+"header-form-auth/j_security_check");
View Full Code Here

Examples of org.apache.commons.httpclient.Cookie

   public void testGenericHeaderBaseAuth() throws Exception
   {
      String serverHost = super.getServerHost();
      // Siteminder usecase
      this
            .performHeaderAuth("sm_ssoid", new Cookie(serverHost, "SMSESSION", "theduke", "/", null, false),
                  "SiteMinder");
      // Cleartrust usecase
      this.performHeaderAuth("ct-remote-user", new Cookie(serverHost, "CTSESSION", "theduke", "/", null, false),
            "Cleartrust");
      // Oblix usecase
      this.performHeaderAuth("HTTP_OBLIX_UID", new Cookie(serverHost, "ObSSOCookie", "theduke", "/", null, false),
            "Oblix");
   }
View Full Code Here

Examples of org.apache.commons.httpclient.Cookie

      HttpState state = httpConn.getState();
      Cookie[] cookies = state.getCookies();
      String sessionID = null;
      for (int c = 0; c < cookies.length; c++)
      {
         Cookie k = cookies[c];
         if (k.getName().equalsIgnoreCase("JSESSIONID"))
            sessionID = k.getValue();
      }
      getLog().debug("Saw JSESSIONID=" + sessionID);
      // Submit the login form
      PostMethod formPost = new PostMethod(baseURLNoAuth + "sdtolerate/j_security_check");
      formPost.addRequestHeader("Referer", baseURLNoAuth + "sdtolerate/login.jsp");
View Full Code Here

Examples of org.apache.http.cookie.Cookie

        }
        CharArrayBuffer buffer = new CharArrayBuffer(20 * cookies.size());
        buffer.append(SM.COOKIE);
        buffer.append(": ");
        for (int i = 0; i < cookies.size(); i++) {
            Cookie cookie = cookies.get(i);
            if (i > 0) {
                buffer.append("; ");
            }
            buffer.append(cookie.getName());
            buffer.append("=");
            String s = cookie.getValue();
            if (s != null) {
                buffer.append(s);
            }
        }
        List<Header> headers = new ArrayList<Header>(1);
View Full Code Here

Examples of org.apache.jmeter.protocol.http.control.Cookie

        cm.clear();
        configureTestElement(cm);
        if (cm instanceof CookieManager) {
            CookieManager cookieManager = (CookieManager) cm;
            for (int i = 0; i < tableModel.getRowCount(); i++) {
                Cookie cookie = createCookie(tableModel.getRowData(i));
                cookieManager.add(cookie);
            }
            cookieManager.setClearEachIteration(clearEachIteration.isSelected());
            cookieManager.setCookiePolicy(policy.getText());
        }
View Full Code Here

Examples of org.apache.jmeter.samplers.Cookie

    if (command.equals("Edit")) {
                    index = cookieTable.getSelectedRow();
                    if (index < 0) {
                        valid = false;
                    } else {
                        Cookie c = manager.get(index);
                        nameField = new JTextField(c.getName(), 20);
                        valueField = new JTextField(c.getValue(), 20);
                        domainField = new JTextField(c.getDomain(), 20);
                        pathField = new JTextField(c.getPath(), 20);
                        secureCheck = new JCheckBox("Secure", c.getSecure());
                        expiresField = new JTextField(new Long(c.getExpires()).toString(), 20);
                        ok = new JButton("Ok");
                        cancel = new JButton("Cancel");
                    }
                } else if (command.equals("Add")) {
                    nameField = new JTextField(20);
                    valueField = new JTextField(20);
                    domainField = new JTextField(20);
                    pathField = new JTextField(20);
                    secureCheck = new JCheckBox("Secure");
                    expiresField = new JTextField(20);
                    ok = new JButton("Ok");
                    cancel = new JButton("Cancel");
                }
    if (valid) {
                    if (updateDialog != null) {
                        updateDialog.dispose();
                    }
                    updateDialog = new JDialog();
                    updateDialog.setSize(350, 300);

                    ok.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            int i = index;
                            Cookie c = new Cookie();
                            if (i >= 0) {
                                c = manager.get(index);
                            }
                            c.setName(nameField.getText());
                            c.setValue(valueField.getText());
                            c.setDomain(domainField.getText());
                            c.setPath(pathField.getText());
                            c.setSecure(secureCheck.isSelected());
                            try {
                                c.setExpires(Long.parseLong(expiresField.getText()));
                            } catch (NumberFormatException ex) {
                                c.setExpires(0);
                            }
                            if (i < 0) {
                                manager.add(c);
                            }
                            updateDialog.dispose();
View Full Code Here

Examples of org.apache.shiro.web.servlet.Cookie

    @Test
    public void testOnStartWithSessionIdCookieDisabled() {

        DefaultWebSessionManager mgr = new DefaultWebSessionManager();
        Cookie cookie = createMock(Cookie.class);
        mgr.setSessionIdCookie(cookie);
        mgr.setSessionIdCookieEnabled(false);

        //we should not have any reads from the cookie fields - if we do, this test case will fail.
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.