If my multipart post is bigger than MultipartConfigElement.fileSizeThreshold, then my post is out of a temporary file. Undertow FileUtils read it so:
public static String readFile(InputStream file, Charset charSet) { try (BufferedInputStream stream = new BufferedInputStream(file)) { byte[] buff = new byte[1024]; StringBuilder builder = new StringBuilder(); int read; while ((read = stream.read(buff)) != -1) { builder.append(new String(buff, 0, read, charSet)); } return builder.toString(); } catch (IOException e) { throw new RuntimeException(e); } } If I understand this good, this code can cut in two slice one UTF-8 non-English character and concat it as two bad character.
támogat��s I have a á character and now two bad...
What is the best solution of this problem?
- Undertow jira ticket
- Increase treshold size?
- Leave multipart if it is possible (I think not)
Does somebody have any experience with this?
Thanks a lot. H.