All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java-helidon.server.libraries.se.formParamsFunctions.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
private void processNonFileFormField(String name, Map> nonFileFormContent, ReadableBodyPart part) {
        List content = nonFileFormContent.computeIfAbsent(name, key -> new ArrayList<>());
        part.content().as(String.class).thenAccept(content::add);
    }

    private void processFileFormField(String name, Map> fileFormContent, ReadableBodyPart part) {
        List content = fileFormContent.computeIfAbsent(name, key -> new ArrayList<>());
        part.content().map(DataChunk::bytes)
            .collect(ByteArrayOutputStream::new, (stream, bytes) -> {
                try {
                    stream.write(bytes);
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
        })
        .thenAccept(byteStream -> content.add(new ByteArrayInputStream(byteStream.toByteArray())));
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy