Comment out unused notification functionality in ParticleController since the file is directly readable
This commit is contained in:
parent
af3ef7155a
commit
6cb43b412c
|
|
@ -24,14 +24,14 @@ import java.nio.file.Path;
|
||||||
@RestController
|
@RestController
|
||||||
public class ParticleController implements ParticlesApi {
|
public class ParticleController implements ParticlesApi {
|
||||||
|
|
||||||
@Value("${login.secret:#{null}}")
|
// @Value("${login.secret:#{null}}")
|
||||||
private String loginSecret;
|
// private String loginSecret;
|
||||||
|
|
||||||
@Value("${particles.file_path}")
|
@Value("${particles.file_path}")
|
||||||
private String particlesFilePath;
|
private String particlesFilePath;
|
||||||
|
|
||||||
@Value("${notification.server.url:http://localhost:8080}")
|
// @Value("${notification.server.url:http://localhost:8080}")
|
||||||
private String notificationServerUrl;
|
// private String notificationServerUrl;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Resource> downloadFile(String filename) {
|
public ResponseEntity<Resource> downloadFile(String filename) {
|
||||||
|
|
@ -96,7 +96,7 @@ public class ParticleController implements ParticlesApi {
|
||||||
return ResponseEntity.status(404).build();
|
return ResponseEntity.status(404).build();
|
||||||
}
|
}
|
||||||
ResponseEntity<Void> voidResponseEntity = writeContentToFile(file, filename, content);
|
ResponseEntity<Void> voidResponseEntity = writeContentToFile(file, filename, content);
|
||||||
notifyServerOfFileUpload(filename);
|
// notifyServerOfFileUpload(filename);
|
||||||
return voidResponseEntity;
|
return voidResponseEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,35 +116,35 @@ public class ParticleController implements ParticlesApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseEntity<Void> voidResponseEntity = writeContentToFile(file, filename, content);
|
ResponseEntity<Void> voidResponseEntity = writeContentToFile(file, filename, content);
|
||||||
notifyServerOfFileUpload(uuid, filename);
|
// notifyServerOfFileUpload(uuid, filename);
|
||||||
return voidResponseEntity;
|
return voidResponseEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyServerOfFileUpload(String filename) {
|
// private void notifyServerOfFileUpload(String filename) {
|
||||||
String notificationUrl = String.format("http://%s/notify/%s.json", notificationServerUrl, filename);
|
// String notificationUrl = String.format("http://%s/notify/%s.json", notificationServerUrl, filename);
|
||||||
sendNotification(notificationUrl, String.format("file upload: %s", filename));
|
// sendNotification(notificationUrl, String.format("file upload: %s", filename));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void notifyServerOfFileUpload(String uuid, String filename) {
|
// private void notifyServerOfFileUpload(String uuid, String filename) {
|
||||||
String notificationUrl = String.format("%s/notify/%s/%s.json", notificationServerUrl, uuid, filename);
|
// String notificationUrl = String.format("%s/notify/%s/%s.json", notificationServerUrl, uuid, filename);
|
||||||
sendNotification(notificationUrl, String.format("file upload for user %s: %s", uuid, filename));
|
// sendNotification(notificationUrl, String.format("file upload for user %s: %s", uuid, filename));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void sendNotification(String notificationUrl, String logDescription) {
|
// private void sendNotification(String notificationUrl, String logDescription) {
|
||||||
try {
|
// try {
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
// RestTemplate restTemplate = new RestTemplate();
|
||||||
ResponseEntity<String> response = restTemplate.getForEntity(notificationUrl, String.class);
|
// ResponseEntity<String> response = restTemplate.getForEntity(notificationUrl, String.class);
|
||||||
|
//
|
||||||
if (response.getStatusCode().is2xxSuccessful()) {
|
// if (response.getStatusCode().is2xxSuccessful()) {
|
||||||
log.info("Successfully notified server of {}", logDescription);
|
// log.info("Successfully notified server of {}", logDescription);
|
||||||
} else {
|
// } else {
|
||||||
log.warn("Failed to notify server of {}, status: {}",
|
// log.warn("Failed to notify server of {}, status: {}",
|
||||||
logDescription, response.getStatusCode());
|
// logDescription, response.getStatusCode());
|
||||||
}
|
// }
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
log.error("Error notifying server of {}", logDescription, e);
|
// log.error("Error notifying server of {}", logDescription, e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
private ResponseEntity<Void> writeContentToFile(File dir, String filename, MultipartFile content) {
|
private ResponseEntity<Void> writeContentToFile(File dir, String filename, MultipartFile content) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user