You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2006/06/05 00:09:27 UTC

svn commit: r411607 - /jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/samplers/SampleResult.java

Author: sebb
Date: Sun Jun  4 15:09:27 2006
New Revision: 411607

URL: http://svn.apache.org/viewvc?rev=411607&view=rev
Log:
Add getMediaType() method

Modified:
    jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/samplers/SampleResult.java

Modified: jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/samplers/SampleResult.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/samplers/SampleResult.java?rev=411607&r1=411606&r2=411607&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/samplers/SampleResult.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/samplers/SampleResult.java Sun Jun  4 15:09:27 2006
@@ -30,6 +30,7 @@
 import org.apache.jmeter.assertions.AssertionResult;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.logging.LoggingManager;
+import org.apache.jorphan.util.JOrphanUtils;
 import org.apache.log.Logger;
 
 /**
@@ -630,11 +631,19 @@
 	}
 
 	/**
-	 * @return the content type - e.g. text/html [;charset=utf-8 ]
+	 * @return the full content type - e.g. text/html [;charset=utf-8 ]
 	 */
 	public String getContentType() {
 		return contentType;
 	}
+
+    /**
+     * Get the media type from the Content Type
+     * @return the media type - e.g. text/html (without charset, if any)
+     */
+    public String getMediaType() {
+        return JOrphanUtils.trim(contentType," ;").toLowerCase();
+    }
 
 	/**
 	 * @param string



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org