]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
updated jsfcore, jshop + moved classes to those projects
authorRoland Haeder <roland@mxchange.org>
Wed, 2 Sep 2015 06:41:20 +0000 (08:41 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 2 Sep 2015 06:41:20 +0000 (08:41 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

lib/jsfcore.jar
lib/jshop.jar
src/java/org/mxchange/pizzaapplication/filter/servlet/BaseServletFilter.java [deleted file]
src/java/org/mxchange/pizzaapplication/filter/servlet/basket/BasketItemAddedFilter.java [deleted file]
src/java/org/mxchange/pizzaapplication/filter/servlet/utf8/Utf8ServletFilter.java [deleted file]
web/WEB-INF/web.xml

index ccf6a7f876a839bd01b01a760bd2cacfa7b583c5..cbe5e26ec3d3fefc921d269e09fcfddffc618355 100644 (file)
Binary files a/lib/jsfcore.jar and b/lib/jsfcore.jar differ
index 26abcd4cd3482e53d79dfe3a2a43deee8acff6f4..7040946feab7661900cc9e1bd2142b172f8b7f66 100644 (file)
Binary files a/lib/jshop.jar and b/lib/jshop.jar differ
diff --git a/src/java/org/mxchange/pizzaapplication/filter/servlet/BaseServletFilter.java b/src/java/org/mxchange/pizzaapplication/filter/servlet/BaseServletFilter.java
deleted file mode 100644 (file)
index bc0004d..0000000
+++ /dev/null
@@ -1,80 +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.pizzaapplication.filter.servlet;
-
-import java.text.MessageFormat;
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import org.mxchange.jcore.BaseFrameworkSystem;
-
-/**
- * A general servlet filter class. If you need to override init() or
- * destroy() please always call the super method first and handle over all
- * parameter.
- *
- * @author Roland Haeder
- */
-public abstract class BaseServletFilter extends BaseFrameworkSystem implements Filter {
-       /**
-        * Configuration instance
-        */
-       private FilterConfig config;
-
-       /**
-        * Destroys this filter
-        */
-       @Override
-       public void destroy () {
-               // Unset config instance
-               this.setConfig(null);
-       }
-
-       /**
-        * Initializes this filter
-        *
-        * @param filterConfig Filter configuration
-        * @throws ServletException 
-        */
-       @Override
-       public void init (final FilterConfig filterConfig) throws ServletException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("filterConfig={0} - CALLED!", filterConfig)); //NOI18N
-
-               // Set config instance
-               this.setConfig(filterConfig);
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * Configuration instance
-        * @return the config
-        */
-       protected final FilterConfig getConfig () {
-               return this.config;
-       }
-
-       /**
-        * Configuration instance
-        * @param config the config to set
-        */
-       private void setConfig (final FilterConfig config) {
-               this.config = config;
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/filter/servlet/basket/BasketItemAddedFilter.java b/src/java/org/mxchange/pizzaapplication/filter/servlet/basket/BasketItemAddedFilter.java
deleted file mode 100644 (file)
index c2475b4..0000000
+++ /dev/null
@@ -1,137 +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.pizzaapplication.filter.servlet.basket;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import org.mxchange.jshop.beans.basket.BasketBean;
-import org.mxchange.jshop.item.AddableBasketItem;
-import org.mxchange.pizzaapplication.filter.servlet.BaseServletFilter;
-
-/**
- * A filter for handling added basket items
- *
- * @author Roland Haeder
- */
-public class BasketItemAddedFilter extends BaseServletFilter implements Filter {
-
-       @Override
-       @SuppressWarnings ("unchecked")
-       public void doFilter (final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("request={0},response={1},chain={2} - CALLED!", request, response, chain)); //NOI18N
-
-               // All must be set
-               if (null == request) {
-                       // request is null
-                       throw new NullPointerException("request is null"); //NOI18N
-               } else if (null == response) {
-                       // response is null
-                       throw new NullPointerException("response is null"); //NOI18N
-               } else if (null == chain) {
-                       // chain is null
-                       throw new NullPointerException("chain is null"); //NOI18N
-               }
-
-               // Call doFilter to move on
-               chain.doFilter(request, response);
-
-               // Get item instance from request
-               Object object = request.getAttribute("item"); //NOI18N
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("object={0}", object)); //NOI18N
-
-               // item should not be null
-               if (null == object) {
-                       // item is null
-                       throw new NullPointerException("object is null"); //NOI18N
-               } else if (!(object instanceof AddableBasketItem)) {
-                       // Not right instance
-                       throw new IllegalArgumentException("object does not implement AddableBasketItem"); //NOI18N
-               }
-
-               // Now it is secure to cast
-               AddableBasketItem item = (AddableBasketItem) object;
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("item.id={0},item.itemId={1},item.itemType={2},item.amount={3}", item.getId(), item.getItemId(), item.getItemType(), item.getAmount())); //NOI18N
-
-               // Cast to servlet request
-               HttpServletRequest servletRequest = (HttpServletRequest) request;
-
-               // Get session instance
-               HttpSession session = servletRequest.getSession();
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("session={0}", session)); //NOI18N
-
-               // Should not be null
-               if (null == session) {
-                       // session is null
-                       throw new NullPointerException("session is null"); //NOI18N
-               }
-
-               // Get basket instance
-               BasketBean basket = (BasketBean) session.getAttribute("basket"); //NOI18N
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("basket={0}", basket)); //NOI18N
-
-               // Is the item already added?
-               if (item.getItemId() == null) {
-                       // Item id is not set
-                       throw new NullPointerException(MessageFormat.format("item id of item={0} is null", item)); //NOI18N
-               } else if (item.getItemType() == null) {
-                       // Item type is not set
-                       throw new NullPointerException(MessageFormat.format("item type of item={0} is null", item)); //NOI18N
-               } else if ((item.getAmount() == null) || (item.getAmount() == 0)) {
-                       // Debug message
-                       this.getLogger().debug(MessageFormat.format("Amount for item {0} is null - EXIT!", item)); //NOI18N
-
-                       // Amount is not entered
-                       return;
-               } else if (basket.isItemAdded(item)) {
-                       // Yes, then throw exception here
-                       throw new ServletException(MessageFormat.format("item id={0} has already been added.", item.getItemId())); //NOI18N
-               }
-
-               // Register item with it
-               basket.addItem(item);
-
-               // Is amount null or zero?
-               if ((item.getAmount() == null) || (item.getAmount() == 0)) {
-                       // Then redirect to added=0
-                       ((HttpServletResponse) response).sendRedirect(servletRequest.getContextPath() + "/?add=0"); //NOI18N
-               } else {
-                       // Redirect to proper URL
-                       ((HttpServletResponse) response).sendRedirect(servletRequest.getContextPath() + "/?add=1"); //NOI18N
-               }
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-}
diff --git a/src/java/org/mxchange/pizzaapplication/filter/servlet/utf8/Utf8ServletFilter.java b/src/java/org/mxchange/pizzaapplication/filter/servlet/utf8/Utf8ServletFilter.java
deleted file mode 100644 (file)
index f3f3797..0000000
+++ /dev/null
@@ -1,58 +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.pizzaapplication.filter.servlet.utf8;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-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.servlet.BaseServletFilter;
-
-/**
- * A HTTP filter for setting UTF-8 character encoding.
- *
- * @author Roland Haeder
- */
-public class Utf8ServletFilter 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 {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("request={0},response={1},chain={2} - CALLED!", request, response, chain)); //NOI18N
-
-               // Call super method
-               chain.doFilter(request, response);
-
-               // Set response/request both to UTF-8
-               request.setCharacterEncoding("UTF-8"); //NOI18N
-               response.setCharacterEncoding("UTF-8"); //NOI18N
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-}
index 6ddf5b869d3d1ea2aac621c4d4aeebf17feb7490..da05191b4f2913161c5e5a07f5e1b57bcebfbfa9 100644 (file)
@@ -37,7 +37,7 @@
     <filter>
         <description>A servlet filter for setting character encoding to UTF-8</description>
         <filter-name>Utf8ServletFilter</filter-name>
-        <filter-class>org.mxchange.pizzaapplication.filter.servlet.utf8.Utf8ServletFilter</filter-class>
+        <filter-class>org.mxchange.jsfcore.filter.servlet.utf8.Utf8ServletFilter</filter-class>
     </filter>
     <filter>
         <description>A servlet filter for logging</description>
@@ -47,7 +47,7 @@
     <filter>
         <description>A filter for handling added basket items</description>
         <filter-name>BasketItemAddedFilter</filter-name>
-        <filter-class>org.mxchange.pizzaapplication.filter.servlet.basket.BasketItemAddedFilter</filter-class>
+        <filter-class>org.mxchange.jshop.filter.servlet.basket.BasketItemAddedFilter</filter-class>
     </filter>
     <filter-mapping>
         <filter-name>BasketItemAddedFilter</filter-name>