/* * The contents of this file are subject to the Mozilla Public License Version 1.1 * (the "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at . * * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT * WARRANTY OF ANY KIND, either express or implied. See the License for the specific * language governing rights and limitations under the License. * * The Original Code is the Venice Web Community System. * * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * * Contributor(s): */ package com.silverwrist.venice.servlets; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.log4j.*; import com.silverwrist.venice.core.*; import com.silverwrist.venice.servlets.format.*; public abstract class VeniceServlet extends HttpServlet { /*-------------------------------------------------------------------------------- * Static data values *-------------------------------------------------------------------------------- */ private static Category logger = Category.getInstance(VeniceServlet.class.getName()); /*-------------------------------------------------------------------------------- * Internal operations intended for use by derived classes *-------------------------------------------------------------------------------- */ protected static boolean isImageButtonClicked(ServletRequest request, String name) { String val = request.getParameter(name + ".x"); return (val!=null); } // end isImageButtonClicked protected static VeniceEngine getVeniceEngine(ServletContext ctxt) throws ServletException { return Variables.getVeniceEngine(ctxt); } // end getVeniceEngine protected VeniceEngine getVeniceEngine() throws ServletException { return Variables.getVeniceEngine(getServletContext()); } // end getVeniceEngine protected UserContext getUserContext(HttpServletRequest request) throws ServletException { return Variables.getUserContext(getServletContext(),request,request.getSession(true)); } // end getUserContext protected void putUserContext(HttpServletRequest request, UserContext ctxt) { Variables.putUserContext(request.getSession(true),ctxt); } // end putUserContext protected void clearUserContext(HttpServletRequest request) { Variables.clearUserContext(request.getSession(true)); } // end clearUserContext protected static List getCountryList(ServletContext ctxt) throws ServletException { return Variables.getCountryList(ctxt); } // end getCountryList protected List getCountryList() throws ServletException { return Variables.getCountryList(getServletContext()); } // end getCountryList protected List getLanguageList(ServletContext ctxt) throws ServletException { return Variables.getLanguageList(ctxt); } // end getLanguageList protected List getLanguageList() throws ServletException { return Variables.getLanguageList(getServletContext()); } // end getLanguageList protected void changeMenuTop(HttpServletRequest request) { Variables.setMenuTop(getServletContext(),request.getSession(true)); } // end changeMenuTop protected void changeMenuSIG(HttpServletRequest request, SIGContext sig) { Variables.setMenuSIG(request.getSession(true),sig); } // end changeMenuSIG protected void clearMenu(HttpServletRequest request) { Variables.clearMenu(request.getSession(true)); } // end clearMenu protected RenderData createRenderData(HttpServletRequest request, HttpServletResponse response) throws ServletException { return RenderConfig.createRenderData(getServletContext(),request,response); } // end createRenderData } // end class VeniceServlet