Added max_xml_file_size
This commit is contained in:
parent
b8975cb415
commit
48264bbdb5
5 changed files with 8 additions and 3 deletions
|
|
@ -19,6 +19,7 @@ ct.scoring-data-source-settings.url=${DB_URL_SCORING:jdbc:db2://10.230.227.101:2
|
|||
ct.scoring-data-source-settings.username=${USERNAME_SCORING:tester}
|
||||
ct.scoring-data-source-settings.password=${PASSWORD_SCORING:tester}
|
||||
|
||||
ct.max_xml_file_size=${ACCEPTED_XML_SIZE:1024}
|
||||
spring.servlet.multipart.max-file-size=${ACCEPTED_ARCHIVE_SIZE:2048MB}
|
||||
spring.servlet.multipart.max-request-size=${ACCEPTED_ARCHIVE_SIZE:2048MB}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ DB_URL_SCORING=jdbc:db2://10.230.227.101:2668/cprosd22:currentSchema=TEST_2_INDI
|
|||
USERNAME_SCORING=tester
|
||||
PASSWORD_SCORING=tester
|
||||
|
||||
# размер в mb
|
||||
ACCEPTED_XML_SIZE=1024
|
||||
ACCEPTED_ARCHIVE_SIZE=2048MB
|
||||
|
||||
SIGNALS_ROOT_URI=http://10.230.227.102:11094/signalRUalfa/
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ services:
|
|||
- DB_URL_SCORING=${DB_URL_SCORING}
|
||||
- USERNAME_SCORING=${USERNAME_SCORING}
|
||||
- PASSWORD_SCORING=${PASSWORD_SCORING}
|
||||
- ACCEPTED_XML_SIZE=${ACCEPTED_XML_SIZE}
|
||||
- ACCEPTED_ARCHIVE_SIZE=${ACCEPTED_ARCHIVE_SIZE}
|
||||
- SIGNALS_ROOT_URI=${SIGNALS_ROOT_URI}
|
||||
- SIGNALS_TOKEN=${SIGNALS_TOKEN}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public class CreditTrackerSettings {
|
|||
private String signalsToken;
|
||||
private String signalsuser;
|
||||
|
||||
private Long maxXmlFileSize;
|
||||
private String loadDir;
|
||||
private Long monitoringInterval;
|
||||
private Long updateFlagsInterval;
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ import static ru.nbch.credit_tracker.utils.error.ExceptionUtils.serverExcp;
|
|||
@Slf4j
|
||||
@Service
|
||||
public class SignalFacade {
|
||||
private static final long MAX_XML_FILE_SIZE = 2L * 1024 * 1024 * 1024;
|
||||
|
||||
private final CreditTrackerSettings config;
|
||||
private final AuthorizationService authorizationService;
|
||||
private final SignalService signalService;
|
||||
|
|
@ -55,6 +53,7 @@ public class SignalFacade {
|
|||
private final StaxXmlProcessor staxXmlProcessor;
|
||||
|
||||
private final ExecutorService executor;
|
||||
private final long maxXmlFileSize;
|
||||
|
||||
|
||||
public SignalFacade(CreditTrackerSettings config,
|
||||
|
|
@ -69,6 +68,7 @@ public class SignalFacade {
|
|||
this.signalRestService = signalRestService;
|
||||
this.staxXmlProcessor = staxXmlProcessor;
|
||||
this.executor = executor;
|
||||
this.maxXmlFileSize = config.getMaxXmlFileSize() * 1024 * 1024;
|
||||
}
|
||||
|
||||
public ResponseEntity<MonitoringResponse> setupMonitoring(MultipartFile file) {
|
||||
|
|
@ -87,7 +87,7 @@ public class SignalFacade {
|
|||
if (xmlFileEntry.isEmpty()) {
|
||||
throw clientExcp(SignalError.ERROR_001, XmlErrorFormat.MonitoringError);
|
||||
}
|
||||
if (xmlFileEntry.get().getSize() > MAX_XML_FILE_SIZE) {
|
||||
if (xmlFileEntry.get().getSize() > maxXmlFileSize) {
|
||||
throw clientExcp(SignalError.ERROR_009, XmlErrorFormat.MonitoringError);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue