Package org.apache.commons.httpclient

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


      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

   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

      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

      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+"web-role-map/j_security_check");
View Full Code Here

      for (Cookie cookie: this.client.getState().getCookies())
      {
         System.out.println(cookie.getDomain() + "\t" + cookie.getName() + "\t" + cookie.getPath() + "\t" + cookie.getValue());
      }
     
      Cookie cookie = this.findCookie(0, COOKIE_NAME);
      Assert.assertNotNull(cookie);
      Assert.assertEquals("0", cookie.getValue());
     
      // Subsequent request should return 404
      Assert.assertEquals(404, new RequestTask(0, 0).call().intValue());
     
      System.out.println("After request to shutdown server");
      for (Cookie c: this.client.getState().getCookies())
      {
         System.out.println(c.getDomain() + "\t" + c.getName() + "\t" + c.getPath() + "\t" + c.getValue());
      }
     
      String server0 = this.getServers()[0];
      String server1 = this.getServers()[1];
     
      // Copy cookies from server[0] to server[1]
      for (Cookie c: this.client.getState().getCookies())
      {
         String domain = c.getDomain();
         if (InetAddress.getByName(domain).equals(InetAddress.getByName(server0)) && c.getName().equals("JSESSIONID"))
         {
            // TODO Replace this with JBossTestUtil.fixHostnameForURL(), when ready
            boolean wrap = domain.startsWith("[") && !server1.startsWith("[");
            StringBuilder builder = new StringBuilder();
            if (wrap)
            {
               builder.append('[');
            }
            builder.append(server1);
            if (wrap)
            {
               builder.append(']');
            }
            this.client.getState().addCookie(new Cookie(builder.toString(), c.getName(), c.getValue(), c.getPath(), c.getExpiryDate(), c.getSecure()));
         }
      }

      System.out.println("After cookie copy to failover server");
      for (Cookie c: this.client.getState().getCookies())
      {
         System.out.println(c.getDomain() + "\t" + c.getName() + "\t" + c.getPath() + "\t" + c.getValue());
      }
     
      Assert.assertEquals(200, new RequestTask(1, 0).call().intValue());

      System.out.println("After request on new server");
      for (Cookie c: this.client.getState().getCookies())
      {
         System.out.println(c.getDomain() + "\t" + c.getName() + "\t" + c.getPath() + "\t" + c.getValue());
      }
     
      // If old session had replicated successfully, cookie value should equal old sleep duration
      cookie = this.findCookie(1, COOKIE_NAME);
      Assert.assertNotNull(cookie);
      Assert.assertEquals(String.valueOf(REQUEST_DURATION), cookie.getValue());
   }
View Full Code Here

      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+"form-auth/j_security_check");
View Full Code Here

      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+"form-auth/j_security_check");
View Full Code Here

      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+"form-auth/j_security_check");
      formPost.addRequestHeader("Referer", baseURLNoAuth+"form-auth/unsecure_form.html");
View Full Code Here

      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+"form-auth/j_security_check");
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.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.