Compare commits

...
3 Commits
4 changed files with 12 additions and 16 deletions
@@ -22,6 +22,7 @@ import org.springframework.dao.DataAccessException;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@@ -1,7 +1,8 @@
package com.realnet.FileUpload.Services; package com.realnet.FileUpload.Services;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
@@ -43,17 +44,11 @@ public class FileuploadService {
} }
// reading data // save file
InputStream is = multipartFile.getInputStream(); File dest = new File(filepath);
byte data[] = new byte[is.available()]; try (InputStream is = multipartFile.getInputStream()) {
is.read(data); Files.copy(is, dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
// writing data
FileOutputStream fos = new FileOutputStream(filepath);
fos.write(data);
fos.close();
fos.flush();
f = true; f = true;
} catch (Exception e) { } catch (Exception e) {
@@ -114,7 +114,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
web.ignoring().antMatchers("/", "/resources/**", "/static/**", "/public/**", "/webui/**", "/h2-console/**", web.ignoring().antMatchers("/", "/resources/**", "/static/**", "/public/**", "/webui/**", "/h2-console/**",
"/configuration/**", "/swagger-ui/**", "/swagger-resources/**", "/webjars/**", "/api-docs", "/configuration/**", "/swagger-ui/**", "/swagger-resources/**", "/webjars/**", "/api-docs",
"/api-docs/**", "/v2/api-docs/**", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/**/*.png", "/api-docs/**", "/v2/api-docs/**", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/**/*.png",
"/**/*.jpg", "/**/*.gif", "/**/*.svg", "/**/*.ico", "/**/*.ttf", "/**/*.woff", "/**/*.otf", "/FileUpload/files/**", "/FileUpload/view/**"); "/**/*.jpg", "/**/*.gif", "/**/*.svg", "/**/*.ico", "/**/*.ttf", "/**/*.woff", "/**/*.otf", "/FileUpload/**");
} }
// } // }
@@ -125,7 +125,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// Add CORS Filter //http.cors().and().csrf().disable(). // Add CORS Filter //http.cors().and().csrf().disable().
.addFilterBefore(new CorsFilter(), ChannelProcessingFilter.class) .addFilterBefore(new CorsFilter(), ChannelProcessingFilter.class)
// adding backend/token for single container by Azmat 27-08 // adding backend/token for single container by Azmat 27-08
.authorizeRequests(requests -> requests.antMatchers("/token/**", "/backend/token/**", "/**/backend/token/**", "/FileUpload/files/**", "/FileUpload/view/**").permitAll().antMatchers("/log2/**") .authorizeRequests(requests -> requests.antMatchers("/token/**", "/backend/token/**", "/**/backend/token/**", "/FileUpload/**").permitAll().antMatchers("/log2/**")
.permitAll().antMatchers("/api/**").permitAll() .permitAll().antMatchers("/api/**").permitAll()
// .antMatchers("/SqlworkbenchSqlcont/**").hasRole("ADMIN") // .antMatchers("/SqlworkbenchSqlcont/**").hasRole("ADMIN")
.anyRequest().authenticated()) .anyRequest().authenticated())
@@ -62,8 +62,8 @@ spring.mail.properties.mail.smtp.socketFactory.fallback = false
#******* MULTIPART RESOLVER #******* MULTIPART RESOLVER
spring.servlet.multipart.enabled=true spring.servlet.multipart.enabled=true
spring.servlet.multipart.max-file-size=100MB spring.servlet.multipart.max-file-size=500MB
spring.servlet.multipart.max-request-size=100MB spring.servlet.multipart.max-request-size=500MB
#***************OAUTH2 SOCIAL LOGIN ********* #***************OAUTH2 SOCIAL LOGIN *********
# Social login provider props # Social login provider props