]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
If a request was successfully handled, redirect!
authorRoland Haeder <roland@mxchange.org>
Mon, 31 Aug 2015 12:26:18 +0000 (14:26 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 31 Aug 2015 12:26:18 +0000 (14:26 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java

index 337825b5ff9d0ae53a49748ea5999fdca9784d91..3e57bf3956dcc52c22992939fc16f56a4be0bdab 100644 (file)
@@ -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;