Implementation 
@class ProcessDataResponse
@constructor
@param {String} jsonAnswer
198272
function ProcessDataResponse(jsonAnswer) {
    var data = JSON.parse(jsonAnswer);
    data = data.result;

    var channels = [];
    for (var deviceId in data) {
        if (data[deviceId] !== undefined) {
            if (data[deviceId].length > 0) {
                channels = data[deviceId][0].channels;
            }
        }
    }

    /**
     * @property channels
     * @type {Array}
     */
    this.channels = channels;
}
324473
function PlantOverviewResponse(jsonAnswer) {
    var data = JSON.parse(jsonAnswer);
    data = data.result.overview;

    var currentProduction = data[0].value.replace(/\s/, "");
    var dayProduced = data[1].value.replace(/\s/, "");
    var totalProduced = data[2].value.replace(/\s/, "");

    /**
     * What is currently produces (Unit is W)
     *
     * @property currentProduction
     * @type {Number}
     */
    this.currentProduction = parseFloat(currentProduction);

    /**
     * What is the day production (Unit is W)
     *
     * @property dayProduced
     * @type {Number}
     */
    this.dayProduced = parseFloat(dayProduced) * 1000;
    /**
     * What is the total production (Unit is W)
     *
     * @property totalProduced
     * @type {Number}
     */
    this.totalProduced = parseFloat(totalProduced) * 1000;
    /**
     * Which Mode?
     *
     * @property mode
     * @type {String}
     */
    this.mode = data[3].value;
    /**
     * Is there an error?
     *
     * @property error
     * @type {String}
     */
    this.error = data[4].value;
}
892766
function(json) {
        if (json.serverErrors) {
            this._handleNoCompiledCode(json.serverErrors);
        } else {
            json.compiledCode = this._header + json.compiledCode;

            if (this.file) {
                this._writeOutputTofile(json.compiledCode);
            }

            if (this.callback) {
                this.callback((this._passJson) ? json : json.compiledCode);
            }

            if (!this.file && !this.callback) {
                this.console.info('Code:', json.compiledCode);
            }
        }
    }
80696
function (result) {

      // don't send a second response
      if (responseHasBeenSent) {
        console.warn('JSON-RPC2 response has already been sent.')
        return
      }
      // notifications should not send error responses (JSON-RPC2 specs)
      if (!isMethodCall) {
        logNotificationResponseWarning(result, requestMessage)
        callback()
        return
      }

      // result should not be undefined
      if (result === undefined) {
        console.warn('JSON-RPC2 response from method ' + methodName + ' should return a result. (JSON-RPC2 spec)')
        result = ''
      }

      var rpcMessage = {
        jsonrpc: '2.0',
        result: result,
        id: id
      }

      callback(rpcMessage)
      responseHasBeenSent = true

    }
583748
private void doResults(HttpServletRequest req, HttpServletResponse resp) throws IOException, JsonGenerationException, JsonMappingException
  {
    Map<String, Object> result = new HashMap<String, Object>();

    String requestIds = req.getParameter("ids");
    if (!isEmpty(requestIds))
    {
      List<Map<String, Object>> requests = new ArrayList<Map<String, Object>>();
      for (String requestId : requestIds.split(","))
      {
        requestId = requestId.trim();
        @SuppressWarnings("unchecked")
        Map<String, Object> requestData = (Map<String, Object>) ms.get(String.format(MiniProfilerFilter.MEMCACHE_KEY_FORMAT_STRING, requestId));
        if (requestData != null)
        {
          Map<String, Object> request = new HashMap<String, Object>();
          request.put("id", requestId);
          request.put("redirect", requestData.get("redirect"));
          request.put("requestURL", requestData.get("requestURL"));
          request.put("timestamp", requestData.get("timestamp"));
          request.put("profile", requestData.get("profile"));
          if (requestData.containsKey("appstatsId"))
          {
            Map<String, Object> appstatsMap = MiniProfilerAppstats.getAppstatsDataFor((String) requestData.get("appstatsId"), maxStackFrames);
            request.put("appstats", appstatsMap != null ? appstatsMap : null);
          } else
          {
            request.put("appstats", null);
          }
          requests.add(request);
        }
      }
      result.put("ok", true);
      result.put("requests", requests);
    } else
    {
      result.put("ok", false);
    }

    resp.setContentType("application/json");
    resp.setHeader("Cache-Control", "no-cache");

    ObjectMapper jsonMapper = new ObjectMapper();
    jsonMapper.writeValue(resp.getOutputStream(), result);
  }
1175903
private JsonNode processErrorResponse(final JsonNode resp) {
        String errorMessage = resp.get("error").asText();
        if (resp.has("stack")) {
            errorMessage += "\n" + resp.get("stack").asText();
        }

        throw new JsiiException(errorMessage);
    }
1219232
function onResponse( response ) {
		res = response;
		if ( res.statusCode !== 200 ) {
			err = {
				'status': res.statusCode,
				'message': ''
			};
		}
		debug( 'Received a response from query endpoint.' );
		debug( 'Response status: %s.', res.statusCode );

		debug( 'Response headers: %s', JSON.stringify( res.headers ) );

		res.setEncoding( 'utf8' );
		res.on( 'data', onData );
		res.on( 'end', onEnd );
	}
690326
function ajaxHandleResponses( s, jqXHR, responses ) {

	var contents = s.contents,
		dataTypes = s.dataTypes,
		responseFields = s.responseFields,
		ct,
		type,
		finalDataType,
		firstDataType;

	// Fill responseXXX fields
	for ( type in responseFields ) {
		if ( type in responses ) {
			jqXHR[ responseFields[type] ] = responses[ type ];
		}
	}

	// Remove auto dataType and get content-type in the process
	while( dataTypes[ 0 ] === "*" ) {
		dataTypes.shift();
		if ( ct === undefined ) {
			ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
		}
	}

	// Check if we're dealing with a known content-type
	if ( ct ) {
		for ( type in contents ) {
			if ( contents[ type ] && contents[ type ].test( ct ) ) {
				dataTypes.unshift( type );
				break;
			}
		}
	}

	// Check to see if we have a response for the expected dataType
	if ( dataTypes[ 0 ] in responses ) {
		finalDataType = dataTypes[ 0 ];
	} else {
		// Try convertible dataTypes
		for ( type in responses ) {
			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
				finalDataType = type;
				break;
			}
			if ( !firstDataType ) {
				firstDataType = type;
			}
		}
		// Or just use first one
		finalDataType = finalDataType || firstDataType;
	}

	// If we found a dataType
	// We add the dataType to the list if needed
	// and return the corresponding response
	if ( finalDataType ) {
		if ( finalDataType !== dataTypes[ 0 ] ) {
			dataTypes.unshift( finalDataType );
		}
		return responses[ finalDataType ];
	}
}
1115793
function (res, res_obj) {

    // return response if exist, otherwise response might be returned 
    // AFTER some callback is done handling (i.e., response will be returned within the handler)
    if (typeof res_obj === 'string') {
        LOG.sys('replying a string: ' + res_obj);
        res.writeHead(200, {'Content-Type': 'text/plain'});                     
        res.end(res_obj);            
    }
    else {
        LOG.sys('replying a JSON: ' + JSON.stringify(res_obj));
        res.writeHead(200, {'Content-Type': 'application/json'});                     
        res.end(JSON.stringify(res_obj));        
    }
}
757472
function onResponse( response ) {
		if ( response.statusCode !== 200 ) {
			err = {
				'status': response.statusCode,
				'message': ''
			};
		}
		debug( 'Received a response from query endpoint.' );
		debug( 'Response status: %s.', response.statusCode );
		debug( 'Response headers: %s', JSON.stringify( response.headers ) );

		response.setEncoding( 'utf8' );
		response.on( 'data', onData );
		response.on( 'end', onEnd );
	}
1028368
function JSONReporter(detector) {
  BaseReporter.call(this, detector);

  detector.on('start', function() {
    process.stdout.write('[');
  });

  detector.on('end', function() {
    process.stdout.write("]\n");
  });
}
694296
function processData(res, data, options) {
  const handlers = Object.assign({}, deserializers, options.deserializers);
  const contentType = res.headers['content-type'];
  const types = typeof contentType === 'string' ? contentType.split(';') : [];

  // if there are no content types, return the data unmodified
  if (!types.length) {
    return data;
  }

  return types.reduce((d, type) => {
    try {
      const t = type.toLocaleLowerCase().trim();
      const handler = handlers[t];

      if (d instanceof Error || typeof handler !== 'function') {
        return d;
      }
      return handler(d);
    } catch (error) {
      return error;
    }
  }, data);
}
1320273
@Override
	public void onResponse( Object cookie, ResponseJSO response, int msgLevel, String msg )
	{
		PendingRequestInfo info = (PendingRequestInfo) cookie;

		// Store answer in cache
		if( info.fStoreResultInCache )
			cache.put( info.requestKey, response );

		// give the result to all the subscribees
		for( RequestCallInfo call : info.subscriptions )
			call.setResult( msgLevel, msg, null, response );

		// forget this request
		pendingRequests.remove( info );

		// calls back the clients
		checkAnswersToGive();
	}
931931
function(response, resolver, callbackSuccess, callbackError) {

            //xhr = xhr.target || xhr || {};
            var statusCode = xhrSuccessStatus[response.status] || response.status,
                statusType = Number(response.status.toString()[0]),
                promiseResponse;

            var data = response.response;
            var headers = corbel.utils.keysToLowerCase(response.headers);

            if (statusType <= 3 && !response.error) {

                if (response.response) {
                    data = request.parse(response.response, response.responseType, response.dataType);
                }

                if (callbackSuccess) {
                    callbackSuccess.call(this, data, statusCode, response.responseObject, headers);
                }

                promiseResponse = {
                    data: data,
                    status: statusCode,
                    headers: headers
                };

                promiseResponse[response.responseObjectType] = response.responseObject;

                resolver.resolve(promiseResponse);
            } else {

                var disconnected = response.error && response.status === 0;
                statusCode = disconnected ? 0 : statusCode;

                if (callbackError) {
                    callbackError.call(this, response.error, statusCode, response.responseObject, headers);
                }

                if (response.response) {
                    data = request.parse(response.response, response.responseType, response.dataType);
                }

                promiseResponse = {
                    data: data,
                    status: statusCode,
                    error: response.error,
                    headers: headers
                };

                promiseResponse[response.responseObjectType] = response.responseObject;

                resolver.reject(promiseResponse);
            }
        }
581890
function(res) {
    res.setEncoding('utf8');
    var data = "";
    res.on('data', function(chunk) {
      data+=chunk;
    });

    res.on('end', function() {
      // Get HTTP Statuscode and act according to situation
      var code = res.statusCode;
      try { // try to parse JSON
        var answer = JSON.parse(data);
      } catch (e) {
        var err = {};
        err.http_code = 500;
        err.message = "No valid JSON received: "+data;
        callback(err, null);
        return;
      }
      if(code >= 200 && code <= 206) { // request was successful
        callback(null, answer);
      } else if (code >= 300 && code <= 307) { // server send redirect
        // we do not follow anything the server wants us to follow right now, since this should never be the case.
        // instead let's raise an error.
        var err = new Object();
        err.http_code = 500;
        err.message = "Redirects not supported by pastyclient-node"
        callback(err, null);
      } else if (code >= 400 && code <= 418) { // client error
        if(typeof(answer.error) == "object") {
          var err = answer.error;
        } else if(answer.code != undefined && answer.message != undefined) { // New RestError, temporary support both 
          var err = answer;
          err.http_code = code;
        } else {
          var err = new Object();
          err.http_code = code;
          err.message = "Resource not found";
        }
        callback(err, null);
      } else if (code >= 500 && code <= 505) { // server error
        if(typeof(answer.error) == "object") {
          var err = answer.error;
        } else {
          var err = new Object();
          err.http_code = code;
          err.message = "Internal Server Error";
        }
        callback(err, null);
      } else {
        // Not existant HTTP code. Raise error.
        var err = new Object();
        err.http_code = 500;
        err.message = "HTTP Status Code "+code+" is not supported by pastyclient-node"
        callback(err, null);
      }
    });
  }
542577
public void submitAnswer(JSONObject answer, String realm) {
        if (answers == null) {
            answers = new JSONObject();
        }

        try {
            answers.put(realm, answer);
            if (isAnswersFilled()) {
                resendRequest();
            }
        } catch (Throwable t) {
            logger.error("submitAnswer failed with exception: " + t.getLocalizedMessage(), t);
        }
    }
462397
function processJsonataType(property, type, node) {
        console.log('prep - p:%s, t:%s', property, type);
        if (type === 'jsonata') {
            try {
                property = RED.util.prepareJSONataExpression(property, node);
            } catch (err) {
                // this.error(RED._('switch.errors.invalid-expr', { error: err.message }));
                // throw new
                // verror(err, RED._('switch.errors.invalid-expr', { error: err.message }));
                throw RED._('loop.errors.invalid-expr', {error: err.message});
            }
        }

        return property;
    }