01: package com.mockrunner.mock.web;
02:
03: import javax.servlet.Servlet;
04: import javax.servlet.ServletContext;
05: import javax.servlet.ServletRequest;
06: import javax.servlet.ServletResponse; //import javax.servlet.jsp.JspApplicationContext;
07: import javax.servlet.jsp.JspEngineInfo;
08: import javax.servlet.jsp.JspFactory;
09: import javax.servlet.jsp.PageContext;
10:
11: /**
12: * Mock implementation of <code>JspFactory</code>.
13: * This implementation returns <code>null</code>
14: * for {@link #getJspApplicationContext}. For full
15: * support of <code>JspApplicationContext</code> use
16: * {@link JasperJspFactory}.
17: */
18: public class MockJspFactory extends JspFactory {
19: private JspEngineInfo engineInfo;
20: //private JspApplicationContext applicationContext;
21: private PageContext pageContext;
22:
23: public MockJspFactory() {
24: engineInfo = new MockJspEngineInfo();
25: }
26:
27: /**
28: * Set the <code>JspEngineInfo</code>. Per default,
29: * {@link MockJspEngineInfo} is used.
30: * @param engineInfo the <code>JspEngineInfo</code>
31: */
32: public void setEngineInfo(JspEngineInfo engineInfo) {
33: this .engineInfo = engineInfo;
34: }
35:
36: /**
37: * Set the <code>JspApplicationContext</code>.
38: * @param applicationContext the <code>JspApplicationContext</code>
39: */
40: /*public void setJspApplicationContext(JspApplicationContext applicationContext)
41: {
42: this.applicationContext = applicationContext;
43: }*/
44:
45: /**
46: * Set the <code>PageContext</code>.
47: * @param pageContext the <code>PageContext</code>
48: */
49: public void setPageContext(PageContext pageContext) {
50: this .pageContext = pageContext;
51: }
52:
53: /**
54: * Returns the <code>PageContext</code>.
55: * @return the <code>PageContext</code>
56: */
57: public PageContext getPageContext() {
58: return pageContext;
59: }
60:
61: public JspEngineInfo getEngineInfo() {
62: return engineInfo;
63: }
64:
65: /*public JspApplicationContext getJspApplicationContext(ServletContext context)
66: {
67: return applicationContext;
68: }*/
69:
70: public PageContext getPageContext(Servlet servlet,
71: ServletRequest request, ServletResponse response,
72: String errorPageURL, boolean needsSession, int buffer,
73: boolean autoflush) {
74: return pageContext;
75: }
76:
77: public void releasePageContext(PageContext pageContext) {
78:
79: }
80: }
|