Top Description Fields Constructors Methods
org.apache.hc.core5.http.message

public Class BasicClassicHttpResponse

extends BasicHttpResponse
implements ClassicHttpResponse
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.ClassicHttpResponse, java.io.Closeable, java.lang.AutoCloseable, org.apache.hc.core5.http.HttpEntityContainer, org.apache.hc.core5.http.HttpResponse, org.apache.hc.core5.http.HttpMessage, org.apache.hc.core5.http.MessageHeaders
Imports
java.io.IOException, java.util.Locale, org.apache.hc.core5.http.ClassicHttpResponse, .HttpEntity, .ReasonPhraseCatalog, org.apache.hc.core5.io.Closer

Basic implementation of ClassicHttpResponse.
Since
5.0

Field Summary

Modifier and TypeField and Description
private HttpEntity
private static final long

Constructor Summary

AccessConstructor and Description
public
BasicClassicHttpResponse(final int
the status code
code
,
final ReasonPhraseCatalog
the reason phrase catalog, or null to disable automatic reason phrase lookup
catalog
,
final Locale
the locale for looking up reason phrases, or null for the system locale
locale
)

Creates a new response.

public
BasicClassicHttpResponse(final int
the status code of the response
code
,
final String
the reason phrase to the status code, or null
reasonPhrase
)

Creates a new response.

public
BasicClassicHttpResponse(final int
the status code of the response
code
)

Creates a new response.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
public HttpEntity
getEntity()

Implements org.apache.hc.core5.http.HttpEntityContainer.getEntity.

Obtains the message entity, if available.
public void
setEntity(final HttpEntity
the entity to set of this message, or null to unset
entity
)

Implements org.apache.hc.core5.http.HttpEntityContainer.setEntity.

Sets an entity for this message.
Inherited from org.apache.hc.core5.http.message.BasicHttpResponse:
addHeadergetCodegetLocalegetReasongetReasonPhrasegetVersionsetCodesetHeadersetLocalesetReasonPhrasesetVersiontoString

Field Detail

entityback to summary
private HttpEntity entity
serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.hc.core5.http.message.BasicHttpResponse.serialVersionUID.

Constructor Detail

BasicClassicHttpResponseback to summary
public BasicClassicHttpResponse(final int code, final ReasonPhraseCatalog catalog, final Locale locale)

Creates a new response.

Parameters
code:int

the status code

catalog:ReasonPhraseCatalog

the reason phrase catalog, or null to disable automatic reason phrase lookup

locale:Locale

the locale for looking up reason phrases, or null for the system locale

BasicClassicHttpResponseback to summary
public BasicClassicHttpResponse(final int code, final String reasonPhrase)

Creates a new response.

Parameters
code:int

the status code of the response

reasonPhrase:String

the reason phrase to the status code, or null

BasicClassicHttpResponseback to summary
public BasicClassicHttpResponse(final int code)

Creates a new response.

Parameters
code:int

the status code of the response

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getEntityback to summary
public HttpEntity getEntity()

Implements org.apache.hc.core5.http.HttpEntityContainer.getEntity.

Doc from org.apache.hc.core5.http.HttpEntityContainer.getEntity.

Obtains the message entity, if available.

Returns:HttpEntity

the message entity, or null if not available

Annotations
@Override
setEntityback to summary
public void setEntity(final HttpEntity entity)

Implements org.apache.hc.core5.http.HttpEntityContainer.setEntity.

Doc from org.apache.hc.core5.http.HttpEntityContainer.setEntity.

Sets an entity for this message.

Please note that if an entity has already been set it is responsibility of the caller to ensure release of the resources that may be associated with that entity.

Parameters
entity:HttpEntity

the entity to set of this message, or null to unset

Annotations
@Override