JSON-ответ отключается, android
Проблема заключается в том, что ответ JSON от сервера отключается, и поэтому я получаю исключение JSONException при попытке получить ответ в JSONArray.
Мой запрос JSON:
http://10.75.4.41:8080/sc/test1?JSON={"requestType":37,"rideWebSocket":false,"spoof":false,"visitorDTO":{"dealerGuid":"Servest","iDTypeID":2,"image":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB\nAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEB\nAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAIIAYYDASIA\nAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA\nAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3\nODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm\np6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA\nAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx\nBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK\nU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3\nuLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+eOx0\npnMW2MomURgCyqQxZjuGA4IAJBKFgDtUgkmu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LeLRoYor2/tbaLXdN0m/hlnupE0y4drYxSwR6var5\ntm9ndv337HnglPhz8Hk8Ra7cW1hrnxr1O1t9Ggv7uCzI8JaWuorawWRuhEjXutNLd3kUUMxubi2v\nLB4YJJI1Rm4Rk1GPvqSg6krL3VzJRUWrqLenNe901o0pN+pl88ZlOBxGIlVqwr1ZQhQw1Ry958zc\nm6cm1CXKm3JrmSsrWdzT/Ze/4JWeC/i/pPh/w34mk8d3Hiq/t7rVNd1fwXDe6zbaJp0cE/lXP9ja\nd4f1a4l0yGYWdtdX1xGsUDzT3jz+VEbVuo+Kv/BIL4e/CXxXp2gaN+0XoHjewvIp7zV4vCoPiQ6F\nBa3dvH/Yeuaqln4dtbTWtSElxCtvp66hJphtpm1KOGZYIJvt/QNT+J3wuaHU/DM3jLwRJPYwQRaj\naLqujG9tNryRolzbi1FxaSIFmRf3sDqzSAnPmLS8Q+P9e8V67N4i8U6jqGr67f21jZ3Wp3n7y7vI\nbAXK2kcs5LSPHbtNKdrhipk3O7yySMe6nGiotKEZNRioyslKLV7XV0ldLVWveztd6+TLOcxdOr++\nre2lPnSclKnCLlL4FJaNJaKztquZNO/yB+0r+y7r3xP8KeDvDPgTxpoXgq08Fu09p59tqiPvhsob\nDSrW2k09XFhHaRLLEjYd23w7RGELP+TN38UP2vPhj4t1nwJafGT4map/wj+qXOkEaZ4v8U6xo802\nmNPbzfZYb64kR4rQQywzQm1VYNkkTRCNZK/c/w</
Что я уже пробовал:
private void previewCapturedImage() выбрасывает исключение IOException {
пробовать {
//imageFile = null;
viewImage.setVisibility(вид.ВИДИМЫЙ);
// фабрика bimatp
BitmapFactory.Options options = новый BitmapFactory.Опции();
// уменьшение размера изображения, поскольку оно выбрасывает исключение OutOfMemory для большего размера
// изображения
options.inSampleSize = 8;
окончательный растровое изображение растровое изображение = BitmapFactory.decodeFile(fileUri.getPath(), варианты);
ByteArrayOutputStream stream = новый ByteArrayOutputStream();
растрового изображения.компресс(растровое изображение.CompressFormat.JPEG, 100, поток);
imageFile = stream.toByteArray();
encodedImage = в base64.encodeToString(imageFile, в base64.По умолчанию);
viewImage.setImageBitmap(растровое изображение);
} catch (NullPointerException e) {
е.печатные();
}
}
Richard Deeming
Какое отношение этот неформатированный блок кода имеет к вашему вопросу?
Member 13509246
проблема в том, что когда я пытаюсь отправить изображение в БД, массив байтов отсекается от JSON, и я подумал, что, возможно, что-то не так с кодом, поэтому я включил его. я попытался преобразовать его байтовый массив в строку base64, строка все еще не завершена.
Вот мой url-адрес:
http://10.75.4.41:8080/sc/test1?JSON={"requestType":37,"rideWebSocket":false,"spoof":false,"visitorDTO":{"dealerGuid":"Servest","iDTypeID":2,"image":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB\nAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEB\nAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAIIAYYDASIA\nAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA\nAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3\nODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm\np6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA\nAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx\nBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK\nU1RVV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