use of me.desair.tus.server.TusFileUploadService in project servoy-client by Servoy.
the class TusServlet method init.
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
Settings settings = Settings.getInstance();
String uploadDir = settings.getProperty("servoy.ng_web_client.temp.uploadir");
long maxUpload = Utils.getAsLong(settings.getProperty("servoy.webclient.maxuploadsize", "0"), false);
File fileUploadDir = null;
if (uploadDir != null) {
fileUploadDir = new File(uploadDir);
if (!fileUploadDir.exists() && !fileUploadDir.mkdirs()) {
fileUploadDir = null;
Debug.error("Couldn't use the property 'servoy.ng_web_client.temp.uploadir' value: '" + uploadDir + "', directory could not be created or doesn't exists");
}
}
tusFileUploadService = new TusFileUploadService().withUploadURI(config.getServletContext().getContextPath() + "/tus/upload/[0-9]+/.+/.+/.+/");
if (fileUploadDir != null) {
try {
tusFileUploadService = tusFileUploadService.withStoragePath(fileUploadDir.getCanonicalPath());
} catch (IOException e) {
throw new ServletException(e);
}
}
if (maxUpload > 0) {
tusFileUploadService = tusFileUploadService.withMaxUploadSize(Long.valueOf(maxUpload));
}
}
Aggregations