Author: sebb
Date: Sat Mar  1 19:41:10 2008
New Revision: 632707

URL: http://svn.apache.org/viewvc?rev=632707&view=rev
Log:
Revert to pre-2.3.1 behaviour - only check content-type for known binary types.
Originally just image/; now also audio/ and video/

Modified:
    jakarta/jmeter/trunk/bin/jmeter.properties
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: jakarta/jmeter/trunk/bin/jmeter.properties
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/bin/jmeter.properties?rev=632707&r1=632706&r2=632707&view=diff
==============================================================================
--- jakarta/jmeter/trunk/bin/jmeter.properties (original)
+++ jakarta/jmeter/trunk/bin/jmeter.properties Sat Mar  1 19:41:10 2008
@@ -606,19 +606,6 @@
 #Should JMeter expand the tree when loading a test plan?
 #onload.expandtree=false
 
-# List of additional content types to be treated as text; separate entries 
with commas.
-# If the content type begins with the same string, then it is treated as text.
-# See SampleResult.TEXT_TYPES
-# The following example types are already allowed for:
-#    text/
-#    application/javascript
-#    application/json
-#    application/soap+xml
-#    application/vnd.wap.xhtml+xml
-#    application/xhtml+xml
-#    application/xml
-#content-type_text=type1,type2,...
-
 # Maximum size of HTML page that can be displayed; default=200 * 1024
 # Set to 0 to disable the size check
 #view.results.tree.max_size=0

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java?rev=632707&r1=632706&r2=632707&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java 
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java 
Sat Mar  1 19:41:10 2008
@@ -570,49 +570,37 @@
                                    setDataEncoding(charSet);
                 }
             }
-            if (isTextType(ct)) {
-                setDataType(TEXT);
-            } else {
+            if (isBinaryType(ct)) {
                 setDataType(BINARY);
+            } else {
+                setDataType(TEXT);
             }
         }
     }
 
-    // List of types that can be processed as text
-    private static final String[] TEXT_TYPES = {
-       "text/",                  //$NON-NLS-1$
-       "application/javascript", //$NON-NLS-1$
-       "application/json",       //$NON-NLS-1$
-        "application/soap+xml",   //$NON-NLS-1$
-        "application/vnd.wap.xhtml+xml", //$NON-NLS-1$
-       "application/xhtml+xml",  //$NON-NLS-1$
-       "application/xml",        //$NON-NLS-1$
+    // List of types that are known to be binary
+    private static final String[] BINARY_TYPES = {
+        "image/",       //$NON-NLS-1$
+        "audio/",       //$NON-NLS-1$
+        "video/",       //$NON-NLS-1$
         };
  
-    // Additional types as needed
-    private static final String[] TEXT_TYPES_OPT =
-       JOrphanUtils.split(JMeterUtils.getPropDefault("content-type_text", ""), 
","); //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
- 
     /*
-     * Determine if content-type can be displayed as text or not.
+     * Determine if content-type is known to be binary, i.e. not displayable 
as text.
      * 
      * @param ct content type
-     * @return true if content-type is of type text.
+     * @return true if content-type is of type binary.
      */
-    private static boolean isTextType(String ct){
-       for (int i = 0; i < TEXT_TYPES.length; i++){
-               if (ct.startsWith(TEXT_TYPES[i])){
-                       return true;
-               }               
-       }
-       for (int i = 0; i < TEXT_TYPES_OPT.length; i++){
-               if (ct.startsWith(TEXT_TYPES_OPT[i])){
-                       return true;
-               }               
-       }
-       return false;
+    private static boolean isBinaryType(String ct){
+        for (int i = 0; i < BINARY_TYPES.length; i++){
+            if (ct.startsWith(BINARY_TYPES[i])){
+                return true;
+            }           
+        }
+        return false;
     }
-       /**
+
+    /**
         * Sets the successful attribute of the SampleResult object.
         * 
         * @param success

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=632707&r1=632706&r2=632707&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Sat Mar  1 19:41:10 2008
@@ -31,6 +31,19 @@
 
 <h4>Summary of main changes</h4>
 
+<p>
+Version 2.3.1 changed the way binary and text content types were determined:
+originally everything except "image/" content types were considered text, but 
2.3.1 introduced a check
+for specific content types. This has caused problems, as several popular types 
were omitted.
+Rather than try to list all the possible text types, JMeter now just checks 
for the following binary types:
+<ul>
+<li>image/*</li>
+<li>audio/*</li>
+<li>video/*</li>
+</ul>
+All other types are now assumed to be text.
+</p>
+
 <p>Fixes Clear Cookie each iteration bug (unfortunately introduced in 
2.3.1)</p>
 
 <p>Switch Controller now works properly with functions and variables, 
@@ -695,6 +708,11 @@
 This may cause some problems; if so define the following in jmeter.properties:
 <br/>
 jmeterengine.startlistenerslater=false
+</p>
+
+<p>
+The GUI now expands the tree by default when loading a test plan.
+This can be disabled by setting the JMeter property 
<b>onload.expandtree=false</b>
 </p>
 
 <h4>Known problems:</h4>



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

Reply via email to