import java.util.Iterator;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
import javax.servlet.http.HttpSession;
import org.mxchange.jcore.application.Application;
import org.mxchange.jcore.exceptions.BadTokenException;
* @param session Session instance
* @return Whether the product is choosen
*/
- public String getCheckedHtmlFromProduct (final Product product, final HttpServletRequest request, final HttpSession session);
+ public String getCheckedHtmlFromProduct (final Product product, final ServletRequest request, final HttpSession session);
/**
* Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons
* @return Whether the product is choosen
* @throws javax.servlet.ServletException If something unexpected happened
*/
- public String getDisabledHtmlFromSession (final HttpServletRequest request, final HttpSession session) throws ServletException;
+ public String getDisabledHtmlFromSession (final ServletRequest request, final HttpSession session) throws ServletException;
/**
* Somewhat setter in session
* @throws javax.servlet.ServletException If something unexpected happened
* @throws org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException If the given title is already used
*/
- public void doAdminAddCategory (final HttpServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException;
+ public void doAdminAddCategory (final ServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException;
/**
* Adds given product data from request to database
* @throws javax.servlet.ServletException If something unexpected happened
* @throws org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException If the given product title is already used
*/
- public void doAdminAddProduct (final HttpServletRequest request) throws ServletException, ProductTitleAlreadyUsedException;
+ public void doAdminAddProduct (final ServletRequest request) throws ServletException, ProductTitleAlreadyUsedException;
/**
* Generates link HTML code for given category's parent id, if set. This
* @param response Response instance
* @throws ServletException If something unexpected happened
*/
- public void doAdminHandleProductForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException;
+ public void doAdminHandleProductForms (final ServletRequest request, final ServletResponse response) throws ServletException;
/**
* Handles admin category form requests
* @param response Response instance
* @throws ServletException If something unexpected happened
*/
- public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException;
+ public void doAdminHandleCategoryForms (final ServletRequest request, final ServletResponse response) throws ServletException;
/**
* Some "getter" for a Product instance from given item
import java.util.Iterator;
import javax.servlet.ServletContext;
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;
* @deprecated Old lost
*/
@Deprecated
- private int calculateTotalAmount (final HttpServletRequest request, final HttpSession session) throws ServletException {
+ private int calculateTotalAmount (final ServletRequest request, final HttpSession session) throws ServletException {
// Trace message
this.getLogger().trace(MessageFormat.format("request={0},session={1} - CALLED!", request, session)); //NOI18N
}
@Override
- public String getCheckedHtmlFromProduct (final Product product, final HttpServletRequest request, final HttpSession session) {
+ public String getCheckedHtmlFromProduct (final Product product, final ServletRequest request, final HttpSession session) {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0},request={1},session={2} - CALLED!", product, request, session)); //NOI18N
}
@Override
- public String getDisabledHtmlFromSession (final HttpServletRequest request, final HttpSession session) throws ServletException {
+ public String getDisabledHtmlFromSession (final ServletRequest request, final HttpSession session) throws ServletException {
// Trace message
this.getLogger().trace(MessageFormat.format("request={0},session={1} - CALLED!", request, session)); //NOI18N
}
@Deprecated
- private boolean isProductChoosen (final Product product, final HttpServletRequest request, final HttpSession session) {
+ private boolean isProductChoosen (final Product product, final ServletRequest request, final HttpSession session) {
throw new UnsupportedOperationException("This method is deprecated and shall not be called"); //NOI18N
}
}
@Override
- public void doAdminAddCategory (final HttpServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException {
+ public void doAdminAddCategory (final ServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException {
// Trace message
this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
}
@Override
- public void doAdminAddProduct (final HttpServletRequest request) throws ServletException, ProductTitleAlreadyUsedException {
+ public void doAdminAddProduct (final ServletRequest request) throws ServletException, ProductTitleAlreadyUsedException {
// Trace message
this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
* @throws java.lang.IllegalAccessException If the method cannot be accessed
* @throws java.lang.reflect.InvocationTargetException Any other problems?
*/
- private boolean isProductTitleUsed (final HttpServletRequest request) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ private boolean isProductTitleUsed (final ServletRequest request) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
// Trace message
this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
}
@Override
- public void doAdminHandleProductForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
+ public void doAdminHandleProductForms (final ServletRequest request, final ServletResponse response) throws ServletException {
// Trace message
this.getLogger().trace(MessageFormat.format("request={0},response={1} - CALLED!", request, response)); //NOI18N
// Try this operations
try {
// Is it post?
- if ("POST".equals(request.getMethod())) { //NOI18N
+ if ("POST".equals(((HttpServletRequest) request).getMethod())) { //NOI18N
// Is "add/edit/delete" set?
if (request.getParameter("add") != null) { //NOI18N
// Is it already added?
this.getLogger().debug("Already used, redirecting ..."); //NOI18N
// Already added, so redirect here, else a ServletException will be thrown
- response.sendRedirect(String.format("%s/admin/product.jsp?already=1", request.getContextPath())); //NOI18N
+ ((HttpServletResponse) response).sendRedirect(String.format("%s/admin/product.jsp?already=1", ((HttpServletRequest) request).getContextPath())); //NOI18N
} else {
// Add new product
this.doAdminAddProduct(request);
// Redirect to proper URL
- response.sendRedirect(String.format("%s/admin/product.jsp?added=1", request.getContextPath())); //NOI18N
+ ((HttpServletResponse) response).sendRedirect(String.format("%s/admin/product.jsp?added=1", ((HttpServletRequest) request).getContextPath())); //NOI18N
}
} else if (request.getParameter("edit") != null) { //NOI18N
// TODO
}
@Override
- public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
+ public void doAdminHandleCategoryForms (final ServletRequest request, final ServletResponse response) throws ServletException {
// Trace message
this.getLogger().trace(MessageFormat.format("request={0},response={1} - CALLED!", request, response)); //NOI18N
// Try this operations
try {
// Is it post?
- if ("POST".equals(request.getMethod())) { //NOI18N
+ if ("POST".equals(((HttpServletRequest) request).getMethod())) { //NOI18N
// Is "add/edit/delete" set?
if (request.getParameter("add") != null) { //NOI18N
// Is the category title already used?
this.getLogger().debug("Already used, redirecting ..."); //NOI18N
// Already added, so redirect here, else a ServletException will be thrown
- response.sendRedirect(String.format("%s/admin/category.jsp?already=1", request.getContextPath())); //NOI18N
+ ((HttpServletResponse) response).sendRedirect(String.format("%s/admin/category.jsp?already=1", ((HttpServletRequest) request).getContextPath())); //NOI18N
} else {
// Add new category
this.doAdminAddCategory(request);
// Redirect to proper URL
- response.sendRedirect(String.format("%s/admin/category.jsp?added=1", request.getContextPath())); //NOI18N
+ ((HttpServletResponse) response).sendRedirect(String.format("%s/admin/category.jsp?added=1", ((HttpServletRequest) request).getContextPath())); //NOI18N
}
} else if (request.getParameter("edit") != null) { //NOI18N
// TODO
* @throws java.lang.IllegalAccessException If the method cannot be accessed
* @throws java.lang.reflect.InvocationTargetException Any other problems?
*/
- private boolean isCategoryTitleUsed (final HttpServletRequest request) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ private boolean isCategoryTitleUsed (final ServletRequest request) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
// Trace message
this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
import java.util.Iterator;
import javax.faces.FacesException;
-import javax.servlet.ServletContext;
import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletRequest;
import javax.servlet.http.HttpSession;
-import org.apache.logging.log4j.Logger;
import org.mxchange.jshop.beans.FrameworkBean;
-import org.mxchange.jshop.beans.basket.BasketBean;
import org.mxchange.jshop.category.Category;
import org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException;
import org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException;
* @param session Session instance
* @return Whether the product is choosen
*/
- public String getCheckedHtmlFromProduct (final Product product, final HttpServletRequest request, final HttpSession session);
+ public String getCheckedHtmlFromProduct (final Product product, final ServletRequest request, final HttpSession session);
/**
* Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons
* @return Whether the product is choosen
* @throws javax.servlet.ServletException If something unexpected happened
*/
- public String getDisabledHtmlFromSession (final HttpServletRequest request, final HttpSession session) throws ServletException;
+ public String getDisabledHtmlFromSession (final ServletRequest request, final HttpSession session) throws ServletException;
/**
* Somewhat setter in session
* @throws javax.servlet.ServletException If something unexpected happened
* @throws org.mxchange.jshop.exceptions.CategoryTitleAlreadyUsedException If the given title is already used
*/
- public void doAdminAddCategory (final HttpServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException;
+ public void doAdminAddCategory (final ServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException;
/**
* Adds given product data from request to database
* @throws javax.servlet.ServletException If something unexpected happened
* @throws org.mxchange.jshop.exceptions.ProductTitleAlreadyUsedException If the given product title is already used
*/
- public void doAdminAddProduct (final HttpServletRequest request) throws ServletException, ProductTitleAlreadyUsedException;
+ public void doAdminAddProduct (final ServletRequest request) throws ServletException, ProductTitleAlreadyUsedException;
/**
* Generates link HTML code for given category's parent id, if set. This
/**
* Handles admin product form requests
*
- * @param request Request instance
- * @param response Response instance
* @throws ServletException If something unexpected happened
*/
- public void doAdminHandleProductForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException;
+ public void doAdminHandleProductForms () throws ServletException;
/**
* Handles admin category form requests
*
- * @param request Request instance
- * @param response Response instance
* @throws ServletException If something unexpected happened
*/
- public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException;
-
- /**
- * Getter for logger
- *
- * @return Logger
- */
- public Logger getLogger ();
-
- /**
- * @return the basket
- */
- public BasketBean getBasket ();
-
- /**
- * @param basket the basket to set
- */
- public void setBasket (final BasketBean basket);
-
- /**
- * @return the application
- */
- public ServletContext getApplication ();
-
- /**
- * @param application the application to set
- */
- public void setApplication (final ServletContext application);
+ public void doAdminHandleCategoryForms () throws ServletException;
/**
* Some "getter" for a product from given item
import javax.faces.FacesException;
import javax.inject.Named;
import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletRequest;
import javax.servlet.http.HttpSession;
import org.mxchange.jcore.exceptions.BadTokenException;
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
@PostConstruct
public void init () throws FacesException {
// Trace message
- this.getLogger().trace(MessageFormat.format("application={0},basket={1} - CALLED!", this.getApplication(), this.getBasket())); //NOI18N
+ this.getLogger().trace(MessageFormat.format("application={0} - CALLED!", this.getApplication())); //NOI18N
// Must not be null
if (this.getApplication() == null) {
* @return Whether the product is choosen
*/
@Override
- public String getCheckedHtmlFromProduct (final Product product, final HttpServletRequest request, final HttpSession session) {
+ public String getCheckedHtmlFromProduct (final Product product, final ServletRequest request, final HttpSession session) {
return this.app.getCheckedHtmlFromProduct(product, request, session);
}
* @return Whether the product is choosen
*/
@Override
- public String getDisabledHtmlFromSession (final HttpServletRequest request, final HttpSession session) throws ServletException {
+ public String getDisabledHtmlFromSession (final ServletRequest request, final HttpSession session) throws ServletException {
return this.app.getDisabledHtmlFromSession(request, session);
}
}
@Override
- public void doAdminAddCategory (final HttpServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException {
+ public void doAdminAddCategory (final ServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException {
this.app.doAdminAddCategory(request);
}
@Override
- public void doAdminAddProduct (final HttpServletRequest request) throws ServletException, ProductTitleAlreadyUsedException {
+ public void doAdminAddProduct (final ServletRequest request) throws ServletException, ProductTitleAlreadyUsedException {
this.app.doAdminAddProduct(request);
}
}
@Override
- public void doAdminHandleProductForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
- this.app.doAdminHandleProductForms(request, response);
+ public void doAdminHandleProductForms () throws ServletException {
+ this.app.doAdminHandleProductForms(this.getRequest(), this.getResponse());
}
@Override
- public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
- this.app.doAdminHandleCategoryForms(request, response);
+ public void doAdminHandleCategoryForms () throws ServletException {
+ this.app.doAdminHandleCategoryForms(this.getRequest(), this.getResponse());
}
@Override
<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean" type="PizzaBean" />
<jsp:setProperty name="controller" property="application" value="${pageContext.servletContext}" />
-<jsp:setProperty name="controller" property="basket" value="${basket}" />
+<jsp:setProperty name="controller" property="session" value="${pageContext.session}" />
<%
// TODO: Can be removed later
<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean" type="PizzaBean" />
<jsp:setProperty name="controller" property="application" value="${pageContext.servletContext}" />
+<jsp:setProperty name="controller" property="session" value="${pageContext.session}" />
<%
// TODO: Can be removed later
<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaBean"%>
<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean" type="PizzaBean" />
+<jsp:setProperty name="controller" property="request" value="${pageContext.request}" />
+<jsp:setProperty name="controller" property="response" value="${pageContext.response}" />
+
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="basePath" value="${pageContext.request.contextPath}" />
<%
// Handle forms
- controller.doAdminHandleCategoryForms(request, response);
+ controller.doAdminHandleCategoryForms();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaBean"%>
<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean" type="PizzaBean" />
+<jsp:setProperty name="controller" property="request" value="${pageContext.request}" />
+<jsp:setProperty name="controller" property="response" value="${pageContext.response}" />
+
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="basePath" value="${pageContext.request.contextPath}" />
<%
// Handle forms
- controller.doAdminHandleProductForms(request, response);
+ controller.doAdminHandleProductForms();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">