delete service renews the list

This commit is contained in:
Katerina Iatropoulou 2020-10-20 14:54:30 +00:00
parent 6cf8537818
commit f936286d91
1 changed files with 4 additions and 5 deletions

View File

@ -113,8 +113,8 @@ public class RegisteredServicesServlet extends HttpServlet {
if (!registeredService.getOwner().equals(authentication.getSub())) {
request.getSession().setAttribute("message", "You are not allowed to delete the service.");
System.out.println("BLOCKED " + registeredService.getOwner() + " >> " + authentication.getSub());
response.setContentType("text/html");
request.getRequestDispatcher("./registeredServices.jsp").include(request, response);
response.sendRedirect("./registeredServices");
return;
}
String aai_id = registeredService.getAai_id();
@ -127,15 +127,14 @@ public class RegisteredServicesServlet extends HttpServlet {
logger.error("Unable to delete the service. Status code was " + statusCode);
request.getSession().setAttribute("message", "Fail to delete the service. Status " + statusCode);
System.out.println("AAI blocked");
response.sendRedirect("./registeredServices");
return;
} else {
registeredServicesUtils.getRegisteredServiceDao().delete(Integer.parseInt(id));
request.getSession().setAttribute("success", "The service was successfully deleted.");
System.out.println("HERE HERE");
}
response.setContentType("text/html");
request.getRequestDispatcher("./registeredServices.jsp").include(request, response);
} catch (SQLException sqle) {
logger.error("Unable to contact db.", sqle);
request.getSession().setAttribute("message", "Fail to delete the service. Please try again later.");