ExportServlet.java :  » Wiki-Engine » JAMWiki » org » jamwiki » servlets » Java Open Source

Java Open Source » Wiki Engine » JAMWiki 
JAMWiki » org » jamwiki » servlets » ExportServlet.java
/**
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the latest version of the GNU Lesser General
 * Public License as published by the Free Software Foundation;
 *
 * 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program (LICENSE.txt); if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package org.jamwiki.servlets;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jamwiki.utils.WikiLogger;
import org.jamwiki.utils.WikiUtil;
import org.springframework.web.servlet.ModelAndView;

/**
 * This servlet is not currently functional, but is meant to provide
 * capability for exporting topic information in XML format.
 */
public class ExportServlet extends JAMWikiServlet {

  private static final WikiLogger logger = WikiLogger.getLogger(ExportServlet.class.getName());

  /**
   *
   */
  protected ModelAndView handleJAMWikiRequest(HttpServletRequest request, HttpServletResponse response, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    try {
      String virtualWiki = WikiUtil.getVirtualWikiFromURI(request);
      String content = "";
      response.setContentType("text/xml");
      response.setCharacterEncoding("UTF-8");
      PrintWriter out = response.getWriter();
      out.print(content);
      out.close();
    } catch (Exception e) {
      logger.severe("Failure while exporting", e);
    }
    // do not load defaults or redirect - return as raw XML
    return null;
  }

  /**
   *
   */
  protected void initParams() {
    this.layout = false;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.