Splits a <code>application/x-www-form-urlencoded</code> response
@param response the response
@return the key-value pairs
174502
private static Map<String, String> splitResponse(String response) {
		String[] params = response.split("&");
		Map<String, String> result = new HashMap<>(params.length);
		for (String p : params) {
			String[] kv = p.split("=");
			result.put(PercentEncoding.decode(kv[0]), PercentEncoding.decode(kv[1]));
		}
		return result;
	}
324768
private String clientResponseToString(ClientResponse response) {
        if (response == null) {
            return null;
        }
        StringBuilder builder = new StringBuilder();
        builder.append("[status: ").append(response.getStatus());
        builder.append(", media type: ").append(response.getType());
        if (response.getStatus() != 404) {
            try {
                String responseBody = response.getEntity(String.class);
                if (responseBody != null) {
                    builder.append(", response body: ").append(responseBody);
                }
            } catch (RuntimeException ignore) {
                // Ignore if there is no response body, or IO error - it may have already been read in certain scenario.
            }
        }
        builder.append(", response headers: ").append(response.getHeaders());
        builder.append("]");
        return builder.toString();
    }
1186839
public static String getResponseAsString(String uri, String charsetName) {
        return HttpRequester.getResponseAsString(uri, charsetName);
    }
1180006
public static void makeStringResponse(HttpResponse response, String s) {
        StringEntity entity = new StringEntity(s, ContentType.TEXT_PLAIN);
        entity.setContentEncoding("utf-8");
        response.setEntity(entity);
    }
1308953
public Map<String, String> split(final CharSequence source) {
    java.util.Objects.requireNonNull(source, "source");
    Map<String, String> parameters = new HashMap<>();
    Iterator<String> i = new StringIterator(source, pairSeparator);
    while (i.hasNext()) {
      String keyValue = i.next();

      int keyValueSeparatorPosition = keyValueSeparatorStart(keyValue);
      if (keyValueSeparatorPosition == 0 || keyValue.length() == 0) {
        continue;
      }
      if (keyValueSeparatorPosition < 0) {
        parameters.put(keyValue, null);
        continue;
      }
      int keyStart = 0;
      int keyEnd = keyValueSeparatorPosition;

      while (keyStart < keyEnd && keyTrimMatcher.matches(keyValue.charAt(keyStart))) {
        keyStart++;
      }
      while (keyStart < keyEnd && keyTrimMatcher.matches(keyValue.charAt(keyEnd - 1))) {
        keyEnd--;
      }

      int valueStart = keyValueSeparatorPosition + keyValueSeparator.length();
      int valueEnd = keyValue.length();

      while (valueStart < valueEnd && valueTrimMatcher.matches(keyValue.charAt(valueStart))) {
        valueStart++;
      }
      while (valueStart < valueEnd && valueTrimMatcher.matches(keyValue.charAt(valueEnd - 1))) {
        valueEnd--;
      }

      String key = keyValue.substring(keyStart, keyEnd);
      String value = keyValue.substring(valueStart, valueEnd);
      parameters.put(key, value);
    }
    return parameters;
  }
379626
public static String urlEncode(String text)
    {
        String urlEncodedString=text;
        if(text!=null)
        {
            try
            {
                urlEncodedString=URLEncoder.encode(text,SpiUtil.UTF_8_ENCODING_NAME);
            }
            catch(UnsupportedEncodingException exception)
            {
                throw new FaxException("Error while URL encoding text.",exception);
            }
        }
        
        return urlEncodedString;
    }
886326
public static <T> GenericResponseBuilder<T> fromResponse(GenericResponse<T> response) {
    GenericResponseBuilder<T> builder =
        genericResponseBuilderFactory.create(response.getStatus(), response.body());

    for (String headerName : response.getHeaders().keySet()) {
      List<Object> headerValues = response.getHeaders().get(headerName);
      for (Object headerValue : headerValues) {
        builder.header(headerName, headerValue);
      }
    }
    return builder;
  }
667696
private static String[] decodeAuthAmqPlain(String response) {
        Logger logger = LoggerFactory.getLogger(SERVICE_AMQP_PROXY_LOGGER);
        
        String[] credentials = null;

        if ((response != null) && (response.trim().length() > 0)) {
            ByteBuffer buffer = ByteBuffer.wrap(response.getBytes());
            
            @SuppressWarnings("unused")
            String loginKey = getShortString(buffer);
            @SuppressWarnings("unused")
            AmqpType ltype = getType(buffer);
            String username = getLongString(buffer);
            
            @SuppressWarnings("unused")
            String passwordKey = getShortString(buffer);
            @SuppressWarnings("unused")
            AmqpType ptype = getType(buffer);
            String password = getLongString(buffer);

            if (logger.isDebugEnabled()) {
                String s = ".decodeAuthAmqPlain(): Username = " + username;
                logger.debug(CLASS_NAME + s);
            }

            credentials = new String[] { username, password };
        }
        
        return credentials;
    }
293438
@Override
    public Map<String, Object> getParameters(
            HttpServletRequest request, HttpServletResponse response) {
        final LocaleManager localeManager = this.getLocaleManager(request);

        final List<Locale> locales = localeManager.getLocales();
        if (locales != null && locales.size() > 0 && locales.get(0) != null) {
            final String locale = locales.get(0).toString();
            final String xslLocale = locale.replace('_', '-');
            this.logger.debug("Setting USER_LANG to {}", xslLocale);
            return Collections.singletonMap("USER_LANG", (Object) xslLocale);
        }

        return null;
    }
172696
def parse_encrypted_response(self, response):
        
        content_type = response.headers['Content-Type']
        if 'protocol="{0}"'.format(self.protocol_string.decode()) in content_type:
            host = urlsplit(response.request.url).hostname
            msg = self._decrypt_response(response, host)
        else:
            msg = response.text

        return msg
214636
public static byte[] serialize(Response response) {
    MiniMessagePack.Packer packer = new MiniMessagePack.Packer();
    packer.pack(VERSION);
    packer.pack(RESPONSE_MAGIC);
    packer.pack(response.getPayload());
    packer.pack(response.getSignature());
    return packer.getBytes();
  }
1250986
protected Token responseToToken(Map<String, String> response) {
		return new Token(response.get(OAUTH_TOKEN), response.get(OAUTH_TOKEN_SECRET));
	}
298598
public HttpClientResponseBuilder doReturn(int statusCode, String response) {
        return doReturn(statusCode, response, Charset.forName("UTF-8"));
    }
26977
public static String formatResponse(Response response) {
        if (response == null) {
            return "";
        }
        StringBuilder output = new StringBuilder();
        if (response.isData()) {
            output.append(DIV_I);
            Gson gson = new GsonBuilder().setPrettyPrinting().create();
            if (response.getArrayData() != null) {
                output.append(gson.toJson(response.getArrayData()));
            }
            if (response.getObjectData() != null) {
                output.append(gson.toJson(response.getObjectData()));
            }
            output.append(END_IDIV);
        }
        return formatHTML(output.toString());
    }
581760
private void saveCertificateFromResponse(Response response) {
        try {
            String responseBody = response.getResponseText();
            JSONObject jsonResponse = new JSONObject(responseBody);

            //handle certificate
            String certificateString = jsonResponse.getString("certificate");
            X509Certificate certificate = CertificatesUtility.base64StringToCertificate(certificateString);

            CertificatesUtility.checkValidityWithPublicKey(certificate, registrationKeyPair.getPublic());

            certificateStore.saveCertificate(registrationKeyPair, certificate);

            //save the clientId separately
            preferences.clientId.set(jsonResponse.getString("clientId"));

        } catch (Exception e) {
            throw new RuntimeException("Failed to save certificate from response", e);
        }

        logger.debug("certificate successfully saved");
    }
1113435
protected function splitResponseToHeadersArrayAndBody(string $response): HttpResponseInterface
    {
        //        $tmp = explode("\r\n\r\n", $response, 2);
        //        var_export($tmp);
        list($headers, $this->body) = explode("\r\n\r\n", $response, 2);

        $this->headers = $this->getHeaderArray($headers);

        return $this;
    }
64441
public void doGet(String url, HttpResponse response) {
        doGet(url, response, null, true);
    }