Author: sebb
Date: Tue Mar 18 15:16:12 2008
New Revision: 638608

URL: http://svn.apache.org/viewvc?rev=638608&view=rev
Log:
As a special case, if the HTTP Sampler path starts with "http://"; or "https://"; 
then this is used as the full URL.

Modified:
    
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jakarta/jmeter/trunk/xdocs/changes.xml
    jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=638608&r1=638607&r2=638608&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
 (original)
+++ 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
 Tue Mar 18 15:16:12 2008
@@ -302,6 +302,11 @@
                setProperty(PROTOCOL, value.toLowerCase());
        }
 
+       /**
+        * Gets the protocol, with default.
+        * 
+        * @return the protocol
+        */
        public String getProtocol() {
                String protocol = getPropertyAsString(PROTOCOL);
                if (protocol == null || protocol.length() == 0 ) {
@@ -688,15 +693,28 @@
                return res;
        }
 
+       private static final String HTTP_PREFIX = PROTOCOL_HTTP+"://"; // 
$NON-NLS-1$
+    private static final String HTTPS_PREFIX = PROTOCOL_HTTPS+"://"; // 
$NON-NLS-1$
+    
        /**
         * Get the URL, built from its component parts.
         * 
+        * <p>
+        * As a special case, if the path starts with "http[s]://",
+        * then the path is assumed to be the entire URL.
+        * </p>
+        * 
         * @return The URL to be requested by this sampler.
         * @throws MalformedURLException
         */
        public URL getUrl() throws MalformedURLException {
                StringBuffer pathAndQuery = new StringBuffer(100);
                String path = this.getPath();
+               // Hack to allow entire URL to be provided in host field
+        if (path.startsWith(HTTP_PREFIX) 
+         || path.startsWith(HTTPS_PREFIX)){
+            return new URL(path);
+        }
         if (!path.startsWith("/")){ // $NON-NLS-1$
             pathAndQuery.append("/"); // $NON-NLS-1$
         }
@@ -709,7 +727,7 @@
             // encoded in UTF-8, which is what the HTTP spec says
             String queryString = getQueryString(getContentEncoding());
             if(queryString.length() > 0) {
-                if (path.indexOf(QRY_PFX) > -1) {
+                if (path.indexOf(QRY_PFX) > -1) {// Already contains a prefix
                     pathAndQuery.append(QRY_SEP);
                 } else {
                     pathAndQuery.append(QRY_PFX);

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=638608&r1=638607&r2=638608&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Tue Mar 18 15:16:12 2008
@@ -117,6 +117,9 @@
 <li>Add means to override maximum display size in View Results Tree - set the 
property: view.results.tree.max_size</li>
 <li>Use Tidy to display XML in View Results Tree Listener (avoids fetching 
DTDs)</li>
 <li>Bug 44487 - German translation</li>
+<li>
+As a special case, if the HTTP Sampler path starts with "http://"; or 
"https://"; then this is used as the full URL.
+</li>
 </ul>
 
 <h4>Non-functional changes</h4>

Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=638608&r1=638607&r2=638608&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Tue Mar 18 
15:16:12 2008
@@ -184,7 +184,12 @@
         </property>
         <property name="Path" required="Yes">The path to resource (for 
example, /servlets/myServlet). If the
 resource requires query string parameters, add them below in the
-"Send Parameters With the Request" section.</property>
+"Send Parameters With the Request" section.
+<b>
+As a special case, if the path starts with "http://"; or "https://"; then this 
is used as the full URL.
+</b>
+In this case, the server, port and protocol are ignored; parameters are also 
ignored for GET and DELETE methods.
+</property>
         <property name="Send Parameters With the Request" required="No">The 
query string will
         be generated from the list of parameters you provide.  Each parameter 
has a <i>name</i> and
         <i>value</i>, the options to encode the parameter, and an option to 
include or exclude an equals sign (some applications
@@ -195,7 +200,7 @@
         multipart form specifications.
         <b>See below for some further information on parameter handling.</b>
         <p>
-        Additionally, you can specify whether each paramter should be URL 
encoded.  If you are not sure what this
+        Additionally, you can specify whether each parameter should be URL 
encoded.  If you are not sure what this
         means, it is probably best to select it.  If your values contain 
characters such as &amp;amp; or spaces, or
         question marks, then encoding is usually required.</p></property>
         <property name="Filename" required="No">Name of the file to send.  If 
left blank, JMeter
@@ -237,21 +242,21 @@
 as a test plan created using a recorder would continue from the redirected URL.
 </p>
 <p>
-Parameter Handling:<br></br>
+<b>Parameter Handling:</b><br></br>
 For the POST and PUT method, if there is no file to send, and the name(s) of 
the parameter(s) are omitted,
 then the body is created by concatenating all the value(s) of the parameters.
 This allows arbitrary bodies to be sent.
 The values are encoded if the encoding flag is set (versions of JMeter after 
2.3).
-See also the MIME Type above how you can control the content-type request 
header that are sent.
+See also the MIME Type above how you can control the content-type request 
header that is sent.
 <br></br>
 For other methods, if the name of the parameter is missing,
 then the parameter is ignored. This allows the use of optional parameters 
defined by variables.
 (versions of JMeter after 2.3)
 </p>
 <p>
-Method Handling:<br></br>
-The POST and PUT request methods work similar, except that the PUT method does 
not support multipart requests.
-The GET and DELETE request methods work similar.
+<b>Method Handling:</b><br></br>
+The POST and PUT request methods work similarly, except that the PUT method 
does not support multipart requests.
+The GET and DELETE request methods work similarly.
 </p>
 <p>Upto and including JMeter 2.1.1, only responses with the content-type 
"text/html" were scanned for
 embedded resources. Other content-types were assumed to be something other 
than HTML.



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

Reply via email to