package com.lgx8.gateway.search.servlet;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.lgx8.common.entities.GatewayConfig;
import com.lgx8.gateway.entities.AreaCategory;
import com.lgx8.gateway.entities.Category;
import freemarker.template.Configuration;
/**
* Servlet implementation class GoodProductBaseServlet
*/
public class SearchBaseServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public SearchBaseServlet() {
super();
// TODO Auto-generated constructor stub
}
private Configuration configuration;
public Map<Object, Object> base = new HashMap<Object, Object>();
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
/**
* @see Servlet#init(ServletConfig)
*/
@SuppressWarnings("unchecked")
public void init(ServletConfig config) throws ServletException {
super.init(config);
configuration = new Configuration();
configuration.setServletContextForTemplateLoading(getServletContext(), "ftl/gateway");
configuration.setDefaultEncoding("UTF-8");
GatewayConfig gatewayConfig = (GatewayConfig) getServletContext().getAttribute("gatewayConfig");
base.put("gatewayConfig", gatewayConfig);
List<AreaCategory> areaCategorys = (List<AreaCategory>) getServletContext().getAttribute("areaCategorys");
base.put("areaCategorys", areaCategorys);
List<Category> categorys = (List<Category>) getServletContext().getAttribute("categorys");
base.put("categorys", categorys);
}
/**
* @see Servlet#destroy()
*/
public void destroy() {
super.destroy();
configuration = null;
}
public Configuration getConfiguration() {
return configuration;
}
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
}
}