From: Roland Haeder Date: Mon, 31 Aug 2015 12:26:18 +0000 (+0200) Subject: If a request was successfully handled, redirect! X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=26b34d8799fbb05e99027fa2afb95813d6219c4b;p=pizzaservice-war.git If a request was successfully handled, redirect! Signed-off-by:Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java index 337825b5..3e57bf39 100644 --- a/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java +++ b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java @@ -752,6 +752,9 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P } else { // Add new product this.doAdminAddProduct(request); + + // Redirect to proper URL + response.sendRedirect(String.format("%s/admin/product.jsp?added=1", request.getContextPath())); //NOI18N } } else if (request.getParameter("edit") != null) { //NOI18N // TODO @@ -759,9 +762,8 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P // TODO } - // Redirect to proper URL - // TODO Commented out for developing: - //response.sendRedirect(request.getContextPath() + "/finished.jsp"); + // Request not handled + throw new ServletException("request not handled."); //NOI18N } } catch (final IOException | SQLException | BadTokenException | CorruptedDatabaseFileException | ProductTitleAlreadyUsedException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | IllegalArgumentException ex) { // Throw it as cause @@ -802,6 +804,9 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P } else { // Add new category this.doAdminAddCategory(request); + + // Redirect to proper URL + response.sendRedirect(String.format("%s/admin/category.jsp?added=1", request.getContextPath())); //NOI18N } } else if (request.getParameter("edit") != null) { //NOI18N // TODO @@ -809,9 +814,8 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P // TODO } - // Redirect to proper URL - // TODO Commented out for developing: - //response.sendRedirect(request.getContextPath() + "/finished.jsp"); + // Request not handled + throw new ServletException("request not handled."); //NOI18N } } catch (final IOException | SQLException | BadTokenException | CorruptedDatabaseFileException | CategoryTitleAlreadyUsedException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | IllegalArgumentException ex) { // Throw it as cause @@ -867,7 +871,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P @Override public Product getProduct (final AddableBasketItem item) throws ServletException { // Trace message - this.getLogger().trace("item=" + item + " - CALLED!"); //NOI18N + this.getLogger().trace(MessageFormat.format("item={0} - CALLED!", item)); //NOI18N // item should not be null if (null == item) { @@ -890,7 +894,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P } // Trace message - this.getLogger().trace("product=" + product + " - EXIT!"); //NOI18N + this.getLogger().trace(MessageFormat.format("product={0} - EXIT!", product)); //NOI18N //NOI18N // Return it return product;