Java tutorial
/* * Copyright Siemens AG, 2015. Part of the SW360 Portal Project. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License Version 2.0 as published by the * Free Software Foundation with classpath exception. * * 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 version 2.0 for * more details. * * You should have received a copy of the GNU General Public License along with * this program (please see the COPYING file); if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ package com.siemens.sw360.projects; import org.apache.log4j.Logger; import org.apache.thrift.TProcessor; import org.apache.thrift.protocol.TProtocolFactory; import org.apache.thrift.server.TServlet; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import static org.apache.log4j.Logger.getLogger; /** * @author Andreas.Reichel@tngtech.com */ public class Sw360ThriftServlet extends TServlet { private static final Logger log = getLogger(Sw360ThriftServlet.class); public Sw360ThriftServlet(TProcessor processor, TProtocolFactory protocolFactory) { super(processor, protocolFactory); } public Sw360ThriftServlet(TProcessor processor, TProtocolFactory inProtocolFactory, TProtocolFactory outProtocolFactory) { super(processor, inProtocolFactory, outProtocolFactory); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { super.doPost(request, response); } catch (Exception e) { log.error("uncaught", e); throw e; } } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { super.doGet(request, response); } catch (Exception e) { log.error("uncaught", e); throw e; } } }