public void setMultipartConfig(MultipartConfigElement multipartConfig) { if (!((Context) wrapper.getParent()).isStarting()) { throw new IllegalStateException(sm.getString ("servletRegistration.ise", ((Context) wrapper.getParent()).getPath())); } if (multipartConfig == null) { throw new IllegalArgumentException(sm.getString("servletRegistration.iae")); } Multipart multipart = new Multipart(); multipart.setLocation(multipartConfig.getLocation()); multipart.setMaxFileSize(multipartConfig.getMaxFileSize()); multipart.setMaxRequestSize(multipartConfig.getMaxRequestSize()); multipart.setFileSizeThreshold(multipartConfig.getFileSizeThreshold()); wrapper.setMultipartConfig(multipart); }
@Override public void write(String fileName) throws IOException { File file = new File(fileName); if (!file.isAbsolute()) { file = new File(config.getLocation(), fileName); } try { fileItem.write(file); } catch (Exception e) { throw new IOException(e); } }
if (config.getLocation() == null || config.getLocation().length() == 0) { location = ((File) context.getServletContext().getAttribute( ServletContext.TEMPDIR)); } else { location = new File(config.getLocation()); if (!location.isAbsolute()) { location = new File((File) context.getServletContext().getAttribute(ServletContext.TEMPDIR), config.getLocation()).getAbsoluteFile(); if (config.getFileSizeThreshold() > 0) { factory.setSizeThreshold(config.getFileSizeThreshold()); upload.setFileSizeMax(config.getMaxFileSize()); upload.setSizeMax(config.getMaxRequestSize());
}; // now create the multipart/mixed container to hold the message text and the
if (config.getLocation() != null) { factory.setRepository(new File(config.getLocation())); if (config.getFileSizeThreshold() > 0) { factory.setSizeThreshold(config.getFileSizeThreshold()); upload.setFileSizeMax(config.getMaxFileSize()); upload.setSizeMax(config.getMaxRequestSize());
Multipart multipart = new Multipart(); SupportedAttachmentPart attach = new SupportedAttachmentPart(multipart, "application/x-example", "test.txt", data);
public void setMultipartConfig(MultipartConfigElement multipartConfig) { if (!((Context) wrapper.getParent()).isStarting()) { throw MESSAGES.cannotAddServletRegistrationAfterInit(((Context) wrapper.getParent()).getPath()); } if (multipartConfig == null) { throw MESSAGES.invalidServletRegistrationArguments(); } Multipart multipart = new Multipart(); multipart.setLocation(multipartConfig.getLocation()); multipart.setMaxFileSize(multipartConfig.getMaxFileSize()); multipart.setMaxRequestSize(multipartConfig.getMaxRequestSize()); multipart.setFileSizeThreshold(multipartConfig.getFileSizeThreshold()); wrapper.setMultipartConfig(multipart); }
@Override public void write(String fileName) throws IOException { File file = new File(fileName); if (!file.isAbsolute()) { file = new File(config.getLocation(), fileName); } try { fileItem.write(file); } catch (Exception e) { throw new IOException(e); } }
Multipart multipartConfig = new Multipart(); multipartConfig.setLocation(multipartConfigMetaData.getLocation()); multipartConfig.setMaxRequestSize(multipartConfigMetaData.getMaxRequestSize()); multipartConfig.setMaxFileSize(multipartConfigMetaData.getMaxFileSize()); multipartConfig.setFileSizeThreshold(multipartConfigMetaData.getFileSizeThreshold()); wrapper.setMultipartConfig(multipartConfig);
Multipart multipartConfig = new Multipart(); multipartConfig.setLocation(multipartConfigMetaData.getLocation()); multipartConfig.setMaxRequestSize(multipartConfigMetaData.getMaxRequestSize()); multipartConfig.setMaxFileSize(multipartConfigMetaData.getMaxFileSize()); multipartConfig.setFileSizeThreshold(multipartConfigMetaData.getFileSizeThreshold()); wrapper.setMultipartConfig(multipartConfig);