httpsampler2.html

来自「测试工具jmeter可用来进行性能测试」· HTML 代码 · 共 531 行 · 第 1/5 页

HTML
531
字号

<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="setupConnection(java.net.URL, org.apache.commons.httpclient.HttpMethodBase, org.apache.jmeter.protocol.http.sampler.HTTPSampleResult)"><!-- --></A><H3>
setupConnection</H3>
<PRE>
protected org.apache.commons.httpclient.HttpClient <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>&nbsp;u,
                                                                   org.apache.commons.httpclient.HttpMethodBase&nbsp;httpMethod,
                                                                   <A HREF="../../../../../../org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.html" title="class in org.apache.jmeter.protocol.http.sampler">HTTPSampleResult</A>&nbsp;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>HttpConnection</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>httpMethod</CODE> - GET/PUT/HEAD etc<DD><CODE>res</CODE> - sample result to save request infos to
<DT><B>Returns:</B><DD><code>HttpConnection</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="setDefaultRequestHeaders(org.apache.commons.httpclient.HttpMethod)"><!-- --></A><H3>
setDefaultRequestHeaders</H3>
<PRE>
protected void <B>setDefaultRequestHeaders</B>(org.apache.commons.httpclient.HttpMethod&nbsp;httpMethod)</PRE>
<DL>
<DD>Set any default request headers to include
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>httpMethod</CODE> - the HttpMethod used for the request</DL>
</DD>
</DL>
<HR>

<A NAME="getResponseHeaders(org.apache.commons.httpclient.HttpMethod)"><!-- --></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>(org.apache.commons.httpclient.HttpMethod&nbsp;method)</PRE>
<DL>
<DD>Gets the ResponseHeaders
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>method</CODE> - connection from which the headers are read
<DT><B>Returns:</B><DD>string containing the headers, one per line</DL>
</DD>
</DL>
<HR>

<A NAME="getConnectionHeaders(org.apache.commons.httpclient.HttpMethod)"><!-- --></A><H3>
getConnectionHeaders</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>getConnectionHeaders</B>(org.apache.commons.httpclient.HttpMethod&nbsp;method)</PRE>
<DL>
<DD>Get all the request headers for the <code>HttpMethod</code>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>method</CODE> - <code>HttpMethod</code> which represents the request
<DT><B>Returns:</B><DD>the headers as a string</DL>
</DD>
</DL>
<HR>

<A NAME="sample(java.net.URL, java.lang.String, boolean, int)"><!-- --></A><H3>
sample</H3>
<PRE>
protected <A HREF="../../../../../../org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.html" title="class in org.apache.jmeter.protocol.http.sampler">HTTPSampleResult</A> <B>sample</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>&nbsp;url,
                                  <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>&nbsp;method,
                                  boolean&nbsp;areFollowingRedirect,
                                  int&nbsp;frameDepth)</PRE>
<DL>
<DD>Samples the URL passed in and stores the result in
 <code>HTTPSampleResult</code>, following redirects and downloading
 page resources as appropriate.
 <p>
 When getting a redirect target, redirects are not followed and resources
 are not downloaded. The caller will take care of this.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.html#sample(java.net.URL, java.lang.String, boolean, int)">sample</A></CODE> in class <CODE><A HREF="../../../../../../org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.html" title="class in org.apache.jmeter.protocol.http.sampler">HTTPSamplerBase</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>url</CODE> - URL to sample<DD><CODE>method</CODE> - HTTP method: GET, POST,...<DD><CODE>areFollowingRedirect</CODE> - whether we're getting a redirect target<DD><CODE>frameDepth</CODE> - Depth of this target in the frame structure. Used only to
            prevent infinite recursion.
<DT><B>Returns:</B><DD>results of the sampling</DL>
</DD>
</DL>
<HR>

<A NAME="saveConnectionCookies(org.apache.commons.httpclient.HttpMethod, java.net.URL, org.apache.jmeter.protocol.http.control.CookieManager)"><!-- --></A><H3>
saveConnectionCookies</H3>
<PRE>
protected void <B>saveConnectionCookies</B>(org.apache.commons.httpclient.HttpMethod&nbsp;method,
                                     <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>&nbsp;u,
                                     <A HREF="../../../../../../org/apache/jmeter/protocol/http/control/CookieManager.html" title="class in org.apache.jmeter.protocol.http.control">CookieManager</A>&nbsp;cookieManager)</PRE>
<DL>
<DD>From the <code>HttpMethod</code>, store all the "set-cookie" key-pair

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?