⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httpmethod.java

📁 Light in the box 抓取程序。 使用HttpClient
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     */    Header[] getRequestHeaders();    /**     * Returns the request headers with the given name. Note that header-name matching is     * case insensitive.     * @param headerName the name of the headers to be returned.     * @return an array of zero or more headers     *      * @since 3.0     */    Header[] getRequestHeaders(String headerName);    // ---------------------------------------------------------------- Queries    /**     * Returns <tt>true</tt> the method is ready to execute, <tt>false</tt> otherwise.     *      * @return <tt>true</tt> if the method is ready to execute, <tt>false</tt> otherwise.     */    boolean validate();    /**     * Returns the status code associated with the latest response.     *      * @return The status code from the most recent execution of this method.     *         If the method has not yet been executed, the result is undefined.     */    int getStatusCode();    /**     * Returns the status text (or "reason phrase") associated with the latest     * response.     *      * @return The status text from the most recent execution of this method.     *         If the method has not yet been executed, the result is undefined.     */    String getStatusText();    /**     * Returns the response headers from the most recent execution of this request.     *      * @return A newly-created array containing all of the response headers,      *         in the order in which they appeared in the response.     */    Header[] getResponseHeaders();    /**     * Returns the specified response header. Note that header-name matching is     * case insensitive.     *      * @param headerName The name of the header to be returned.     *      * @return The specified response header.  If the repsonse contained multiple     *         instances of the header, its values will be combined using the ','     *         separator as specified by RFC2616.     */    Header getResponseHeader(String headerName);    /**     * Returns the response headers with the given name. Note that header-name matching is     * case insensitive.     * @param headerName the name of the headers to be returned.     * @return an array of zero or more headers     *      * @since 3.0     */    Header[] getResponseHeaders(String headerName);    /**     * Returns the response footers from the most recent execution of this request.     *      * @return an array containing the response footers in the order that they     *         appeared in the response.  If the response had no footers,     *         an empty array will be returned.     */    Header[] getResponseFooters();    /**     * Return the specified response footer. Note that footer-name matching is     * case insensitive.     *      * @param footerName The name of the footer.     * @return The response footer.     */    Header getResponseFooter(String footerName);    /**     * Returns the response body of the HTTP method, if any, as an array of bytes.     * If the method has not yet been executed or the response has no body, <code>null</code>     * is returned.  Note that this method does not propagate I/O exceptions.     * If an error occurs while reading the body, <code>null</code> will be returned.     *      * @return The response body, or <code>null</code> if the     *         body is not available.     *      * @throws IOException if an I/O (transport) problem occurs     */    byte[] getResponseBody() throws IOException;    /**     * Returns the response body of the HTTP method, if any, as a {@link String}.      * If response body is not available or cannot be read, <tt>null</tt> is returned.     * The raw bytes in the body are converted to a <code>String</code> using the     * character encoding specified in the response's <tt>Content-Type</tt> header, or     * ISO-8859-1 if the response did not specify a character set.     * <p>     * Note that this method does not propagate I/O exceptions.     * If an error occurs while reading the body, <code>null</code> will be returned.     *     * @return The response body converted to a <code>String</code>, or <code>null</code>     *         if the body is not available.     *      * @throws IOException if an I/O (transport) problem occurs     */    String getResponseBodyAsString() throws IOException;    /**     * Returns the response body of the HTTP method, if any, as an InputStream.     * If the response had no body or the method has not yet been executed,     * <code>null</code> is returned.  Additionally, <code>null</code> may be returned     * if {@link #releaseConnection} has been called or     * if this method was called previously and the resulting stream was closed.      *      * @return The response body, or <code>null</code> if it is not available      *      * @throws IOException if an I/O (transport) problem occurs     */    InputStream getResponseBodyAsStream() throws IOException;    /**     * Returns <tt>true</tt> if the HTTP method has been already {@link #execute executed},     * but not {@link #recycle recycled}.     *      * @return <tt>true</tt> if the method has been executed, <tt>false</tt> otherwise     */    boolean hasBeenUsed();    // --------------------------------------------------------- Action Methods    /**     * Executes this method using the specified <code>HttpConnection</code> and     * <code>HttpState</code>.      *     * @param state the {@link HttpState state} information to associate with this method     * @param connection the {@link HttpConnection connection} used to execute     *        this HTTP method     *     * @throws IOException If an I/O (transport) error occurs. Some transport exceptions     *                     can be recovered from.     * @throws HttpException  If a protocol exception occurs. Usually protocol exceptions      *                    cannot be recovered from.     *     * @return the integer status code if one was obtained, or <tt>-1</tt>     */    int execute(HttpState state, HttpConnection connection)         throws HttpException, IOException;    /**     * Aborts the execution of the HTTP method.     *      * @see #execute(HttpState, HttpConnection)     *      * @since 3.0     */    void abort();    /**     * Recycles the HTTP method so that it can be used again.     * Note that all of the instance variables will be reset     * once this method has been called. This method will also     * release the connection being used by this HTTP method.     *      * @see #releaseConnection()     *      * @deprecated no longer supported and will be removed in the future     *             version of HttpClient     */    void recycle();    /**     * Releases the connection being used by this HTTP method. In particular the     * connection is used to read the response (if there is one) and will be held     * until the response has been read. If the connection can be reused by other      * HTTP methods it is NOT closed at this point.     * <p>     * After this method is called, {@link #getResponseBodyAsStream} will return     * <code>null</code>, and {@link #getResponseBody} and {@link #getResponseBodyAsString}     * <em>may</em> return <code>null</code>.      */    void releaseConnection();    /**     * Add a footer to this method's response.     * <p>     * <b>Note:</b> This method is for     * internal use only and should not be called by external clients.     *      * @param footer the footer to add     *      * @since 2.0     */    void addResponseFooter(Header footer);    /**      * Returns the Status-Line from the most recent response for this method,     * or <code>null</code> if the method has not been executed.     *      * @return the status line, or <code>null</code> if the method has not been executed     *      * @since 2.0     */    StatusLine getStatusLine();    /**     * Returns <tt>true</tt> if the HTTP method should automatically handle HTTP      * authentication challenges (status code 401, etc.), <tt>false</tt> otherwise     *     * @return <tt>true</tt> if authentication challenges will be processed      * automatically, <tt>false</tt> otherwise.     *      * @since 2.0     *      * @see #setDoAuthentication(boolean)     */    boolean getDoAuthentication();    /**     * Sets whether or not the HTTP method should automatically handle HTTP      * authentication challenges (status code 401, etc.)     *     * @param doAuthentication <tt>true</tt> to process authentication challenges     * automatically, <tt>false</tt> otherwise.     *      * @since 2.0     *      * @see #getDoAuthentication()     */    void setDoAuthentication(boolean doAuthentication);    /**     * Returns {@link HttpMethodParams HTTP protocol parameters} associated with this method.     *      * @since 3.0     *      * @see HttpMethodParams     */    public HttpMethodParams getParams();    /**     * Assigns {@link HttpMethodParams HTTP protocol parameters} for this method.     *      * @since 3.0     *      * @see HttpMethodParams     */    public void setParams(final HttpMethodParams params);    /**     * Returns the target host {@link AuthState authentication state}     *      * @return host authentication state     *      * @since 3.0     */    public AuthState getHostAuthState();    /**     * Returns the proxy {@link AuthState authentication state}     *      * @return host authentication state     *      * @since 3.0     */    public AuthState getProxyAuthState();    /**     * Returns <tt>true</tt> if the HTTP has been transmitted to the target     * server in its entirety, <tt>false</tt> otherwise. This flag can be useful      * for recovery logic. If the request has not been transmitted in its entirety,     * it is safe to retry the failed method.     *      * @return <tt>true</tt> if the request has been sent, <tt>false</tt> otherwise     */    boolean isRequestSent();}

⌨️ 快捷键说明

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