in wilma-application/modules/wilma-webapp/src/main/java/com/epam/wilma/webapp/config/servlet/stub/upload/MultiPartFileProcessor.java [71:97]
public String processUploadedFile(final InputStream resource, final String contentType, final String fieldName, final String fileName) {
String result;
String resFileName = extractFileNameFromAbsolutePath(fileName);
String classUploadResult = processUploadedClasses(resource, contentType, fieldName, resFileName);
if (classUploadResult != null) {
result = classUploadResult;
} else {
if ("stub-configuration".equals(fieldName) && JSON_CONTENT_TYPE.equals(contentType)) {
try {
routingService.performModification(new NewStubDescriptorCommand(resource, stubConfigurationJsonBuilder, sequenceDescriptorHolder));
serviceMap.detectServices();
} catch (ClassNotFoundException e) {
result = "Uploading " + fileName + " failed with ClassNotFoundException.";
throw new CannotUploadExternalResourceException(result, e);
}
result = "New stub configuration was uploaded to Wilma.";
} else if ("stub-template".equals(fieldName)) {
writeResourceToFile(resource, resFileName, stubResourcePathProvider.getTemplatesPathAsString());
result = "External template '" + resFileName + WAS_UPLOADED_TO_WILMA;
} else {
result = "Uploading " + fileName + " failed: wrong content type or tried to upload file from unauthorized form!";
throw new CannotUploadExternalResourceException(result);
}
}
return result;
}