Package org.apache.hc.core5.http.message
Class BasicClassicHttpResponse
- java.lang.Object
-
- org.apache.hc.core5.http.message.HeaderGroup
-
- org.apache.hc.core5.http.message.BasicHttpResponse
-
- org.apache.hc.core5.http.message.BasicClassicHttpResponse
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Serializable
,java.lang.AutoCloseable
,ClassicHttpResponse
,HttpEntityContainer
,HttpMessage
,HttpResponse
,MessageHeaders
public class BasicClassicHttpResponse extends BasicHttpResponse implements ClassicHttpResponse
Basic implementation ofClassicHttpResponse
.- Since:
- 5.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private HttpEntity
entity
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description BasicClassicHttpResponse(int code)
Creates a new response.BasicClassicHttpResponse(int code, java.lang.String reasonPhrase)
Creates a new response.BasicClassicHttpResponse(int code, ReasonPhraseCatalog catalog, java.util.Locale locale)
Creates a new response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
HttpEntity
getEntity()
Obtains the message entity, if available.void
setEntity(HttpEntity entity)
Sets an entity for this message.-
Methods inherited from class org.apache.hc.core5.http.message.BasicHttpResponse
addHeader, getCode, getLocale, getReason, getReasonPhrase, getVersion, setCode, setHeader, setLocale, setReasonPhrase, setVersion, toString
-
Methods inherited from class org.apache.hc.core5.http.message.HeaderGroup
addHeader, clear, containsHeader, countHeaders, getCondensedHeader, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator, removeHeader, removeHeaders, removeHeaders, setHeader, setHeaders
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.hc.core5.http.HttpMessage
addHeader, addHeader, getVersion, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setVersion
-
Methods inherited from interface org.apache.hc.core5.http.HttpResponse
getCode, getLocale, getReasonPhrase, setCode, setLocale, setReasonPhrase
-
Methods inherited from interface org.apache.hc.core5.http.MessageHeaders
containsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
entity
private HttpEntity entity
-
-
Constructor Detail
-
BasicClassicHttpResponse
public BasicClassicHttpResponse(int code, ReasonPhraseCatalog catalog, java.util.Locale locale)
Creates a new response.- Parameters:
code
- the status codecatalog
- the reason phrase catalog, ornull
to disable automatic reason phrase lookuplocale
- the locale for looking up reason phrases, ornull
for the system locale
-
BasicClassicHttpResponse
public BasicClassicHttpResponse(int code, java.lang.String reasonPhrase)
Creates a new response.- Parameters:
code
- the status code of the responsereasonPhrase
- the reason phrase to the status code, ornull
-
BasicClassicHttpResponse
public BasicClassicHttpResponse(int code)
Creates a new response.- Parameters:
code
- the status code of the response
-
-
Method Detail
-
getEntity
public HttpEntity getEntity()
Description copied from interface:HttpEntityContainer
Obtains the message entity, if available.- Specified by:
getEntity
in interfaceHttpEntityContainer
- Returns:
- the message entity, or
null
if not available
-
setEntity
public void setEntity(HttpEntity entity)
Description copied from interface:HttpEntityContainer
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.
- Specified by:
setEntity
in interfaceHttpEntityContainer
- Parameters:
entity
- the entity to set of this message, ornull
to unset
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-