httpsampler.html
来自「测试工具jmeter可用来进行性能测试」· HTML 代码 · 共 508 行 · 第 1/5 页
HTML
508 行
Consider using HTTPSamplerFactory.newInstance() instead
<P>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="setPostHeaders(java.net.URLConnection)"><!-- --></A><H3>
setPostHeaders</H3>
<PRE>
protected void <B>setPostHeaders</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/net/URLConnection.html" title="class or interface in java.net">URLConnection</A> conn)
throws <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></PRE>
<DL>
<DD>Set request headers in preparation to opening a connection.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>conn</CODE> - <code>URLConnection</code> to set headers on
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></CODE> - if an I/O exception occurs</DL>
</DD>
</DL>
<HR>
<A NAME="sendPostData(java.net.URLConnection)"><!-- --></A><H3>
sendPostData</H3>
<PRE>
protected <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>sendPostData</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/net/URLConnection.html" title="class or interface in java.net">URLConnection</A> connection)
throws <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></PRE>
<DL>
<DD>Send POST data from <code>Entry</code> to the open connection.
This also handles sending data for PUT requests
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>connection</CODE> - <code>URLConnection</code> where POST data should be sent
<DT><B>Returns:</B><DD>a String show what was posted. Will not contain actual file upload content
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></CODE> - if an I/O exception occurs</DL>
</DD>
</DL>
<HR>
<A NAME="setupConnection(java.net.URL, java.lang.String, org.apache.jmeter.protocol.http.sampler.HTTPSampleResult)"><!-- --></A><H3>
setupConnection</H3>
<PRE>
protected <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/net/HttpURLConnection.html" title="class or interface in java.net">HttpURLConnection</A> <B>setupConnection</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/net/URL.html" title="class or interface in java.net">URL</A> u,
<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> method,
<A HREF="../../../../../../org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.html" title="class in org.apache.jmeter.protocol.http.sampler">HTTPSampleResult</A> res)
throws <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></PRE>
<DL>
<DD>Returns an <code>HttpURLConnection</code> fully ready to attempt
connection. This means it sets the request method (GET or POST), headers,
cookies, and authorization for the URL request.
<p>
The request infos are saved into the sample result if one is provided.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>u</CODE> - <code>URL</code> of the URL request<DD><CODE>method</CODE> - GET, POST etc<DD><CODE>res</CODE> - sample result to save request infos to
<DT><B>Returns:</B><DD><code>HttpURLConnection</code> ready for .connect
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></CODE> - if an I/O Exception occurs</DL>
</DD>
</DL>
<HR>
<A NAME="readResponse(java.net.HttpURLConnection, org.apache.jmeter.samplers.SampleResult)"><!-- --></A><H3>
readResponse</H3>
<PRE>
protected byte[] <B>readResponse</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/net/HttpURLConnection.html" title="class or interface in java.net">HttpURLConnection</A> conn,
<A HREF="../../../../../../org/apache/jmeter/samplers/SampleResult.html" title="class in org.apache.jmeter.samplers">SampleResult</A> res)
throws <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></PRE>
<DL>
<DD>Reads the response from the URL connection.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>conn</CODE> - URL from which to read response
<DT><B>Returns:</B><DD>response content
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></CODE> - if an I/O exception occurs</DL>
</DD>
</DL>
<HR>
<A NAME="getResponseHeaders(java.net.HttpURLConnection)"><!-- --></A><H3>
getResponseHeaders</H3>
<PRE>
protected <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getResponseHeaders</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/net/HttpURLConnection.html" title="class or interface in java.net">HttpURLConnection</A> conn)</PRE>
<DL>
<DD>Gets the ResponseHeaders from the URLConnection
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>conn</CODE> - connection from which the headers are read
<DT><B>Returns:</B><DD>string containing the headers, one per line</DL>
</DD>
</DL>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?