Class CommandResponse
java.lang.Object
org.apache.zookeeper.server.admin.CommandResponse
A response from running a
Command
.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCommandResponse
(String command) Creates a new response with no error string.CommandResponse
(String command, String error, int statusCode) Creates a new response.CommandResponse
(String command, String error, int statusCode, InputStream inputStream) Creates a new response. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a header to this response.Gets the command name.getError()
Gets the error string (may be null).Returns all headersGets the InputStream (may be null).int
Gets the http status codeAdds a key/value pair to this response.void
Adds all key/value pairs in the given map to this response.void
setInputStream
(InputStream inputStream) Sets the InputStreamvoid
setStatusCode
(int statusCode) Sets the http status codetoMap()
Converts this response to a map.
-
Field Details
-
Constructor Details
-
CommandResponse
Creates a new response with no error string.- Parameters:
command
- command name
-
CommandResponse
Creates a new response.- Parameters:
command
- command nameerror
- error string (may be null)statusCode
- http status code
-
CommandResponse
Creates a new response.- Parameters:
command
- command nameerror
- error string (may be null)statusCode
- http status codeinputStream
- inputStream to send out data (may be null)
-
-
Method Details
-
getCommand
Gets the command name.- Returns:
- command name
-
getError
Gets the error string (may be null).- Returns:
- error string
-
getStatusCode
public int getStatusCode()Gets the http status code- Returns:
- http status code
-
setStatusCode
public void setStatusCode(int statusCode) Sets the http status code -
getInputStream
Gets the InputStream (may be null).- Returns:
- InputStream
-
setInputStream
Sets the InputStream -
put
Adds a key/value pair to this response.- Parameters:
key
- keyvalue
- value- Returns:
- prior value for key, or null if none
-
putAll
Adds all key/value pairs in the given map to this response.- Parameters:
m
- map of key/value pairs
-
addHeader
Adds a header to this response.- Parameters:
name
- name of the headervalue
- value of the header
-
getHeaders
Returns all headers- Returns:
- map representation of all headers
-
toMap
Converts this response to a map. The returned map is mutable, and changes to it do not reflect back into this response.- Returns:
- map representation of response
-