From 19ded6aee2dca23ed64f795bda350c1639fc2014 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 2 Sep 2015 08:41:20 +0200 Subject: [PATCH] =?utf8?q?updated=20jsfcore,=20jshop=20+=20moved=20classes?= =?utf8?q?=20to=20those=20projects=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/jsfcore.jar | Bin 10991 -> 14575 bytes lib/jshop.jar | Bin 81778 -> 86227 bytes .../filter/servlet/BaseServletFilter.java | 80 ---------- .../servlet/basket/BasketItemAddedFilter.java | 137 ------------------ .../servlet/utf8/Utf8ServletFilter.java | 58 -------- web/WEB-INF/web.xml | 4 +- 6 files changed, 2 insertions(+), 277 deletions(-) delete mode 100644 src/java/org/mxchange/pizzaapplication/filter/servlet/BaseServletFilter.java delete mode 100644 src/java/org/mxchange/pizzaapplication/filter/servlet/basket/BasketItemAddedFilter.java delete mode 100644 src/java/org/mxchange/pizzaapplication/filter/servlet/utf8/Utf8ServletFilter.java diff --git a/lib/jsfcore.jar b/lib/jsfcore.jar index ccf6a7f876a839bd01b01a760bd2cacfa7b583c5..cbe5e26ec3d3fefc921d269e09fcfddffc618355 100644 GIT binary patch delta 2778 zcma)8TWlLe6g{(kti5*H+G*^hb{#uOo%Jhj8mD#RCe6DlElK(a5AkKWo7O0bTidOQ zq7cCsNVEuz#3w?6KZFD-6pElK5?=@;sDy+Bg2I2*55xx#0e5z7H(r~7rS`Du4sHKHK+7hibV-L-tjRn0?)=55K5l;32l(L*p@Q`33ns*4?*K zT&-&5bQ4sQ*nkj=*TgDX`O2zR-9|hn#3Ls0%hi=^vkpJS#&plFvnhSN%Z`chMo@ZN z)?NK$?9R)uk-zlh1n8y-bUI(r&KUm8>p=_^R`Zq0=YM^4o3uudRp3HIfr38q*YCi9 zjC~5C7<55J%z?O*))O+4GEy>z80>}8+Dh>}L-6F&`78OW>3Y1vfKw~a=-WAd+dt0^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A^>WBGj7D9yS1?Nz5aG4z~=js(bD7&45oXnQ5@^5NMp7DLJ z=TKB7M3`T9mi~33$H`&=C}eN=Kw-DI?vb)2!6|D**+mm(g)MN2<9?f`&)gi~FN3fa d9b2R}%f{a. - */ -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 index c2475b4c..00000000 --- a/src/java/org/mxchange/pizzaapplication/filter/servlet/basket/BasketItemAddedFilter.java +++ /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 . - */ -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 index f3f3797a..00000000 --- a/src/java/org/mxchange/pizzaapplication/filter/servlet/utf8/Utf8ServletFilter.java +++ /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 . - */ -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 - } -} diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index 6ddf5b86..da05191b 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -37,7 +37,7 @@ A servlet filter for setting character encoding to UTF-8 Utf8ServletFilter - org.mxchange.pizzaapplication.filter.servlet.utf8.Utf8ServletFilter + org.mxchange.jsfcore.filter.servlet.utf8.Utf8ServletFilter A servlet filter for logging @@ -47,7 +47,7 @@ A filter for handling added basket items BasketItemAddedFilter - org.mxchange.pizzaapplication.filter.servlet.basket.BasketItemAddedFilter + org.mxchange.jshop.filter.servlet.basket.BasketItemAddedFilter BasketItemAddedFilter -- 2.39.5