01: package ru.emdev.EmForge.wiki.beanwrapper;
02:
03: import java.io.IOException;
04: import java.util.Properties;
05:
06: import javax.servlet.http.HttpServletRequest;
07:
08: import org.springframework.context.ApplicationContext;
09:
10: import ru.emdev.EmForge.wiki.JspWikiEngineBean;
11:
12: import com.ecyrd.jspwiki.WikiEngine;
13: import com.ecyrd.jspwiki.url.URLConstructor;
14:
15: /** Bean Wrapper for URLConstructor used for passing URLConstructor, defined as Spring-Bean
16: * into JspWiki Engine via properties
17: * @author akakunin
18: *
19: */
20: public class UrlConstructorWrapper implements URLConstructor {
21: protected static final String BEAN_NAME_PROPERTY = "jspwiki.spring.urlConstructor";
22: protected URLConstructor m_bean;
23:
24: public void initialize(WikiEngine arg0, Properties arg1) {
25: ApplicationContext appContext = (ApplicationContext) arg1
26: .get(JspWikiEngineBean.SPRING_CONTEXT_PROPERTY);
27:
28: m_bean = (URLConstructor) appContext.getBean(arg1
29: .getProperty(BEAN_NAME_PROPERTY));
30:
31: m_bean.initialize(arg0, arg1);
32: }
33:
34: public String getForwardPage(HttpServletRequest arg0) {
35: return m_bean.getForwardPage(arg0);
36: }
37:
38: public String makeURL(String arg0, String arg1, boolean arg2,
39: String arg3) {
40: return m_bean.makeURL(arg0, arg1, arg2, arg3);
41: }
42:
43: public String parsePage(String arg0, HttpServletRequest arg1,
44: String arg2) throws IOException {
45: return m_bean.parsePage(arg0, arg1, arg2);
46: }
47:
48: }
|