public static java.util.Optional<File> file(final HttpServerExchange exchange, final String name) { return java.util.Optional.ofNullable(exchange.getAttachment(FormDataParser.FORM_DATA).get(name)).map(Deque::getFirst).map( fv -> fv.getFileItem().getFile().toFile()); }
public static File file(final HttpServerExchange exchange, final String name) throws java.lang.IllegalArgumentException { try { return exchange.getAttachment(FormDataParser.FORM_DATA).get(name).getFirst().getFileItem().getFile().toFile(); } catch(NullPointerException e) { throw new IllegalArgumentException("Missing parameter " + name, e); } }
public static java.util.Optional<Path> filePath(final HttpServerExchange exchange, final String name) { return java.util.Optional.ofNullable(exchange.getAttachment(FormDataParser.FORM_DATA).get(name)).map(Deque::getFirst).map( fv -> fv.getFileItem().getFile()); }
final Path path = formData.getFirst(fileField).getFileItem().getFile();
public static Path filePath(final HttpServerExchange exchange, final String name) throws java.lang.IllegalArgumentException { try { return exchange.getAttachment(FormDataParser.FORM_DATA).get(name).getFirst().getFileItem().getFile(); } catch(NullPointerException e) { throw new IllegalArgumentException("Missing parameter " + name, e); } }
@Override public Path getPath() { if (fileItem == null) { throw UndertowMessages.MESSAGES.formValueIsAString(); } if (fileItem.isInMemory()) { throw UndertowMessages.MESSAGES.formValueIsInMemoryFile(); } return fileItem.getFile(); }
@Override public Path getPath() { if (fileItem == null) { throw UndertowMessages.MESSAGES.formValueIsAString(); } if (fileItem.isInMemory()) { throw UndertowMessages.MESSAGES.formValueIsInMemoryFile(); } return fileItem.getFile(); }
@Override public Path getPath() { if (fileItem == null) { throw UndertowMessages.MESSAGES.formValueIsAString(); } if (fileItem.isInMemory()) { throw UndertowMessages.MESSAGES.formValueIsInMemoryFile(); } return fileItem.getFile(); }