Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
HttpComponents Client Source Code Files
HttpComponents Client Source Code Files are provided in the
source package file, httpcomponents-client-5.2-src.zip.
You can download httpcomponents-client-5.2-src.zip as described in the previous tutorial and go to the "httpclient5/src" sub-folder to view Source Code files.
You can also browse HttpComponents Client Source Code below:
✍: FYIcenter.com
⏎ org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.hc.client5.http.impl.classic;
import java.io.IOException;
import java.util.Iterator;
import java.util.Locale;
import org.apache.hc.client5.http.classic.ExecRuntime;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.ProtocolVersion;
import org.apache.hc.core5.util.Args;
/**
* Provided for backward compatibility with HttpClient 4.x.
*
* @since 4.3
*/
public final class CloseableHttpResponse implements ClassicHttpResponse {
private final ClassicHttpResponse response;
private final ExecRuntime execRuntime;
static CloseableHttpResponse adapt(final ClassicHttpResponse response) {
if (response == null) {
return null;
}
return response instanceof CloseableHttpResponse
? (CloseableHttpResponse) response
: new CloseableHttpResponse(response, null);
}
CloseableHttpResponse(final ClassicHttpResponse response, final ExecRuntime execRuntime) {
this.response = Args.notNull(response, "Response");
this.execRuntime = execRuntime;
}
@Override
public int getCode() {
return response.getCode();
}
@Override
public HttpEntity getEntity() {
return response.getEntity();
}
@Override
public boolean containsHeader(final String name) {
return response.containsHeader(name);
}
@Override
public void setVersion(final ProtocolVersion version) {
response.setVersion(version);
}
@Override
public void setCode(final int code) {
response.setCode(code);
}
@Override
public String getReasonPhrase() {
return response.getReasonPhrase();
}
@Override
public int countHeaders(final String name) {
return response.countHeaders(name);
}
@Override
public void setEntity(final HttpEntity entity) {
response.setEntity(entity);
}
@Override
public ProtocolVersion getVersion() {
return response.getVersion();
}
@Override
public void setReasonPhrase(final String reason) {
response.setReasonPhrase(reason);
}
@Override
public Header[] getHeaders(final String name) {
return response.getHeaders(name);
}
@Override
public void addHeader(final Header header) {
response.addHeader(header);
}
@Override
public Locale getLocale() {
return response.getLocale();
}
@Override
public void addHeader(final String name, final Object value) {
response.addHeader(name, value);
}
@Override
public void setLocale(final Locale loc) {
response.setLocale(loc);
}
@Override
public Header getHeader(final String name) throws ProtocolException {
return response.getHeader(name);
}
@Override
public void setHeader(final Header header) {
response.setHeader(header);
}
@Override
public Header getFirstHeader(final String name) {
return response.getFirstHeader(name);
}
@Override
public void setHeader(final String name, final Object value) {
response.setHeader(name, value);
}
@Override
public void setHeaders(final Header... headers) {
response.setHeaders(headers);
}
@Override
public boolean removeHeader(final Header header) {
return response.removeHeader(header);
}
@Override
public boolean removeHeaders(final String name) {
return response.removeHeaders(name);
}
@Override
public Header getLastHeader(final String name) {
return response.getLastHeader(name);
}
@Override
public Header[] getHeaders() {
return response.getHeaders();
}
@Override
public Iterator<Header> headerIterator() {
return response.headerIterator();
}
@Override
public Iterator<Header> headerIterator(final String name) {
return response.headerIterator(name);
}
@Override
public void close() throws IOException {
if (execRuntime != null) {
try {
response.close();
execRuntime.disconnectEndpoint();
} finally {
execRuntime.discardEndpoint();
}
} else {
response.close();
}
}
@Override
public String toString() {
return response.toString();
}
}
⏎ org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
Or download all them as a single archive file:
File name: httpclient5-5.2-fyi.zip File size: 625318 bytes Release date: 2022-11-10 Download
⇒ Download and Install HttpComponents Core Binary Package
⇐ Download and Install HttpComponents Client Source Package
2023-03-26, ≈60🔥, 1💬
Popular Posts:
Provides a simple high-level Http server API, which can be used to build embedded HTTP servers. Both...
How to download and install JDK (Java Development Kit) 1.4? If you want to write Java applications, ...
JDK 11 jdk.internal.vm.ci.jmod is the JMOD file for JDK 11 Internal VM CI module. JDK 11 Internal VM...
What Is junit-3.8.1.jar? junit-3.8.1.jar is the version 3.8.1 of JUnit JAR library file. JUnit is a ...
JDK 17 jdk.localedata.jmod is the JMOD file for JDK 17 Localedata module. JDK 17 Locale Data module ...