Modifier and Type | Field and Description |
---|---|
static String |
KEY_COMMAND
The key in the map returned by
toMap() for the command name. |
static String |
KEY_ERROR
The key in the map returned by
toMap() for the error string. |
Constructor and Description |
---|
CommandResponse(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.
|
Modifier and Type | Method and Description |
---|---|
void |
addHeader(String name,
String value)
Adds a header to this response.
|
String |
getCommand()
Gets the command name.
|
String |
getError()
Gets the error string (may be null).
|
Map<String,String> |
getHeaders()
Returns all headers
|
InputStream |
getInputStream()
Gets the InputStream (may be null).
|
int |
getStatusCode()
Gets the http status code
|
Object |
put(String key,
Object value)
Adds a key/value pair to this response.
|
void |
putAll(Map<? extends String,?> m)
Adds all key/value pairs in the given map to this response.
|
void |
setInputStream(InputStream inputStream)
Sets the InputStream
|
void |
setStatusCode(int statusCode)
Sets the http status code
|
Map<String,Object> |
toMap()
Converts this response to a map.
|
public static final String KEY_COMMAND
toMap()
for the command name.public static final String KEY_ERROR
toMap()
for the error string.public CommandResponse(String command)
command
- command namepublic CommandResponse(String command, String error, int statusCode)
command
- command nameerror
- error string (may be null)statusCode
- http status codepublic CommandResponse(String command, String error, int statusCode, InputStream inputStream)
command
- command nameerror
- error string (may be null)statusCode
- http status codeinputStream
- inputStream to send out data (may be null)public String getCommand()
public String getError()
public int getStatusCode()
public void setStatusCode(int statusCode)
public InputStream getInputStream()
public void setInputStream(InputStream inputStream)
public Object put(String key, Object value)
key
- keyvalue
- valuepublic void putAll(Map<? extends String,?> m)
m
- map of key/value pairspublic void addHeader(String name, String value)
name
- name of the headervalue
- value of the headerpublic Map<String,String> getHeaders()
Copyright © 2008–2025 The Apache Software Foundation. All rights reserved.