/** * Accepts constructor injection of the configuration parameters for this * application. */ public MultiPartReaderClientSide(@Context final Providers providers) { final ContextResolver<MultiPartProperties> contextResolver = providers.getContextResolver(MultiPartProperties.class, MediaType.WILDCARD_TYPE); MultiPartProperties properties = null; if (contextResolver != null) { properties = contextResolver.getContext(this.getClass()); } if (properties == null) { properties = new MultiPartProperties(); } mimeConfig = createMimeConfig(properties); }
/** * Load and customize (if necessary) the configuration values for the * {@code jersey-multipart} injection binder. * * @throws IllegalArgumentException if the configuration resource * exists, but there are problems reading it */ public MultiPartProperties() { configure(); }
private MIMEConfig createMimeConfig(final MultiPartProperties properties) { final MIMEConfig mimeConfig = new MIMEConfig(); // Set values defined by user. mimeConfig.setMemoryThreshold(properties.getBufferThreshold()); final String tempDir = properties.getTempDir(); if (tempDir != null) { mimeConfig.setDir(tempDir); } if (properties.getBufferThreshold() != MultiPartProperties.BUFFER_THRESHOLD_MEMORY_ONLY) { // Validate - this checks whether it's possible to create temp files in currently set temp directory. try { //noinspection ResultOfMethodCallIgnored File.createTempFile("MIME", null, tempDir != null ? new File(tempDir) : null).delete(); } catch (final IOException ioe) { LOGGER.log(Level.WARNING, LocalizationMessages.TEMP_FILE_CANNOT_BE_CREATED(properties.getBufferThreshold()), ioe); } } return mimeConfig; }
private MIMEConfig createMimeConfig(final MultiPartProperties properties) { final MIMEConfig mimeConfig = new MIMEConfig(); // Set values defined by user. mimeConfig.setMemoryThreshold(properties.getBufferThreshold()); final String tempDir = properties.getTempDir(); if (tempDir != null) { mimeConfig.setDir(tempDir); } if (properties.getBufferThreshold() != MultiPartProperties.BUFFER_THRESHOLD_MEMORY_ONLY) { // Validate - this checks whether it's possible to create temp files in currently set temp directory. try { //noinspection ResultOfMethodCallIgnored File.createTempFile("MIME", null, tempDir != null ? new File(tempDir) : null).delete(); } catch (final IOException ioe) { LOGGER.log(Level.WARNING, LocalizationMessages.TEMP_FILE_CANNOT_BE_CREATED(properties.getBufferThreshold()), ioe); } } return mimeConfig; }
/** * Load and customize (if necessary) the configuration values for the * {@code jersey-multipart} injection binder. * * @throws IllegalArgumentException if the configuration resource * exists, but there are problems reading it */ public MultiPartProperties() { configure(); }
/** * Accepts constructor injection of the configuration parameters for this * application. */ public MultiPartReaderClientSide(@Context final Providers providers) { final ContextResolver<MultiPartProperties> contextResolver = providers.getContextResolver(MultiPartProperties.class, MediaType.WILDCARD_TYPE); MultiPartProperties properties = null; if (contextResolver != null) { properties = contextResolver.getContext(this.getClass()); } if (properties == null) { properties = new MultiPartProperties(); } mimeConfig = createMimeConfig(properties); }
private MIMEConfig createMimeConfig(final MultiPartProperties properties) { final MIMEConfig mimeConfig = new MIMEConfig(); // Set values defined by user. mimeConfig.setMemoryThreshold(properties.getBufferThreshold()); final String tempDir = properties.getTempDir(); if (tempDir != null) { mimeConfig.setDir(tempDir); } if (properties.getBufferThreshold() != MultiPartProperties.BUFFER_THRESHOLD_MEMORY_ONLY) { // Validate - this checks whether it's possible to create temp files in currently set temp directory. try { //noinspection ResultOfMethodCallIgnored File.createTempFile("MIME", null, tempDir != null ? new File(tempDir) : null).delete(); } catch (final IOException ioe) { LOGGER.log(Level.WARNING, LocalizationMessages.TEMP_FILE_CANNOT_BE_CREATED(properties.getBufferThreshold()), ioe); } } return mimeConfig; }
/** * Load and customize (if necessary) the configuration values for the * {@code jersey-multipart} injection binder. * * @throws IllegalArgumentException if the configuration resource * exists, but there are problems reading it */ public MultiPartProperties() { configure(); }
/** * Accepts constructor injection of the configuration parameters for this * application. */ public MultiPartReaderClientSide(@Context final Providers providers) { final ContextResolver<MultiPartProperties> contextResolver = providers.getContextResolver(MultiPartProperties.class, MediaType.WILDCARD_TYPE); MultiPartProperties properties = null; if (contextResolver != null) { properties = contextResolver.getContext(this.getClass()); } if (properties == null) { properties = new MultiPartProperties(); } mimeConfig = createMimeConfig(properties); }
private MIMEConfig createMimeConfig(final MultiPartProperties properties) { final MIMEConfig mimeConfig = new MIMEConfig(); // Set values defined by user. mimeConfig.setMemoryThreshold(properties.getBufferThreshold()); final String tempDir = properties.getTempDir(); if (tempDir != null) { mimeConfig.setDir(tempDir); } if (properties.getBufferThreshold() != MultiPartProperties.BUFFER_THRESHOLD_MEMORY_ONLY) { // Validate - this checks whether it's possible to create temp files in currently set temp directory. try { //noinspection ResultOfMethodCallIgnored File.createTempFile("MIME", null, tempDir != null ? new File(tempDir) : null).delete(); } catch (final IOException ioe) { LOGGER.log(Level.WARNING, LocalizationMessages.TEMP_FILE_CANNOT_BE_CREATED(properties.getBufferThreshold()), ioe); } } return mimeConfig; }
/** * Load and customize (if necessary) the configuration values for the * {@code jersey-multipart} injection binder. * * @throws IllegalArgumentException if the configuration resource * exists, but there are problems reading it */ public MultiPartProperties() { configure(); }
/** * Accepts constructor injection of the configuration parameters for this * application. */ public MultiPartReaderClientSide(@Context final Providers providers) { final ContextResolver<MultiPartProperties> contextResolver = providers.getContextResolver(MultiPartProperties.class, MediaType.WILDCARD_TYPE); MultiPartProperties properties = null; if (contextResolver != null) { properties = contextResolver.getContext(this.getClass()); } if (properties == null) { properties = new MultiPartProperties(); } mimeConfig = createMimeConfig(properties); }
private MIMEConfig createMimeConfig(final MultiPartProperties properties) { final MIMEConfig mimeConfig = new MIMEConfig(); // Set values defined by user. mimeConfig.setMemoryThreshold(properties.getBufferThreshold()); final String tempDir = properties.getTempDir(); if (tempDir != null) { mimeConfig.setDir(tempDir); } if (properties.getBufferThreshold() != MultiPartProperties.BUFFER_THRESHOLD_MEMORY_ONLY) { // Validate - this checks whether it's possible to create temp files in currently set temp directory. try { //noinspection ResultOfMethodCallIgnored File.createTempFile("MIME", null, tempDir != null ? new File(tempDir) : null).delete(); } catch (final IOException ioe) { LOGGER.log(Level.WARNING, LocalizationMessages.TEMP_FILE_CANNOT_BE_CREATED(properties.getBufferThreshold()), ioe); } } return mimeConfig; }
/** * Load and customize (if necessary) the configuration values for the * {@code jersey-multipart} injection binder. * * @throws IllegalArgumentException if the configuration resource * exists, but there are problems reading it */ public MultiPartProperties() { configure(); }
/** * Accepts constructor injection of the configuration parameters for this * application. */ public MultiPartReaderClientSide(@Context final Providers providers) { final ContextResolver<MultiPartProperties> contextResolver = providers.getContextResolver(MultiPartProperties.class, MediaType.WILDCARD_TYPE); MultiPartProperties properties = null; if (contextResolver != null) { properties = contextResolver.getContext(this.getClass()); } if (properties == null) { properties = new MultiPartProperties(); } mimeConfig = createMimeConfig(properties); }