|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sonyericsson.hudson.plugins.metadata.cli.CliResponse
public final class CliResponse
Common util functions for sending HTTP responses in JSON format.
Nested Class Summary | |
---|---|
static class |
CliResponse.Type
A Type of Response that is sent to the client. |
Field Summary | |
---|---|
protected static String |
CONTENT_TYPE
The JSON content type to use when writing responses. |
Method Summary | |
---|---|
static net.sf.json.JSONObject |
createResponse(CliResponse.Type type,
int errorCode,
String errorName,
String message)
Creates a Response JSON Object. |
static void |
sendError(CliUtils.Status status,
String message,
org.kohsuke.stapler.StaplerResponse response)
Sends an error message in json format on the response object. |
static void |
sendIgnored(org.kohsuke.stapler.StaplerResponse response)
Sends an OK status message with Ignored as the text in JSON format. |
static void |
sendOk(org.kohsuke.stapler.StaplerResponse response)
Sends an OK status message in JSON format. |
static void |
sendResponse(CliResponse.Type type,
int errorCode,
String errorName,
String message,
org.kohsuke.stapler.StaplerResponse response)
Sends a status message in JSON format. |
static void |
sendResponse(CliResponse.Type type,
int errorCode,
String errorName,
String message,
org.kohsuke.stapler.StaplerResponse response,
int httpStatus)
Sends a status message in JSON format. |
static void |
sendResponse(org.kohsuke.stapler.StaplerResponse response,
net.sf.json.JSONObject json,
int httpStatus)
Sends the pre-formatted response object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String CONTENT_TYPE
Method Detail |
---|
public static void sendError(CliUtils.Status status, String message, org.kohsuke.stapler.StaplerResponse response) throws IOException
status
- the status code.message
- the human readable message.response
- the response object to send to.
IOException
- if so.public static void sendOk(org.kohsuke.stapler.StaplerResponse response) throws IOException
response
- the response handle.
IOException
- if so.public static void sendIgnored(org.kohsuke.stapler.StaplerResponse response) throws IOException
response
- the response handle.
IOException
- if so.public static void sendResponse(CliResponse.Type type, int errorCode, String errorName, String message, org.kohsuke.stapler.StaplerResponse response, int httpStatus) throws IOException
type
- the response type (ok, error, warning)errorCode
- the errorCodeerrorName
- the name of the error if any.message
- the messageresponse
- the response handle.httpStatus
- the HTTP Status code
IOException
- if so.public static void sendResponse(CliResponse.Type type, int errorCode, String errorName, String message, org.kohsuke.stapler.StaplerResponse response) throws IOException
type
- the response type (ok, error, warning)errorCode
- the errorCodeerrorName
- the name of the error if any.message
- the messageresponse
- the response handle.
IOException
- if so.public static void sendResponse(org.kohsuke.stapler.StaplerResponse response, net.sf.json.JSONObject json, int httpStatus) throws IOException
response
- the http response handle to write to.json
- the response object to send.httpStatus
- the HTTP Status code
IOException
- if so.public static net.sf.json.JSONObject createResponse(CliResponse.Type type, int errorCode, String errorName, String message)
type
- the response type (ok, error, warning)errorCode
- the errorCodeerrorName
- the name of the error if any.message
- the human readable message
sendResponse(org.kohsuke.stapler.StaplerResponse,
net.sf.json.JSONObject, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |