Spring 使用 orbot 启动上传图像

Spring boot upload image using orbot

我们正在寻找使用 orbot 上传图片的解决方案。我们正在使用 Android 客户端来实现它,并使用服务器端 spring 启动。当我们上传图片(3 张或更多图片)时,即使图片已上传,我们也会在 Android 中出现套接字异常。

这是 Spring 的示例代码:

public @ResponseBody Response addAttachments(@ModelAttribute("atForm") AtForm atForm, @RequestHeader(value="ts", required=false) String ts) throws Exception {
Response res = new Respose();
    saveAttachments(atForm.getAtachments(), ts);
    return response;
}

private void saveAttachments(MultipartFile[] attachments, String ts) {
    if(attachments!=null && attachments.length > 0) {
        for(MultipartFile file : attachments){
            saveFile(file);
        }
    }
}

public String saveFile(MultipartFile mFile) throws IOException {
    File convFile = new File(PATH+mFile.getOriginalName());
    FileCopyUtils.copy(mFile.getBytes(), convFile);
    return fileName.toString();
}


经过几天的测试,我们发现这个问题与网络速度有关,并且在网络速度良好的情况下工作正常。所以 orbot 网络不能在慢速网络上工作。

谢谢,
操作