View Javadoc

1   /*
2    * SymmetricDS is an open source database synchronization solution.
3    *   
4    * Copyright (C) Chris Henson <chenson42@users.sourceforge.net>,
5    *               Eric Long <erilong@users.sourceforge.net>,
6    *               Keith Naas <knaas@users.sourceforge.net>
7    *
8    * This library is free software; you can redistribute it and/or
9    * modify it under the terms of the GNU Lesser General Public
10   * License as published by the Free Software Foundation; either
11   * version 3 of the License, or (at your option) any later version.
12   *
13   * This library is distributed in the hope that it will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16   * Lesser General Public License for more details.
17   *
18   * You should have received a copy of the GNU Lesser General Public
19   * License along with this library; if not, see
20   * <http://www.gnu.org/licenses/>.
21   */
22  
23  package org.jumpmind.symmetric.web;
24  
25  import java.io.IOException;
26  
27  import javax.servlet.ServletException;
28  import javax.servlet.http.HttpServletRequest;
29  import javax.servlet.http.HttpServletResponse;
30  
31  import org.apache.commons.logging.Log;
32  import org.apache.commons.logging.LogFactory;
33  import org.jumpmind.symmetric.transport.handler.AlertResourceHandler;
34  
35  import com.sun.syndication.io.FeedException;
36  
37  /***
38   * This is a place holder for the idea that we could create an RSS feed for
39   * alerts.
40   */
41  public class AlertServlet extends AbstractTransportResourceServlet<AlertResourceHandler> {
42  
43      private static final long serialVersionUID = 1L;
44  
45      private static final Log logger = LogFactory.getLog(AlertServlet.class);
46  
47      @Override
48      public boolean isContainerCompatible() {
49          return true;
50      }
51  
52      @Override
53      public void handleGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException,
54              FeedException {
55  
56          resp.setContentType("application/rss+xml");
57          getTransportResourceHandler().write(req.getRequestURL(), resp.getWriter());
58      }
59  
60      @Override
61      protected Log getLogger() {
62          return logger;
63      }
64  
65  }