mstover1    01/04/11 10:23:46

  Modified:    src/org/apache/jmeter/protocol/http/config UrlConfig.java
               src/org/apache/jmeter/protocol/http/config/gui
                        UrlConfigGui.java
  Log:
  Added https support to UrlConfig
  
  Revision  Changes    Path
  1.9       +28 -5     
jakarta-jmeter/src/org/apache/jmeter/protocol/http/config/UrlConfig.java
  
  Index: UrlConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/protocol/http/config/UrlConfig.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- UrlConfig.java    2001/04/11 12:45:07     1.8
  +++ UrlConfig.java    2001/04/11 17:23:45     1.9
  @@ -64,8 +64,8 @@
    *  Apache Foundation
    *
    *@author     Michael Stover
  - *@created    $Date: 2001/04/11 12:45:07 $
  - *@version    $Revision: 1.8 $
  + *@created    $Date: 2001/04/11 17:23:45 $
  + *@version    $Revision: 1.9 $
    ***********************************************************/
   
   public class UrlConfig extends AbstractConfigElement
  @@ -76,6 +76,7 @@
        public final static String METHOD = "method";
        public final static String ARGUMENTS = "arguments";
        public final static String POST = "POST";
  +     public final static String PROTOCOL = "PROTOCOL";
        public final static String GET = "GET";
   
        /************************************************************
  @@ -102,7 +103,14 @@
                {
                        setPath("/"+getPath());
                }
  -             return new URL("http", (String)properties.get(DOMAIN), getPort(), 
(String)properties.get(PATH));
  +             if(getPort() == 0)
  +             {
  +                     return new URL(getProtocol(),getDomain(),getPath());
  +             }
  +             else
  +             {
  +                     return new URL(getProtocol(), (String)properties.get(DOMAIN), 
getPort(), (String)properties.get(PATH));
  +             }
        }
   
         public int getPort() {
  @@ -110,7 +118,7 @@
                        if(port == null)
                        {
                                properties.remove(PORT);
  -                             return 80;
  +                             return 0;
                        }
                        else if(port instanceof Integer)
                        {
  @@ -122,11 +130,26 @@
                                properties.put(PORT,intPort);
                                return intPort.intValue();
                        }
  -                     return 80;
  +                     return 0;
  +      }
  +
  +      public String getProtocol()
  +      {
  +             String protocol = (String)getProperty(PROTOCOL);
  +             return protocol;
  +      }
  +
  +      public void setProtocol(String protocol)
  +      {
  +             properties.put(PROTOCOL,protocol);
         }
   
         public void setPort(int port) {
        properties.put(PORT, new Integer(port));
  +     if(port == 0)
  +     {
  +             properties.remove(PORT);
  +     }
         }
   
        public String getPath()
  
  
  
  1.6       +55 -1     
jakarta-jmeter/src/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java
  
  Index: UrlConfigGui.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- UrlConfigGui.java 2001/04/11 12:45:09     1.5
  +++ UrlConfigGui.java 2001/04/11 17:23:46     1.6
  @@ -79,12 +79,16 @@
        private static String PATH = "path";
        private static String POST = "post";
        private static String GET = "get";
  +     private static String HTTP = "http";
  +     private static String HTTPS = "https";
   
        private JTextField domain = new JTextField(30);
         private JTextField port = new JTextField(30);
        private JTextField path = new JTextField(30);
        private JRadioButton post = new JRadioButton("POST");
        private JRadioButton get = new JRadioButton("GET");
  +     private JRadioButton http = new JRadioButton("HTTP");
  +     private JRadioButton https = new JRadioButton("HTTPS");
        private NamePanel namePanel;
        private boolean displayName = true;
   
  @@ -116,6 +120,14 @@
                {
                        get.setSelected(true);
                }
  +             if(http.getText().equalsIgnoreCase(model.getProtocol()))
  +             {
  +                     http.setSelected(true);
  +             }
  +             else if(https.getText().equalsIgnoreCase(model.getProtocol()))
  +             {
  +                     https.setSelected(true);
  +             }
        }
   
        public void setModel(Object model)
  @@ -133,7 +145,7 @@
                        namePanel.setModel(model);
                        this.add(namePanel);
                }
  -
  +             this.add(getProtocolPanel());
                this.add(getDomainPanel());
                this.add(getPortPanel());
                this.add(getPathPanel());
  @@ -175,6 +187,39 @@
                return panel;
        }
   
  +     private JPanel getProtocolPanel()
  +     {
  +             JPanel panel = new JPanel();
  +             panel.add(new JLabel("Protocol: "));
  +             ButtonGroup group = new ButtonGroup();
  +             group.add(http);
  +             group.add(https);
  +             if(http.getText().equalsIgnoreCase(model.getProtocol()))
  +             {
  +                     http.setSelected(true);
  +             }
  +             else if(https.getText().equalsIgnoreCase(model.getProtocol()))
  +             {
  +                     https.setSelected(true);
  +             }
  +             http.setActionCommand(HTTP);
  +             https.setActionCommand(HTTPS);
  +             http.addActionListener(this);
  +             https.addActionListener(this);
  +             JPanel buttons = new JPanel(new 
VerticalLayout(0,VerticalLayout.LEFT));
  +             JPanel postButton = new JPanel();
  +             postButton.add(http);
  +
  +             JPanel getButton = new JPanel();
  +             getButton.add(https);
  +
  +             buttons.add(getButton);
  +             buttons.add(postButton);
  +
  +             panel.add(buttons);
  +             return panel;
  +     }
  +
        private JPanel getMethodPanel()
        {
                JPanel panel = new JPanel();
  @@ -248,6 +293,7 @@
                        }
                        catch (Exception ex)
                        {
  +                             model.setPort(0);
                        }
                }
        }
  @@ -262,6 +308,14 @@
                else if(name.equals(GET))
                {
                        model.putProperty(UrlConfig.METHOD,UrlConfig.GET);
  +             }
  +             else if(name.equals(HTTP))
  +             {
  +                     model.putProperty(UrlConfig.PROTOCOL,"http");
  +             }
  +             else if(name.equals(HTTPS))
  +             {
  +                     model.putProperty(UrlConfig.PROTOCOL,"https");
                }
        }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to