From 26b34d8799fbb05e99027fa2afb95813d6219c4b Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 31 Aug 2015 14:26:18 +0200 Subject: [PATCH] =?utf8?q?If=20a=20request=20was=20successfully=20handled,?= =?utf8?q?=20redirect!=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../application/PizzaServiceApplication.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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; -- 2.39.5