agave-common/common-api/src/main/java/org/iplantc/service/common/representation/AgaveRepresentation.java
/**
	 * Formats the response both successful and unsuccessful calls into a 
	 * JSON wrapper object with attributes status, message, and result 
	 * where result contains the JSON output of the call.
	 *
	 * @param status the status of the api operation
	 * @param message the message in the response wrapper
	 * @param json the api operation response payload
	 */
Formats the response both successful and unsuccessful calls into a
JSON wrapper object with attributes status, message, and result
where result contains the JSON output of the call.

@param status the status of the api operation
@param message the message in the response wrapper
@param json the api operation response payload
Formats the response both successful and unsuccessful calls into a JSON wrapper object with attributes status message and result where result contains the JSON output of the call . @param status the status of the api operation @param message the message in the response wrapper @param json the api operation response payload
protected String formatResponse(String status, String message, String json) {
		try {
			ObjectMapper mapper = new ObjectMapper();
            JsonNode jsonNode = mapper.readTree(json);
            return formatResponse(status, message, jsonNode);
		}
		catch (Exception e) {
			if (isNaked()) {
		        return json;
		    }
		    else
		    {
    			status = status.replaceAll("\"", "\\\"");
    			if (message == null) {
    				message = "";
    			} else {
    				message = message.replaceAll("\"", "\\\"");
    			}
    			StringBuilder builder = new StringBuilder();
    			builder.append("{\"status\":\"").append(status).append("\",");
    			builder.append("\"message\":\"").append(message).append("\",");
    			builder.append("\"version\":\"").append(Settings.SERVICE_VERSION).append("\",");
    			builder.append("\"result\":").append(json).append("}");
    			return builder.toString();
		    }
		}
	}
protected String formatResponse ( String status , String message , String json ) { try { ObjectMapper mapper = new ObjectMapper ( ) ; JsonNode jsonNode = mapper . readTree ( json ) ; return formatResponse ( status , message , jsonNode ) ; } catch ( Exception e ) { if ( isNaked ( ) ) { return json ; } else { status = status . replaceAll ( "\"" , "\\\"" ) ; if ( message == null ) { message = "" ; } else { message = message . replaceAll ( "\"" , "\\\"" ) ; } StringBuilder builder = new StringBuilder ( ) ; builder . append ( "{\"status\":\"" ) . append ( status ) . append ( "\"," ) ; builder . append ( "\"message\":\"" ) . append ( message ) . append ( "\"," ) ; builder . append ( "\"version\":\"" ) . append ( Settings . SERVICE_VERSION ) . append ( "\"," ) ; builder . append ( "\"result\":" ) . append ( json ) . append ( "}" ) ; return builder . toString ( ) ; } } }
Formats the response both successful and unsuccessful calls into a
 JSON wrapper object with attributes status, message, and result
 where result contains the JSON output of the call.
Formats the response both successful and unsuccessful calls into a JSON wrapper object with attributes status message and result where result contains the JSON output of the call .