[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/transport/web ...

Ron Sigal ron_sigal at yahoo.com
Thu Nov 22 04:33:59 EST 2007


  User: rsigal  
  Date: 07/11/22 04:33:59

  Modified:    src/tests/org/jboss/test/remoting/transport/web  Tag:
                        remoting_2_x WebInvokerTestClient.java
  Log:
  JBREM-838: Updated checkContentType() so it works with sslservlet transport.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.13.4.7  +31 -7     JBossRemoting/src/tests/org/jboss/test/remoting/transport/web/WebInvokerTestClient.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WebInvokerTestClient.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/transport/web/WebInvokerTestClient.java,v
  retrieving revision 1.13.4.6
  retrieving revision 1.13.4.7
  diff -u -b -r1.13.4.6 -r1.13.4.7
  --- WebInvokerTestClient.java	7 Nov 2007 07:57:06 -0000	1.13.4.6
  +++ WebInvokerTestClient.java	22 Nov 2007 09:33:59 -0000	1.13.4.7
  @@ -29,6 +29,8 @@
   import java.util.Map;
   import java.util.Properties;
   
  +import javax.net.ssl.HttpsURLConnection;
  +
   import junit.framework.TestCase;
   
   import org.apache.log4j.Logger;
  @@ -232,16 +234,38 @@
         {
            urlString = "http" + urlString.substring("servlet".length());
         }
  +      pos = urlString.indexOf("sslservlet");
  +      if (pos == 0)
  +      {
  +         urlString = "https" + urlString.substring("sslservlet".length());
  +      }
  +      
         URL url = new URL(urlString);
  +      OutputStream os = null;
  +      String contentType = null;
  +      
  +      if (urlString.startsWith("https"))
  +      {
  +         HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
  +         conn.setDoOutput(true);
  +         conn.setDoInput(true);
  +         os = conn.getOutputStream();
  +         byte[] requestBytes = WebInvocationHandler.SET_CONTENT_TYPE.getBytes();
  +         os.write(requestBytes);
  +         contentType = conn.getContentType();
  +      }
  +      else
  +      {
         HttpURLConnection conn = (HttpURLConnection) url.openConnection();
         conn.setDoOutput(true);
         conn.setDoInput(true);
  +         os = conn.getOutputStream();
         byte[] requestBytes = WebInvocationHandler.SET_CONTENT_TYPE.getBytes();
  -      OutputStream os = conn.getOutputStream();
         os.write(requestBytes);
  +         contentType = conn.getContentType();
  +      }
         
         // Verify that content-type is the value set in the ServerInvocationHandler.
  -      String contentType = conn.getContentType();
         log.debug("content-type: " + contentType);
         assertEquals(WebInvocationHandler.CONTENT_TYPE, contentType);
      }
  
  
  



More information about the jboss-cvs-commits mailing list