01: package ru.emdev.EmForge.wiki.web;
02:
03: import java.io.IOException;
04:
05: import javax.servlet.ServletConfig;
06: import javax.servlet.ServletException;
07: import javax.servlet.http.HttpServletRequest;
08: import javax.servlet.http.HttpServletResponse;
09: import javax.xml.transform.TransformerFactory;
10:
11: import org.apache.fop.apps.FopFactory;
12: import org.springframework.web.context.WebApplicationContext;
13: import org.springframework.web.context.support.WebApplicationContextUtils;
14:
15: import com.ecyrd.jspwiki.WikiEngine;
16: import com.palbrattberg.jspwiki.Wiki2PDFServlet;
17:
18: /** This Servlet is based on original Wiki2PDFServlet and only change the way how WikiEngine is initialized
19: *
20: */
21: public class PDFServlet extends Wiki2PDFServlet {
22: private static final long serialVersionUID = 1257511578300524900L;
23:
24: @Override
25: public void init(ServletConfig i_config) throws ServletException {
26: //m_wikiEngine = WikiEngine.getInstance(i_config);
27: // wiki engine will be initialized later in request
28: m_transformerFactory = TransformerFactory.newInstance();
29: m_fopFactory = FopFactory.newInstance();
30: }
31:
32: @Override
33: public void doGet(HttpServletRequest i_req,
34: HttpServletResponse i_res) throws IOException,
35: ServletException {
36: // initialize wikiEngine
37: WebApplicationContext appContext = WebApplicationContextUtils
38: .getWebApplicationContext(i_req.getSession()
39: .getServletContext());
40:
41: //get wiki engine from spring
42: m_wikiEngine = (WikiEngine) appContext.getBean("wikiEngine");
43:
44: // TODO Auto-generated method stub
45: super.doGet(i_req, i_res);
46: }
47:
48: }
|