@Override public File readFrom(final Class<File> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException { final File file = Utils.createTempFile(); final OutputStream stream = new BufferedOutputStream(new FileOutputStream(file)); try { writeTo(entityStream, stream); } finally { stream.close(); } return file; }
@Override public File readFrom(final Class<File> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException { final File file = Utils.createTempFile(); final OutputStream stream = new BufferedOutputStream(new FileOutputStream(file)); try { writeTo(entityStream, stream); } finally { stream.close(); } return file; }
@Override public File apply(ContainerRequest request) { final FormDataBodyPart part = getEntity(request).getField(name); final BodyPartEntity entity = part != null ? part.getEntityAs(BodyPartEntity.class) : null; if (entity != null) { try { // Create a temporary file. final File file = Utils.createTempFile(); // Move the part (represented either via stream or file) to the specific temporary file. entity.moveTo(file); return file; } catch (final IOException | MIMEParsingException cannotMove) { // Unable to create a temporary file or move the file. LOGGER.log(Level.WARNING, LocalizationMessages.CANNOT_INJECT_FILE(), cannotMove); } } return null; } }
@Override public File readFrom(final Class<File> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException { final File file = Utils.createTempFile(); final OutputStream stream = new BufferedOutputStream(new FileOutputStream(file)); try { writeTo(entityStream, stream); } finally { stream.close(); } return file; }
@Override public File readFrom(final Class<File> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException { final File file = Utils.createTempFile(); final OutputStream stream = new BufferedOutputStream(new FileOutputStream(file)); try { writeTo(entityStream, stream); } finally { stream.close(); } return file; }
@Override public File readFrom(final Class<File> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException { final File file = Utils.createTempFile(); final OutputStream stream = new BufferedOutputStream(new FileOutputStream(file)); try { writeTo(entityStream, stream); } finally { stream.close(); } return file; }
@Override public File readFrom(final Class<File> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException { final File file = Utils.createTempFile(); final OutputStream stream = new BufferedOutputStream(new FileOutputStream(file)); try { writeTo(entityStream, stream); } finally { stream.close(); } return file; }
@Override public File readFrom(final Class<File> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException { final File file = Utils.createTempFile(); final OutputStream stream = new BufferedOutputStream(new FileOutputStream(file)); try { writeTo(entityStream, stream); } finally { stream.close(); } return file; }
@Override public File apply(ContainerRequest request) { final FormDataBodyPart part = getEntity(request).getField(name); final BodyPartEntity entity = part != null ? part.getEntityAs(BodyPartEntity.class) : null; if (entity != null) { try { // Create a temporary file. final File file = Utils.createTempFile(); // Move the part (represented either via stream or file) to the specific temporary file. entity.moveTo(file); return file; } catch (final IOException | MIMEParsingException cannotMove) { // Unable to create a temporary file or move the file. LOGGER.log(Level.WARNING, LocalizationMessages.CANNOT_INJECT_FILE(), cannotMove); } } return null; } }
@Override public File provide() { final FormDataBodyPart part = getEntity().getField(name); final BodyPartEntity entity = part != null ? part.getEntityAs(BodyPartEntity.class) : null; if (entity != null) { try { // Create a temporary file. final File file = Utils.createTempFile(); // Move the part (represented either via stream or file) to the specific temporary file. entity.moveTo(file); return file; } catch (final IOException | MIMEParsingException cannotMove) { // Unable to create a temporary file or move the file. LOGGER.log(Level.WARNING, LocalizationMessages.CANNOT_INJECT_FILE(), cannotMove); } } return null; } }
@Override public File provide() { final FormDataBodyPart part = getEntity().getField(name); final BodyPartEntity entity = part != null ? part.getEntityAs(BodyPartEntity.class) : null; if (entity != null) { try { // Create a temporary file. final File file = Utils.createTempFile(); // Move the part (represented either via stream or file) to the specific temporary file. entity.moveTo(file); return file; } catch (final IOException | MIMEParsingException cannotMove) { // Unable to create a temporary file or move the file. LOGGER.log(Level.WARNING, LocalizationMessages.CANNOT_INJECT_FILE(), cannotMove); } } return null; } }
@Override public File provide() { final FormDataBodyPart part = getEntity().getField(name); final BodyPartEntity entity = part != null ? part.getEntityAs(BodyPartEntity.class) : null; if (entity != null) { try { // Create a temporary file. final File file = Utils.createTempFile(); // Move the part (represented either via stream or file) to the specific temporary file. entity.moveTo(file); return file; } catch (final IOException | MIMEParsingException cannotMove) { // Unable to create a temporary file or move the file. LOGGER.log(Level.WARNING, LocalizationMessages.CANNOT_INJECT_FILE(), cannotMove); } } return null; } }