]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued with project:
authorRoland Haeder <roland@mxchange.org>
Wed, 12 Aug 2015 10:28:35 +0000 (12:28 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 12 Aug 2015 10:28:35 +0000 (12:28 +0200)
- Moved some classes to proper location
- Removed no longer glassfish-specific character encoding, because ..
- Added filter for setting character encoding to UTF-8
- Added "data" directory + ignored all files in it
- Rewrote initialization of properties so the context parameter from web.xml can be used to set needed properties for jcore database backend. Still this is not so satifying, maybe the method needs to be moved to jcore?
Signed-off-by:Roland Häder <roland@mxchange.org>

13 files changed:
.gitignore
src/java/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java
src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java
src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/database/product/PizzaProductDatabaseConstants.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/filter/http/BaseServletFilter.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/filter/http/utf8/Utf8HttpFilter.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/product/Product.java
src/java/org/mxchange/pizzaapplicationk/database/frontend/contact/PizzaProductDatabaseFrontend.java [deleted file]
src/java/org/mxchange/pizzaapplicationk/database/frontend/contact/ProductFrontend.java [deleted file]
web/WEB-INF/glassfish-web.xml
web/WEB-INF/web.xml

index d73b7d0fafca8a46504d99da429ed8ebb0c01073..4bb68df36ab24f4f21b55054b0b2304b2e77ffa6 100644 (file)
@@ -3,3 +3,4 @@
 /build/
 /dist/
 *.properties
+/data/*.*
index 84f1e1c5a7b65fb9e889b7d3121d699358171093..0e0e754137d467df1df9eb94b69189cbb98540f4 100644 (file)
@@ -16,6 +16,8 @@
  */
 package org.mxchange.pizzaapplication;
 
+import java.text.MessageFormat;
+import javax.servlet.ServletContext;
 import org.mxchange.jcore.BaseFrameworkSystem;
 
 /**
@@ -24,5 +26,30 @@ import org.mxchange.jcore.BaseFrameworkSystem;
  * @author Roland Haeder
  */
 public class BasePizzaServiceSystem extends BaseFrameworkSystem {
-       
+       /**
+        * Initializes properties from given servlet configuration
+        * @param context Servlet context instance
+        */
+       protected void initProperties (final ServletContext context) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("context={0} - CALLED!", context));
+
+               // We need some properties that needs to be set
+               for (final String name : this.getPropertyNames()) {
+                       // Debug log
+                       this.getLogger().debug(MessageFormat.format("name={0}", name));
+
+                       // Get value
+                       String value = context.getInitParameter(name).trim();
+
+                       // Debug log
+                       this.getLogger().debug(MessageFormat.format("{0}={1}", name, value));
+
+                       // Set property
+                       this.setProperty(name, value);
+               }
+
+               // Trace message
+               this.getLogger().trace("EXIT!");
+       }
 }
index b3199752dd30d6a6a5415fa76597576275077bbb..9161e1ab64ba1a81442deafc888d5e16bc6b8bdd 100644 (file)
@@ -30,7 +30,8 @@ import org.mxchange.jcore.contact.Gender;
 import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
 import org.mxchange.pizzaapplication.customer.Customer;
 import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
-import org.mxchange.pizzaapplication.product.PizzaProduct;
+import org.mxchange.pizzaapplication.database.frontend.product.PizzaProductDatabaseFrontend;
+import org.mxchange.pizzaapplication.database.frontend.product.ProductFrontend;
 import org.mxchange.pizzaapplication.product.Product;
 
 /**
@@ -47,13 +48,13 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
         * Some singleton getter for this instance. If the instance is not set in
         * given application, it will be created.
         *
-        * @param application Servlet context
+        * @param context Servlet context
         * @return This instance
         * @throws javax.servlet.ServletException If object is not set correctly
         */
-       public static final PizzaApplication getInstance (final ServletContext application) throws ServletException {
+       public static final PizzaApplication getInstance (final ServletContext context) throws ServletException {
                // Check application instance
-               if (application == null) {
+               if (context == null) {
                        // Not set
                        throw new NullPointerException("application is null"); //NOI18N
                }
@@ -62,7 +63,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                PizzaApplication instance = null;
 
                // Get instance from servlet application (aka. "application scope")
-               Object object = application.getAttribute("app"); //NOI18N
+               Object object = context.getAttribute("app"); //NOI18N
 
                // Is it set?
                if (object instanceof PizzaApplication) {
@@ -73,10 +74,10 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                        throw new ServletException("app is not set correctly"); //NOI18N
                } else {
                        // "service" is null, so initialize it
-                       instance = new PizzaServiceApplication();
+                       instance = new PizzaServiceApplication(context);
 
                        // And set it here
-                       application.setAttribute("app", instance); //NOI18N
+                       context.setAttribute("app", instance); //NOI18N
                }
 
                // Trace message
@@ -107,11 +108,20 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
        private PizzaServiceApplication () {
                // Init products instance
                this.products = new TreeMap<>();
+       }
 
-               // Init bundle
-               this.initBundle();
+       /**
+        * Constructor with servet configuration
+        * @param context Servlet context
+        */
+       private PizzaServiceApplication (final ServletContext context) {
+               // Call other constructor first
+               this();
 
-               // Fill products list
+               // Initialize properties from config
+               this.initProperties(context);
+
+               // Load available products
                this.fillProductsList();
        }
 
@@ -828,13 +838,14 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
        /**
         * Adds given product to list or throws an exception if name is already found
         *
-        * @param name Internal name of product
-        * @param title Product's title
-        * @param price Price
+        * @param product Product instance to add
         */
-       private void addProduct (final String name, final String title, final float price) {
+       private void addProduct (final Product product) {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("name={0},title={1},price={2} - CALLED!", name, title, price)); //NOI18N
+               this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
+
+               // Get all data from it
+               String name = product.getName();
 
                // Is the name already used?
                if (this.isProductNameUsed(name)) {
@@ -842,9 +853,6 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                        throw new IllegalArgumentException(MessageFormat.format("product {0} is already used.", name)); //NOI18N
                }
 
-               // Instance product
-               Product product = new PizzaProduct(name, title, price);
-               
                // Debug message
                this.getLogger().debug(MessageFormat.format("Adding product={0} ...", product)); //NOI18N
 
@@ -882,10 +890,20 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                // Trace message
                this.getLogger().trace("CALLED!"); //NOI18N
 
-               // Add products
-               this.addProduct("italia", "Pizza Italia", 5.50f); //NOI18N
-               this.addProduct("diablo", "Pizza Diablo", 7.80f); //NOI18N
-               this.addProduct("bolognese", "Spagetti Bolognese", 11.95f); //NOI18N
+               // Get a product frontend
+               ProductFrontend frontend = new PizzaProductDatabaseFrontend();
+
+               // Get iterator
+               Iterator<Product> iterator = frontend.getProducts();
+
+               // Get all products
+               while (iterator.hasNext()) {
+                       // Get it
+                       Product product = iterator.next();
+
+                       // Add it
+                       this.addProduct(product);
+               }
 
                // Trace message
                this.getLogger().trace("EXIT!"); //NOI18N
@@ -1063,6 +1081,15 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
         * Application starter
         */
        private void start () {
+               // Init bundle
+               this.initBundle();
+
+               // Init properties
+               this.initProperties();
+
+               // Fill products list
+               this.fillProductsList();
+
                // "Walk" over all products
                for (final Product product : this.getProducts()) {
                        // Output data
diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/product/PizzaProductDatabaseFrontend.java
new file mode 100644 (file)
index 0000000..f0a63a7
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.database.frontend.product;
+
+import java.sql.SQLException;
+import java.text.MessageFormat;
+import java.util.Iterator;
+import org.mxchange.jcore.criteria.searchable.SearchCriteria;
+import org.mxchange.jcore.criteria.searchable.SearchableCritera;
+import org.mxchange.jcore.database.frontend.BaseDatabaseFrontend;
+import org.mxchange.jcore.database.result.Result;
+import org.mxchange.jcore.database.storage.Storeable;
+import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
+import org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants;
+import org.mxchange.pizzaapplication.product.Product;
+
+/**
+ * Stores and retrieves Contact instances
+ *
+ * @author Roland Haeder
+ */
+public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implements ProductFrontend {
+
+       /**
+        * Default constrcutor
+        */
+       public PizzaProductDatabaseFrontend () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
+               // Set "table" name
+               this.setTableName("products"); //NOI18N
+
+               try {
+                       // Initalize backend
+                       this.initBackend();
+               } catch (final UnsupportedDatabaseBackendException | SQLException ex) {
+                       // Abort program
+                       this.abortProgramWithException(ex);
+               }
+       }
+
+       /**
+        * Shuts down the database layer
+        */
+       @Override
+       public void doShutdown () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
+               // Shutdown backend
+               this.getBackend().doShutdown();
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
+       }
+
+       /**
+        * An iterator on all products
+        *
+        * @return Iterator on all products
+        */
+       @Override
+       @SuppressWarnings ("unchecked")
+       public Iterator<Product> getProducts () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
+               // Instance search criteria
+               SearchableCritera critera = new SearchCriteria();
+
+               // Add criteria
+               critera.addCriteria(PizzaProductDatabaseConstants.COLUMN_AVAILABLE, true);
+
+               // Run the query
+               Result<? extends Storeable> result = this.getBackend().doSelectByCriteria(critera);
+
+               // Debug message
+               this.getLogger().debug(MessageFormat.format("result={0}", result)); //NOI18N
+
+               // Get iterator
+               Iterator<?> iterator = result.iterator();
+
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("iterator={0} - EXIT!", iterator)); //NOI18N
+
+               // Get iterator and return it
+               return (Iterator<Product>) iterator;
+       }
+
+       /**
+        * Parses given line from database backend into a Storeable instance. Please
+        * note that not all backends need this.
+        *
+        * @param line Line from database backend
+        * @return A Storeable instance
+        */
+       @Override
+       public Storeable parseLineToStoreable (final String line) throws BadTokenException {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("line={0} - CALLED!", line)); //NOI18N
+
+               // Call inner method
+               Product product = this.parseLineToProduct(line);
+
+               // Debug message
+               this.getLogger().trace(MessageFormat.format("product={0} - EXIT!", product)); //NOI18N
+
+               // Return it
+               return product;
+       }
+
+       /**
+        * Parses given line to a Product instance
+        *
+        * @param line
+        * @return A Product instance from given line
+        */
+       private Product parseLineToProduct (final String line) {
+               throw new UnsupportedOperationException(MessageFormat.format("Not supported yet: line={0}", line)); //NOI18N
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java b/src/java/org/mxchange/pizzaapplication/database/frontend/product/ProductFrontend.java
new file mode 100644 (file)
index 0000000..b94d550
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2015 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.database.frontend.product;
+
+import java.util.Iterator;
+import org.mxchange.jcore.database.frontend.DatabaseFrontend;
+import org.mxchange.pizzaapplication.product.Product;
+
+/**
+ * An interface for product database frontends
+ *
+ * @author Roland Häder
+ */
+public interface ProductFrontend extends DatabaseFrontend {
+
+       /**
+        * An iterator on all products
+        *
+        * @return Iterator on all products
+        */
+       public Iterator<Product> getProducts ();
+}
diff --git a/src/java/org/mxchange/pizzaapplication/database/product/PizzaProductDatabaseConstants.java b/src/java/org/mxchange/pizzaapplication/database/product/PizzaProductDatabaseConstants.java
new file mode 100644 (file)
index 0000000..16d08d7
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.database.product;
+
+/**
+ *
+ * @author Roland Haeder
+ */
+public final class PizzaProductDatabaseConstants {
+       /**
+        * Column name for "available"
+        */
+       public static final String COLUMN_AVAILABLE = "available";
+
+       /**
+        * No instance from this class
+        */
+       private PizzaProductDatabaseConstants () {
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/filter/http/BaseServletFilter.java b/src/java/org/mxchange/pizzaapplication/filter/http/BaseServletFilter.java
new file mode 100644 (file)
index 0000000..0e40f85
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.filter.http;
+
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import org.mxchange.jcore.BaseFrameworkSystem;
+
+/**
+ * A general HTTP servlet filter class
+ * @author Roland Haeder
+ */
+public class BaseServletFilter extends BaseFrameworkSystem {
+       /**
+        * Configuration instance
+        */
+       private FilterConfig config;
+
+       /**
+        * Configuration instance
+        * @return the config
+        */
+       protected FilterConfig getConfig () {
+               return this.config;
+       }
+
+       /**
+        * Configuration instance
+        * @param config the config to set
+        */
+       protected void setConfig (final FilterConfig config) {
+               this.config = config;
+       }
+
+       /**
+        * Destroys this filter
+        */
+       public void destroy () {
+               // Unset config instance
+               this.setConfig(null);
+       }
+
+       /**
+        * Initializes this filter
+        *
+        * @param filterConfig Filter configuration
+        * @throws ServletException 
+        */
+       public void init (final FilterConfig filterConfig) throws ServletException {
+               // Set config instance
+               this.setConfig(filterConfig);
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/filter/http/utf8/Utf8HttpFilter.java b/src/java/org/mxchange/pizzaapplication/filter/http/utf8/Utf8HttpFilter.java
new file mode 100644 (file)
index 0000000..51585e3
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.filter.http.utf8;
+
+import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import org.mxchange.pizzaapplication.filter.http.BaseServletFilter;
+
+/**
+ * A HTTP filter for setting UTF-8 character encoding.
+ *
+ * @author Roland Haeder
+ */
+public class Utf8HttpFilter extends BaseServletFilter implements Filter {
+       /**
+        * Filter to set UTF-8 encoding
+        *
+        * @param request ServletRequest instance
+        * @param response ServletResponse instance
+        * @param chain FilterChain instance
+        * @throws IOException
+        * @throws ServletException
+        */
+       @Override
+       public void doFilter (final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
+               // Call super method
+               chain.doFilter(request, response);
+
+               // Set response/request both to UTF-8
+               request.setCharacterEncoding("UTF-8");
+               response.setCharacterEncoding("UTF-8");
+       }
+}
index a81b91632e057297e1e275cd577c1584f3160173..bdeea227892a00402e564fbfb1987d9abccc62bc 100644 (file)
  */
 package org.mxchange.pizzaapplication.product;
 
-import org.mxchange.jcore.FrameworkInterface;
+import org.mxchange.jcore.database.storage.Storeable;
 
 /**
  *
  * @author Roland Haeder
  */
-public interface Product extends FrameworkInterface {
+public interface Product extends Storeable {
        /**
         * Getter for name, suitable for form fields.
         * 
diff --git a/src/java/org/mxchange/pizzaapplicationk/database/frontend/contact/PizzaProductDatabaseFrontend.java b/src/java/org/mxchange/pizzaapplicationk/database/frontend/contact/PizzaProductDatabaseFrontend.java
deleted file mode 100644 (file)
index 97b19cf..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplicationk.database.frontend.contact;
-
-import java.sql.SQLException;
-import java.text.MessageFormat;
-import org.mxchange.jcore.database.frontend.BaseDatabaseFrontend;
-import org.mxchange.jcore.database.storage.Storeable;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
-import org.mxchange.pizzaapplication.product.Product;
-
-/**
- * Stores and retrieves Contact instances
- *
- * @author Roland Haeder
- */
-public class PizzaProductDatabaseFrontend extends BaseDatabaseFrontend implements ProductFrontend {
-
-       /**
-        * Basic constrcutor
-        */
-       protected PizzaProductDatabaseFrontend () {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Set "table" name
-               this.setTableName("contacts"); //NOI18N
-
-               try {
-                       // Initalize backend
-                       this.initBackend();
-               } catch (final UnsupportedDatabaseBackendException | SQLException ex) {
-                       // Abort program
-                       this.abortProgramWithException(ex);
-               }
-       }
-
-       /**
-        * Shuts down the database layer
-        */
-       @Override
-       public void doShutdown () {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Shutdown backend
-               this.getBackend().doShutdown();
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * Parses given line from database backend into a Storeable instance. Please
-        * note that not all backends need this.
-        *
-        * @param line Line from database backend
-        * @return A Storeable instance
-        */
-       @Override
-       public Storeable parseLineToStoreable (final String line) throws BadTokenException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("line={0} - CALLED!", line)); //NOI18N
-
-               // Call inner method
-               Product product = this.parseLineToProduct(line);
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("product={0}", product));
-
-               // Return it
-               return (Storeable) product;
-       }
-
-       /**
-        * Parses given line to a Product instance
-        * @param line
-        * @return A Product instance from given line
-        */
-       private Product parseLineToProduct (final String line) {
-               throw new UnsupportedOperationException("Not supported yet.");
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplicationk/database/frontend/contact/ProductFrontend.java b/src/java/org/mxchange/pizzaapplicationk/database/frontend/contact/ProductFrontend.java
deleted file mode 100644 (file)
index a04499e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplicationk.database.frontend.contact;
-
-import org.mxchange.jcore.database.frontend.DatabaseFrontend;
-
-/**
- * An interface for product database frontends
- *
- * @author Roland Häder
- */
-public interface ProductFrontend extends DatabaseFrontend {
-}
index 0c186a9a30ec14c40c4258afea7abda5d7fa13ef..13e0059fffb79e9888f6bfa2f5249d72cad958d1 100644 (file)
@@ -7,5 +7,4 @@
       <description>Keep a copy of the generated servlet class' java code.</description>
     </property>
   </jsp-config>
-  <parameter-encoding default-charset="utf-8" />
 </glassfish-web-app>
index 764689af95ea138d209641f4b770f2f5361f601f..2676cd9a34568aab97c392adedace0413623f2a8 100644 (file)
@@ -1,5 +1,39 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+    <context-param>
+        <description>Full-qualified back class name, must implement DatabaseBackend interface</description>
+        <param-name>database.backend.class</param-name>
+        <param-value>org.mxchange.jcore.database.backend.base64.Base64CsvDatabaseBackend</param-value>
+    </context-param>
+    <context-param>
+        <description>Login name for MySQL database, mostly not root</description>
+        <param-name>database.mysql.login</param-name>
+        <param-value>root</param-value>
+    </context-param>
+    <context-param>
+        <description>Password for above login, an empty password can be archived by setting a space</description>
+        <param-name>database.mysql.password</param-name>
+        <param-value>root</param-value>
+    </context-param>
+    <context-param>
+        <description>Hostname or IP address for MySQL server</description>
+        <param-name>database.mysql.host</param-name>
+        <param-value>localhost</param-value>
+    </context-param>
+    <context-param>
+        <description>Name of MySQL catalog</description>
+        <param-name>database.mysql.dbname</param-name>
+        <param-value>test</param-value>
+    </context-param>
+    <filter>
+        <description>A filter for setting character encoding to UTF-8</description>
+        <filter-name>Utf8HttpFilter</filter-name>
+        <filter-class>org.mxchange.pizzaapplication.filter.http.utf8.Utf8HttpFilter</filter-class>
+    </filter>
+    <filter-mapping>
+        <filter-name>Utf8HttpFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
     <session-config>
         <session-timeout>
             30
@@ -8,4 +42,8 @@
     <welcome-file-list>
         <welcome-file>index.jsp</welcome-file>
     </welcome-file-list>
+    <error-page>
+        <exception-type>Exception</exception-type>
+        <location>/errorHandler.jsp</location>
+    </error-page>
 </web-app>