}
}
private Form switchUrlEncoding(final ContainerRequest request, final Form otherForm) {
final Set<Map.Entry<String, List<String>>> entries = otherForm.asMap().entrySet();
Form newForm = new Form();
for (Map.Entry<String, List<String>> entry : entries) {
final String charsetName = ReaderWriter.getCharset(MediaType.valueOf(
request.getHeaderString(HttpHeaders.CONTENT_TYPE))).name();
String key;
try {
key = decode ? URLDecoder.decode(entry.getKey(), charsetName) : URLEncoder.encode(entry.getKey(),
charsetName);
for (String value : entry.getValue()) {
newForm.asMap().add(key, decode ? URLDecoder.decode(value, charsetName) : URLEncoder.encode(value,
charsetName));
}
} catch (UnsupportedEncodingException uee) {
throw new ProcessingException(LocalizationMessages.ERROR_UNSUPPORTED_ENCODING(charsetName,