Class DefaultHttpResponse
java.lang.Object
org.apache.mina.http.api.DefaultHttpResponse
- All Implemented Interfaces:
HttpMessage, HttpResponse
The default implementation for the HTTP response element.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultHttpResponse(HttpVersion version, HttpStatus status, Map<String, String> headers) Creates a new DefaultHttpResponse instance -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsHeader(String name) Tells if the message contains some headerGets theContent-Typeheader of the message.Returns the value of the HTTP header with the specified name.The HTTP version of the messageThe HTTP status code for the HTTP response (e.g.booleantoString()
-
Field Details
-
version
-
status
-
headers
-
-
Constructor Details
-
DefaultHttpResponse
Creates a new DefaultHttpResponse instance- Parameters:
version- The HTTP versionstatus- The HTTP statusheaders- The HTTP headers
-
-
Method Details
-
getProtocolVersion
The HTTP version of the message- Specified by:
getProtocolVersionin interfaceHttpMessage- Returns:
- HTTP/1.0 or HTTP/1.1
-
getContentType
Gets theContent-Typeheader of the message.- Specified by:
getContentTypein interfaceHttpMessage- Returns:
- The content type.
-
isKeepAlive
public boolean isKeepAlive()- Specified by:
isKeepAlivein interfaceHttpMessage- Returns:
trueif this message enables keep-alive connection.
-
getHeader
Returns the value of the HTTP header with the specified name. If more than one header with the given name is associated with this request, one is selected and returned.- Specified by:
getHeaderin interfaceHttpMessage- Parameters:
name- The name of the desired header- Returns:
- The header value - or null if no header is found with the specified name
-
containsHeader
Tells if the message contains some header- Specified by:
containsHeaderin interfaceHttpMessage- Parameters:
name- the Header's name we are looking for- Returns:
trueif the HTTP header with the specified name exists in this request.
-
getHeaders
- Specified by:
getHeadersin interfaceHttpMessage- Returns:
- a read-only
Mapof HTTP headers whose key is aStringand whose value is aStrings.
-
getStatus
The HTTP status code for the HTTP response (e.g. 200 for OK, 404 for not found, etc..)- Specified by:
getStatusin interfaceHttpResponse- Returns:
- the status of the HTTP response
-
toString
-