private void addCollectorApplication(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		final String appName = req.getParameter("appName");
		final String appUrls = req.getParameter("appUrls");
		final String action = req.getParameter("action");
		final String[] aggregatedApps = req.getParameterValues("aggregatedApps");
		try {
			if (appName == null || appUrls == null && aggregatedApps == null) {
				throw new IllegalArgumentException(I18N.getString("donnees_manquantes"));
			}
			if (appUrls != null && !appUrls.startsWith("http://")
					&& !appUrls.startsWith("https://")) {
				throw new IllegalArgumentException(I18N.getString("urls_format"));
			}
			final CollectorController collectorController = new CollectorController(
					collectorServer);
			if ("unregisterNode".equals(action)) {
				collectorController.removeCollectorApplicationNodes(appName, appUrls);
				LOGGER.info("monitored application node removed: " + appName + ", url: " + appUrls);
			} else if (appUrls != null) {
				collectorController.addCollectorApplication(appName, appUrls);
				LOGGER.info("monitored application added: " + appName);
				LOGGER.info("urls of the monitored application: " + appUrls);
			} else {
				assert aggregatedApps != null;
				collectorController.addCollectorAggregationApplication(appName,
						List.of(aggregatedApps));
				LOGGER.info("aggregation application added: " + appName);
				LOGGER.info("aggregated applications of the aggregation application: "
						+ List.of(aggregatedApps));
			}
			CollectorController.showAlertAndRedirectTo(resp,
					I18N.getFormattedString("application_ajoutee", appName),
					"?application=" + appName);
		} catch (final FileNotFoundException e) {
			final String message = I18N.getString("monitoring_configure");
			throw new IllegalStateException(message + '\n' + e, e);
		} catch (final StreamCorruptedException e) {
			final String message = I18N.getFormattedString("reponse_non_comprise", appUrls);
			throw new IllegalStateException(message + '\n' + e, e);
		}
	}
@Test
	public void testAddCollectorApplication() throws IOException {
		CollectorServlet.addCollectorApplication("test", "http://localhost:8090/test");
		CollectorServlet.removeCollectorApplication("test");
	}