Convenience method for creating a new OutcomeResponse from a response
        object.
507991
def from_post_response(post_response, content):
        '''
        
        '''
        response = OutcomeResponse()
        response.post_response = post_response
        response.response_code = post_response.status
        response.process_xml(content)
        return response
415469
def from_response_data(cls, response_data):
        

        response_json = response_data.json()

        return cls(
            response_data.url,
            response_json["number_of_page_results"],
            response_json["number_of_total_results"],
            response_json["results"],
        )
267599
public static HttpResponse newResponse(RequestContext ctx, HttpStatus status,
                                           Throwable cause, String message) {
        requireNonNull(ctx, "ctx");
        requireNonNull(status, "status");
        requireNonNull(cause, "cause");
        requireNonNull(message, "message");

        return newResponse0(ctx, status, cause, message);
    }
1295227
function(request, response, next){
		if (utils.Misc.isEmptyObject(request.query)) {
			var errApp = new Error(errors['130']);
			response.end(utils.Misc.createResponse(null, errApp, 130));
		}
		else {
			next();
		}
	}
812841
def response_from_mixed(mixed):
    """"""

    # if none then give empty Response
    if mixed is None:
        return Response()

    # if not Response, then treat like body
    if not isinstance(mixed, Response):
        return Response(mixed)

    # it's already a Response
    return mixed
191846
private ObjectNode createResponseSuccess(String jsonRpc, Object id, JsonNode result) {
		ObjectNode response = mapper.createObjectNode();
		response.put(JSONRPC, jsonRpc);
		if (Integer.class.isInstance(id)) {
			response.put(ID, Integer.class.cast(id).intValue());
		} else if (Long.class.isInstance(id)) {
			response.put(ID, Long.class.cast(id).longValue());
		} else if (Float.class.isInstance(id)) {
			response.put(ID, Float.class.cast(id).floatValue());
		} else if (Double.class.isInstance(id)) {
			response.put(ID, Double.class.cast(id).doubleValue());
		} else if (BigDecimal.class.isInstance(id)) {
			response.put(ID, BigDecimal.class.cast(id));
		} else {
			response.put(ID, String.class.cast(id));
		}
		response.set(RESULT, result);
		return response;
	}
498422
public HttpClientResponseBuilder doReturn(String response, Charset charset) {
        newRule.addAction(new StringResponse(response, charset));
        return new HttpClientResponseBuilder(newRule);
    }
245792
def build_final_response(request, meta, result, menu, hproject, proxyMode, context):
    """"""

    if 'no_template' in meta and meta['no_template']:  # Just send the json back
        return HttpResponse(result)

    # TODO this breaks pages not using new template
    # Add sidebar toggler if plugit did not add by itself
    # if not "sidebar-toggler" in result:
    #     result = "<div class=\"menubar\"><div class=\"sidebar-toggler visible-xs\"><i class=\"ion-navicon\"></i></div></div>" + result

    # render the template into the whole page
    if not settings.PIAPI_STANDALONE:
        return render_to_response('plugIt/' + hproject.get_plugItTemplate_display(),
                                  {"project": hproject,
                                   "plugit_content": result,
                                   "plugit_menu": menu,
                                   'context': context},
                                  context_instance=RequestContext(request))

    if proxyMode:  # Force inclusion inside template
        return render_to_response('plugIt/base.html',
                                  {'plugit_content': result,
                                   "plugit_menu": menu,
                                   'context': context},
                                  context_instance=RequestContext(request))

    renderPlugItTemplate = 'plugItBase.html'
    if settings.PIAPI_PLUGITTEMPLATE:
        renderPlugItTemplate = settings.PIAPI_PLUGITTEMPLATE

    return render_to_response('plugIt/' + renderPlugItTemplate,
                              {"plugit_content": result,
                               "plugit_menu": menu,
                               'context': context},
                              context_instance=RequestContext(request))
1373438
def create_response(request, body=None, status=None, headers=None):
    # type: (BaseHttpRequest, Any, HTTPStatus, dict) -> HttpResponse
    
    if body is None:
        return HttpResponse(None, status or HTTPStatus.NO_CONTENT, headers)
    else:
        body = request.response_codec.dumps(body)
        response = HttpResponse(body, status or HTTPStatus.OK, headers)
        response.set_content_type(request.response_codec.CONTENT_TYPE)
        return response
438811
private void createResponse() {
        response = new GenericAnalyticsResponse(
                queryErrorObservable.onBackpressureBuffer(),
                queryRowObservable.onBackpressureBuffer(),
                querySignatureObservable.onBackpressureBuffer(),
                queryStatusObservable.onBackpressureBuffer(),
                queryInfoObservable.onBackpressureBuffer(),
                handle,
                currentRequest,
                status,
                requestID,
                clientContextID
        );
    }
1147817
def success_response(field=None, data=None, request_type=""):
    """"""
    data_out = {}
    data_out["status"] = "success"
    if field:
        data_out[field] = data
    print("{} request successful.".format(request_type))
    js = dumps(data_out, default=date_handler)
    return Response(js, status=200, mimetype='application/json')
963211
def _result_handler(self, response: Dict[str, Any]):
        
        res = response.get("MESSAGE")
        result = res.get("RESULT")
        return result
162907
public static void returnObjectResponse(HttpServletResponse response, Object obj) {
		if (response == null) {
			return;
		}
		PrintWriter out = null;
		try {
			response.setStatus(HttpServletResponse.SC_OK);
			response.setContentType(MediaType.APPLICATION_JSON);
			out = response.getWriter();
			ParaObjectUtils.getJsonWriter().writeValue(out, obj);
		} catch (Exception ex) {
			logger.error(null, ex);
		} finally {
			if (out != null) {
				out.close();
			}
		}
	}
410510
def create_response response
      json = JSON.parse(response.body_str)
      if json.is_a?(Array)
        result = json.map {|result| Fulfil::Base.new(result)}
      else
        result = Fulfil::Base.new(json)
        if result.type == "UserError"
          raise Fulfil::UserError, result.message
        end
      end
      result
    end
1165544
def make_response(status, headers, payload, environ):
    
    return Response(body=payload, status=int(status.split()[0]),
                    headers=headers)
472145
def _create_response(self, datapath, port, req):
        """"""
        src = datapath.ports[port].hw_addr
        res_ether = ethernet.ethernet(
            slow.SLOW_PROTOCOL_MULTICAST, src, ether.ETH_TYPE_SLOW)
        res_lacp = self._create_lacp(datapath, port, req)
        res_pkt = packet.Packet()
        res_pkt.add_protocol(res_ether)
        res_pkt.add_protocol(res_lacp)
        res_pkt.serialize()
        return res_pkt
516236
def setResponse(self, response):
        
        self.response = response
        self.result = self.response.body

        if isinstance(self.result, remoting.ErrorFault):
            self.result.raiseException()