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

📄 httpurlconnection.java

📁 Light in the box 抓取程序。 使用HttpClient
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    }    /**     * Return the header field at the specified position     * @param position The position     * @return The header field.     * @see java.net.HttpURLConnection#getHeaderField(int)     * @see org.apache.commons.httpclient.HttpMethod#getResponseHeaders()     */    public String getHeaderField(int position) {        LOG.trace("enter HttpURLConnection.getHeaderField(int)");        // Note: HttpClient does not consider the returned Status Line as        // a response header. However, getHeaderField(0) is supposed to         // return the status line. Hence the special case below ...                if (position == 0) {            return this.method.getStatusLine().toString();        }        // Note: HttpClient does not currently keep headers in the same order        // that they are read from the HTTP server.        Header[] headers = this.method.getResponseHeaders();        if (position < 0 || position > headers.length) {            return null;        }        return headers[position - 1].getValue();    }    /**     * Return the URL     * @return The URL.     * @see java.net.HttpURLConnection#getURL()     */    public URL getURL() {        LOG.trace("enter HttpURLConnection.getURL()");        return this.url;    }    // Note: We don't implement the following methods so that they default to    // the JDK implementation. They will all call    // <code>getHeaderField(String)</code> which we have overridden.    // java.net.HttpURLConnection#getHeaderFieldDate(String, long)    // java.net.HttpURLConnection#getContentLength()    // java.net.HttpURLConnection#getContentType()    // java.net.HttpURLConnection#getContentEncoding()    // java.net.HttpURLConnection#getDate()    // java.net.HttpURLConnection#getHeaderFieldInt(String, int)    // java.net.HttpURLConnection#getExpiration()    // java.net.HttpURLConnection#getLastModified()    /**     * Not available: the data must have already been retrieved.     */    public void setInstanceFollowRedirects(boolean isFollowingRedirects) {        LOG.trace("enter HttpURLConnection.setInstanceFollowRedirects(boolean)");        throw new RuntimeException("This class can only be used with already"            + "retrieved data");    }    /**     * Not yet implemented.     */    public boolean getInstanceFollowRedirects() {        LOG.trace("enter HttpURLConnection.getInstanceFollowRedirects()");        throw new RuntimeException("Not implemented yet");    }    /**     * Not available: the data must have already been retrieved.     * @see java.net.HttpURLConnection#setRequestMethod(String)     */    public void setRequestMethod(String method) throws ProtocolException {        LOG.trace("enter HttpURLConnection.setRequestMethod(String)");        throw new RuntimeException("This class can only be used with already"            + "retrieved data");    }    /**     * Not yet implemented.     * @see java.net.HttpURLConnection#getPermission()     */    public Permission getPermission() throws IOException {        LOG.trace("enter HttpURLConnection.getPermission()");        throw new RuntimeException("Not implemented yet");    }    /**     * Not yet implemented.     * @see java.net.HttpURLConnection#getContent()     */    public Object getContent() throws IOException {        LOG.trace("enter HttpURLConnection.getContent()");        throw new RuntimeException("Not implemented yet");    }    /**     * Not yet implemented.     */    public Object getContent(Class[] classes) throws IOException {        LOG.trace("enter HttpURLConnection.getContent(Class[])");        throw new RuntimeException("Not implemented yet");    }    /**     * @see java.net.HttpURLConnection#getOutputStream()     */    public OutputStream getOutputStream() throws IOException {        LOG.trace("enter HttpURLConnection.getOutputStream()");        throw new RuntimeException("This class can only be used with already"            + "retrieved data");    }    /**     * Not available: the data must have already been retrieved.     * @see java.net.HttpURLConnection#setDoInput(boolean)     */    public void setDoInput(boolean isInput) {        LOG.trace("enter HttpURLConnection.setDoInput()");        throw new RuntimeException("This class can only be used with already"            + "retrieved data");    }    /**     * Not yet implemented.     * @see java.net.HttpURLConnection#getDoInput()     */    public boolean getDoInput() {        LOG.trace("enter HttpURLConnection.getDoInput()");        throw new RuntimeException("Not implemented yet");    }    /**     * Not available: the data must have already been retrieved.     * @see java.net.HttpURLConnection#setDoOutput(boolean)     */    public void setDoOutput(boolean isOutput) {        LOG.trace("enter HttpURLConnection.setDoOutput()");        throw new RuntimeException("This class can only be used with already"            + "retrieved data");    }    /**     * Not yet implemented.     * @see java.net.HttpURLConnection#getDoOutput()     */    public boolean getDoOutput() {        LOG.trace("enter HttpURLConnection.getDoOutput()");        throw new RuntimeException("Not implemented yet");    }    /**     * Not available: the data must have already been retrieved.     * @see java.net.HttpURLConnection#setAllowUserInteraction(boolean)     */    public void setAllowUserInteraction(boolean isAllowInteraction) {        LOG.trace("enter HttpURLConnection.setAllowUserInteraction(boolean)");        throw new RuntimeException("This class can only be used with already"            + "retrieved data");    }    /**     * Not yet implemented.     * @see java.net.HttpURLConnection#getAllowUserInteraction()     */    public boolean getAllowUserInteraction() {        LOG.trace("enter HttpURLConnection.getAllowUserInteraction()");        throw new RuntimeException("Not implemented yet");    }    /**     * Not available: the data must have already been retrieved.     * @see java.net.HttpURLConnection#setUseCaches(boolean)     */    public void setUseCaches(boolean isUsingCaches) {        LOG.trace("enter HttpURLConnection.setUseCaches(boolean)");        throw new RuntimeException("This class can only be used with already"            + "retrieved data");    }    /**     * Not yet implemented.     * @see java.net.HttpURLConnection#getUseCaches()     */    public boolean getUseCaches() {        LOG.trace("enter HttpURLConnection.getUseCaches()");        throw new RuntimeException("Not implemented yet");    }    /**     * Not available: the data must have already been retrieved.     * @see java.net.HttpURLConnection#setIfModifiedSince(long)     */    public void setIfModifiedSince(long modificationDate) {        LOG.trace("enter HttpURLConnection.setIfModifiedSince(long)");        throw new RuntimeException("This class can only be used with already"            + "retrieved data");    }    /**     * Not yet implemented.     * @see java.net.HttpURLConnection#getIfModifiedSince()     */    public long getIfModifiedSince() {        LOG.trace("enter HttpURLConnection.getIfmodifiedSince()");        throw new RuntimeException("Not implemented yet");    }    /**     * Not available: the data must have already been retrieved.     * @see java.net.HttpURLConnection#getDefaultUseCaches()     */    public boolean getDefaultUseCaches() {        LOG.trace("enter HttpURLConnection.getDefaultUseCaches()");        throw new RuntimeException("Not implemented yet");    }    /**     * Not available: the data must have already been retrieved.     * @see java.net.HttpURLConnection#setDefaultUseCaches(boolean)     */    public void setDefaultUseCaches(boolean isUsingCaches) {        LOG.trace("enter HttpURLConnection.setDefaultUseCaches(boolean)");        throw new RuntimeException("This class can only be used with already"            + "retrieved data");    }    /**     * Not available: the data must have already been retrieved.     * @see java.net.HttpURLConnection#setRequestProperty(String,String)     */    public void setRequestProperty(String key, String value) {        LOG.trace("enter HttpURLConnection.setRequestProperty()");        throw new RuntimeException("This class can only be used with already"            + "retrieved data");    }    /**     * Not yet implemented.     * @see java.net.HttpURLConnection#getRequestProperty(String)     */    public String getRequestProperty(String key) {        LOG.trace("enter HttpURLConnection.getRequestProperty()");        throw new RuntimeException("Not implemented yet");    }}

⌨️ 快捷键说明

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