Transform a mapbox geocoder response on a object friendly with our search widget.
@param {object} rawMapboxResponse - The raw mapbox geocoding response, {@see https://www.mapbox.com/api-documentation/?language=JavaScript#response-object}
487854
function _formatResponse (rawMapboxResponse) {
  if (!rawMapboxResponse.features.length) {
    return [];
  }
  return [{
    boundingbox: _getBoundingBox(rawMapboxResponse.features[0]),
    center: _getCenter(rawMapboxResponse.features[0]),
    type: _getType(rawMapboxResponse.features[0])
  }];
}
793027
function onData(rawData){

        // strip delimiter sequence from array
        const input = rawData.toString(_encoding);

        // response data object - default no response data
        const data = {
            echo: input,
            response: null
        };

        // response found ? split echo and response
        const splitIndex = input.indexOf('\n');
        if (splitIndex > 0){
            data.echo = input.substr(0, splitIndex).trim();
            data.response = input.substr(splitIndex + 1).trim();
        }

        // process waiting for input ?
        if (_waitingForInput !== null){
            const resolver = _waitingForInput;
            _waitingForInput = null;
            resolver(data);
        }else{
            _inputbuffer.push(data);
        }
    }
1255720
function sendStatus(code, res){
	try{
		if (httpCodeMapping) {
			code = mapHttpStatusCode(code);
		}
		addStrictTransportHeaders(res);
		setResponseNoCache(res);
		return res.sendStatus(code);
	}catch(err){
		logger.error(res.req.originalUrl , err.message);
		throw err;
	}
}
382582
function (thisObj) {
			thisObj.writeDebug('reverseGoogleGeocode',arguments);
			var geocoder = new google.maps.Geocoder();
			this.geocode = function (request, callbackFunction) {
				geocoder.geocode(request, function (results, status) {
					if (status === google.maps.GeocoderStatus.OK) {
						if (results[0]) {
							var result = {};
							result.address = results[0].formatted_address;
							callbackFunction(result);
						}
					} else {
						callbackFunction(null);
						throw new Error('Reverse geocode was not successful for the following reason: ' + status);
					}
				});
			};
		}
378378
public static function createFromRaw($rawResponse, Response $parentResponse = null)
    {
        /** @var Response $response */
        $response = ResponseInformationHelper::createFromRaw($rawResponse, self::class);
        $response->parentResponse = $parentResponse;

        return $response;
    }
1242878
private static Response createResponse(Object object, AlluxioConfiguration alluxioConf,
      @Nullable Map<String, Object> headers) {
    if (object instanceof Void) {
      return Response.ok().build();
    }
    if (object instanceof String) {
      // Need to explicitly encode the string as JSON because Jackson will not do it automatically.
      ObjectMapper mapper = new ObjectMapper();
      try {
        return Response.ok(mapper.writeValueAsString(object)).build();
      } catch (JsonProcessingException e) {
        return createErrorResponse(e, alluxioConf);
      }
    }

    Response.ResponseBuilder rb = Response.ok(object);
    if (headers != null) {
      headers.forEach(rb::header);
    }

    if (alluxioConf.getBoolean(PropertyKey.WEBUI_CORS_ENABLED)) {
      return makeCORS(rb).build();
    }

    return rb.build();
  }
889483
protected function mapResponse($rawResponse, BaseBuilder $builder, $request)
    {
        $result = new Transaction();

        // TODO: handle non-200 responses

        $root = $this->xml2object($rawResponse)->{'Ver1.0'};
        $acceptedCodes = ['00', '0', '85', '10'];

        $gatewayRspCode = $this->normalizeResponse((string)$root->Header->GatewayRspCode);
        $gatewayRspText = (string)$root->Header->GatewayRspMsg;

        if (!in_array($gatewayRspCode, $acceptedCodes)) {
            throw new GatewayException(
                sprintf(
                    'Unexpected Gateway Response: %s - %s. ',
                    $gatewayRspCode,
                    $gatewayRspText
                )
            );
        }

        $item = $root->Transaction->{$this->mapRequestType($builder)};

        $result->responseCode = isset($item) && isset($item->RspCode)
            ? $this->normalizeResponse((string)$item->RspCode)
            : $gatewayRspCode;
        $result->responseMessage = isset($item) && isset($item->RspText)
            ? (string)$item->RspText
            : $gatewayRspText;

        if (isset($item) && isset($item->AuthAmt)) {
            $result->authorizedAmount = (string)$item->AuthAmt;
        }

        if (isset($item) && isset($item->AvailableBalance)) {
            $result->availableBalance = (string)$item->AvailableBalance;
        }

        if (isset($item) && isset($item->AVSRsltCode)) {
            $result->avsResponseCode = (string)$item->AVSRsltCode;
        }

        if (isset($item) && isset($item->AVSRsltText)) {
            $result->avsResponseMessage = (string)$item->AVSRsltText;
        }

        if (isset($item) && isset($item->BalanceAmt)) {
            $result->balanceAmount = (string)$item->BalanceAmt;
        }

        if (isset($item) && isset($item->CardType)) {
            $result->cardType = (string)$item->CardType;
        }

        if (isset($item) && isset($item->CardLast4)) {
            $result->cardLast4 = (string)$item->TokenPANLast4;
        }

        if (isset($item) && isset($item->CAVVResultCode)) {
            $result->cavvResponseCode = (string)$item->CAVVResultCode;
        }

        if (isset($item) && isset($item->CPCInd)) {
            $result->commercialIndicator = (string)$item->CPCInd;
        }

        if (isset($item) && isset($item->CVVRsltCode)) {
            $result->cvnResponseCode = (string)$item->CVVRsltCode;
        }

        if (isset($item) && isset($item->CVVRsltText)) {
            $result->cvnResponseMessage = (string)$item->CVVRsltText;
        }

        if (isset($item) && isset($item->EMVIssuerResp)) {
            $result->emvIssuerResponse = (string)$item->EMVIssuerResp;
        }

        if (isset($item) && isset($item->PointsBalanceAmt)) {
            $result->pointsBalanceAmount = (string)$item->PointsBalanceAmt;
        }

        if (isset($item) && isset($item->RecurringDataCode)) {
            $result->recurringDataCode = (string)$item->RecurringDataCode;
        }

        if (isset($item) && isset($item->RefNbr)) {
            $result->referenceNumber = (string)$item->RefNbr;
        }

        if (isset($item) && isset($item->TxnDescriptor)) {
            $result->transactionDescriptor = (string)$item->TxnDescriptor;
        }

        if ($builder->paymentMethod !== null) {
            $result->transactionReference = new TransactionReference();
            $result->transactionReference->transactionId = (string)$root->Header->GatewayTxnId;
            $result->transactionReference->paymentMethodType = $builder->paymentMethod->paymentMethodType;

            if (isset($item) && isset($item->AuthCode)) {
                $result->transactionReference->authCode = (string)$item->AuthCode;
            }
        }

        if (isset($item) && isset($item->CardData)) {
            $result->giftCard = new GiftCard();
            $result->giftCard->number = (string)$item->CardData->CardNbr;
            $result->giftCard->alias = (string)$item->CardData->Alias;
            $result->giftCard->pin = (string)$item->CardData->PIN;
        }

        if (isset($root->Header->TokenData) && isset($root->Header->TokenData->TokenValue)) {
            $result->token = (string)$root->Header->TokenData->TokenValue;
        }

        if (isset($item) && isset($item->BatchId)) {
            $result->batchSummary = new BatchSummary();
            $result->batchSummary->id = (string)$item->BatchId;
            $result->batchSummary->transactionCount = (string)$item->TxnCnt;
            $result->batchSummary->totalAmount = (string)$item->TotalAmt;
            $result->batchSummary->sequenceNumber = (string)$item->BatchSeqNbr;
        }

        return $result;
    }
68790
public void setResponse(Map<String, Object> headers) {
        int size = RES_200.length;
        byte[] len = stringToBytes(String.valueOf(0));
        size += CONTENT_LENGTH.length;
        size += len.length;
        size += TextCommandConstants.RETURN.length;
        if (headers != null) {
            for (Map.Entry<String, Object> entry : headers.entrySet()) {
                size += stringToBytes(HEADER_CUSTOM_PREFIX + entry.getKey() + ": ").length;
                size += stringToBytes(entry.getValue().toString()).length;
                size += TextCommandConstants.RETURN.length;
            }
        }
        size += TextCommandConstants.RETURN.length;
        this.response = ByteBuffer.allocate(size);
        response.put(RES_200);
        response.put(CONTENT_LENGTH);
        response.put(len);
        response.put(TextCommandConstants.RETURN);
        if (headers != null) {
            for (Map.Entry<String, Object> entry : headers.entrySet()) {
                response.put(stringToBytes(HEADER_CUSTOM_PREFIX + entry.getKey() + ": "));
                response.put(stringToBytes(entry.getValue().toString()));
                response.put(TextCommandConstants.RETURN);
            }
        }
        response.put(TextCommandConstants.RETURN);
        response.flip();
    }
44864
protected Map<String, Object> parseResponseObject(Response response) throws IOException {
		return parseResponse(response).parseObject();
	}
1013125
function() {
		if(inputEx.MapFieldsNumber == undefined) { inputEx.MapFieldsNumber = -1; }
		inputEx.MapFieldsNumber += 1;

		this.apid = this.virtualearth;
		if (this.options.api == "virtualearth") {
			this.apid = this.virtualearth;
		} else if (this.options.api == "google") {
			this.apid = this.google;
		} else if (this.options.api == "yahoo") {
			this.apid = this.yahoo;
		} else {
			alert("unknown API '" + this.options.api + "': using 'virtualearth'");
		}

		var id = "inputEx-MapField-"+inputEx.MapFieldsNumber;
		var idWrapper = "inputEx-MapFieldWrapper-"+inputEx.MapFieldsNumber;
		var idLat = "inputEx-MapFieldLat-"+inputEx.MapFieldsNumber;
		var idLon = "inputEx-MapFieldLon-"+inputEx.MapFieldsNumber;
		var idUZoom = "inputEx-MapFieldUZoom-"+inputEx.MapFieldsNumber;
		var idNZoom = "inputEx-MapFieldNZoom-"+inputEx.MapFieldsNumber;

		// the wrapper is needed for Virtual Earth
		this.elWrapper = inputEx.cn('div',
			{ id: idWrapper, style: "width: " + this.options.width + "; height: " + this.options.height },
			null,
			null
		);
		this.fieldContainer.appendChild(this.elWrapper);

		this.el = inputEx.cn('div',
			{ id: id, style: "position: relative; width: " + this.options.width + "; height: " + this.options.height },
			null,
			this.options.loading
		);
		this.elWrapper.appendChild(this.el);

		this.elLat = inputEx.cn('input', { id: idLat, type: "hidden", value: this.options.lat });
		this.fieldContainer.appendChild(this.elLat);

		this.elLon = inputEx.cn('input', { id: idLon, type: "hidden", value: this.options.lon });
		this.fieldContainer.appendChild(this.elLon);

		this.elUZoom = inputEx.cn('input', { id: idUZoom, type: "hidden", value: this.options.uzoom });
		this.fieldContainer.appendChild(this.elUZoom);

		this.elNZoom = inputEx.cn('input', { id: idNZoom, type: "hidden", value: this.options.uzoom });
		this.fieldContainer.appendChild(this.elNZoom);

		if (this.apid.preload(this)) {
			return;
		} else {
			this.wait_create();
		}
	}
1193671
function formatResponse (res) {
    // iterate over rows in response
    _.each(res, row => {
        // iterate over key/value pairs in row object
        _.each(row, (val, key) => {
            // convert nulls to undefined
            if (val === null) {
                row[key] = undefined
            }
        })
    })
}
168705
public static GeocodingApiRequest geocode(GeoApiContext context, String address) {
    GeocodingApiRequest request = new GeocodingApiRequest(context);
    request.address(address);
    return request;
  }
249205
def render_to_response(self, context, **response_kwargs):
        
        serializer = GeoJSONSerializer()
        response = self.response_class(**response_kwargs)
        queryset = self.get_queryset()

        options = dict(properties=self.properties,
                       precision=self.precision,
                       simplify=self.simplify,
                       srid=self.srid,
                       geometry_field=self.geometry_field,
                       force2d=self.force2d,
                       bbox=self.bbox,
                       bbox_auto=self.bbox_auto,
                       use_natural_keys=self.use_natural_keys,
                       with_modelname=self.with_modelname)
        serializer.serialize(queryset, stream=response, ensure_ascii=False,
                             **options)
        return response
431617
function TomTomGeocoder(httpAdapter, options) {

  TomTomGeocoder.super_.call(this, httpAdapter, options);

  if (!this.options.apiKey || this.options.apiKey == 'undefined') {
    throw new Error('You must specify an apiKey');
  }
}
386995
function VirtualEarthGeocoder(httpAdapter, options) {

  VirtualEarthGeocoder.super_.call(this, httpAdapter, options);

  if (!this.options.apiKey || this.options.apiKey == 'undefined') {
    throw new Error('You must specify an apiKey');
  }
}
1224871
function parse(rawResponse) {
  try {
    if (rawResponse) {
      return JSON.parse(rawResponse);
    }
  } catch (ex) {
    utils.logError('pulsepointLite.safeParse', 'ERROR', ex);
  }
  return null;
}
1202702
function geocode(point, options, _callback, _errorCallback) {
  let promise;
  let cb_resolve, cb_reject;

  var addr = settings.GEOCODEHOST;
  addr += "?point=" + +point[0] + "," + +point[1];

  if (typeof options == "function") {
    _errorCallback = _callback;
    _callback = options;
    options = {};
  }

  options = {
    lang: "en",
    seq: 0,
    ...(options || {})
  };

  if (options.seq) {
    addr += "&seq=" + +options.seq;
  }
  if (options.lang) {
    addr += "&lng=" + options.lang;
  }

  if (typeof Promise != "undefined") {
    promise = new Promise((resolve, reject) => {
      cb_resolve = resolve;
      cb_reject = reject;
    });
  } else {
    cb_resolve = cb_reject = () => {};
  }

  const callback = geojson => {
    cb_resolve(geojson);
    _callback && _callback(geojson);
  };

  const errorCallback = geojson => {
    cb_reject(geojson);
    _errorCallback && _errorCallback(geojson);
  };

  settings.load(addr, json => callback(json), err => errorCallback(err));

  return promise;
}