On Wed, 6 Jun 2001, Peter Molettiere wrote:

>
>
> I've just been writing a new controller for a project
> I'm working on, and found a need for a few enhancements
> to org.apache.jmeter.protocol.http.config.UrlConfig.
>
> 1) UrlConfig didn't support any port other than 80.
> Often, people run webservers on non-standard ports,
> such as 8080.

Which version have you looked at? We regularly test webservers running
at different ports.

> 2) UrlConfig didn't support passing query strings to
> GET urls, even if there was an Arguments object in the
> UrlConfig's properties.

??

> 3) UrlConfig didn't support any protocol other than
> http. (I'm thinking specifically about https, since
> it looks like ftp, etc is handled by a separate package.

https is well supported in the 1.6 dev version (dunno about 1.5)

Giacomo

> Here's a patch that provides both 1) and 2), and
> allows you to set arbitrary protocols on the UrlConfig,
> even though setting non-http protocols (anything other
> than http or https) will result in an Exception in
> HTTPSampler. Further, https needs to be properly
> configured in the jvm to work correctly.
>
> I've set it up so that if the port, protocol, or query
> string isn't set, then the previous defaults are used.
>
> In the case of port, I changed the default value to -1,
> since this is a flag to the java.net.URL constructor
> which tells it to use the default port for the specified
> protocol.
>
>
> Peter
> --
> Peter Molettiere
> senior engineer
> sfinteractive.com
>
>
> ==========================================================
>
>
> *** UrlConfig.java    Sat Mar 17 14:25:49 2001
> --- UrlConfig.java    Wed Jun  6 18:06:28 2001
> ***************
> *** 70,78 ****
> --- 70,81 ----
>
>   public class UrlConfig extends AbstractConfigElement
>   {
> +     public final static String PROTOCOL = "protocol";
>       public final static String DOMAIN = "domain";
>       public final static String PATH = "path";
>       public final static String METHOD = "method";
> +     public final static String PORT = "port";
> +     public final static String QUERYSTRING = "querystring";
>       public final static String ARGUMENTS = "arguments";
>       public final static String POST = "POST";
>       public final static String GET = "GET";
> ***************
> *** 101,107 ****
>               {
>                       setPath("/"+getPath());
>               }
> !             return new URL("http", (String)properties.get(DOMAIN), 80,
> (String)properties.get(PATH));
>       }
>
>       public String getPath()
> --- 104,110 ----
>               {
>                       setPath("/"+getPath());
>               }
> !             return new URL(getProtocol(), (String)properties.get(DOMAIN),
> getPort(), getPath() + getQueryString() );
>       }
>
>       public String getPath()
> ***************
> *** 127,132 ****
> --- 130,171 ----
>       public String getMethod()
>       {
>               return (String)properties.get(METHOD);
> +     }
> +
> +     public void setPort( Integer p ) {
> +         properties.put(PORT,p);
> +     }
> +
> +     public int getPort() {
> +         Integer p = (Integer) properties.get(PORT);
> +         if( p == null ) {
> +             return -1;
> +         }
> +         return p.intValue();
> +     }
> +
> +     public void setQueryString(String qs) {
> +         properties.put(QUERYSTRING, qs);
> +     }
> +
> +     public String getQueryString() {
> +         String qs = (String) properties.get(QUERYSTRING);
> +         if( qs == null || qs.equals("") ) {
> +             return "";
> +         }
> +         return "?" + qs;
> +     }
> +
> +     public void setProtocol(String p) {
> +         properties.put(PROTOCOL, p);
> +     }
> +
> +     public String getProtocol() {
> +         String p = (String) properties.get(PROTOCOL);
> +         if( p == null || p == "" ) {
> +             return "http";
> +         }
> +         return p;
>       }
>
>       /************************************************************
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>


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

Reply via email to