KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > views > jsp > WebWorkMockServletContext


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.webwork.views.jsp;
6
7 import javax.servlet.RequestDispatcher JavaDoc;
8 import javax.servlet.Servlet JavaDoc;
9 import javax.servlet.ServletContext JavaDoc;
10 import javax.servlet.ServletException JavaDoc;
11 import java.io.InputStream JavaDoc;
12 import java.net.MalformedURLException JavaDoc;
13 import java.net.URL JavaDoc;
14 import java.util.*;
15
16
17 /**
18  * WebWorkMockServletContext
19  *
20  * @author Jason Carreira
21  * Created Jun 6, 2003 12:32:10 AM
22  */

23 public class WebWorkMockServletContext implements ServletContext JavaDoc {
24
25     String JavaDoc realPath;
26     String JavaDoc servletInfo;
27     Map initParams = new HashMap();
28     Map attributes = new HashMap();
29
30     public void setInitParameter(String JavaDoc name, String JavaDoc value) {
31         initParams.put(name, value);
32     }
33
34     public void setRealPath(String JavaDoc value) {
35         realPath = value;
36     }
37
38     public String JavaDoc getRealPath(String JavaDoc string) {
39         return realPath;
40     }
41
42     public ServletContext JavaDoc getContext(String JavaDoc s) {
43         return null;
44     }
45
46     public int getMajorVersion() {
47         return 0;
48     }
49
50     public int getMinorVersion() {
51         return 0;
52     }
53
54     public String JavaDoc getMimeType(String JavaDoc s) {
55         return null;
56     }
57
58     public Set getResourcePaths(String JavaDoc s) {
59         return null;
60     }
61
62     public URL JavaDoc getResource(String JavaDoc s) throws MalformedURLException JavaDoc {
63         return null;
64     }
65
66     public InputStream JavaDoc getResourceAsStream(String JavaDoc s) {
67         return null;
68     }
69
70     public RequestDispatcher JavaDoc getRequestDispatcher(String JavaDoc s) {
71         return null;
72     }
73
74     public RequestDispatcher JavaDoc getNamedDispatcher(String JavaDoc s) {
75         return null;
76     }
77
78     public Servlet JavaDoc getServlet(String JavaDoc s) throws ServletException JavaDoc {
79         return null;
80     }
81
82     public Enumeration getServlets() {
83         return null;
84     }
85
86     public Enumeration getServletNames() {
87         return null;
88     }
89
90     public void log(String JavaDoc s) {
91     }
92
93     public void log(Exception JavaDoc e, String JavaDoc s) {
94     }
95
96     public void log(String JavaDoc s, Throwable JavaDoc throwable) {
97     }
98
99     public String JavaDoc getServerInfo() {
100         return servletInfo;
101     }
102
103     public String JavaDoc getInitParameter(String JavaDoc s) {
104         return (String JavaDoc) initParams.get(s);
105     }
106
107     public Enumeration getInitParameterNames() {
108         return Collections.enumeration(initParams.keySet());
109     }
110
111     public Object JavaDoc getAttribute(String JavaDoc s) {
112         return attributes.get(s);
113     }
114
115     public Enumeration getAttributeNames() {
116         return Collections.enumeration(attributes.keySet());
117     }
118
119     public void setAttribute(String JavaDoc s, Object JavaDoc o) {
120         attributes.put(s, o);
121     }
122
123     public void removeAttribute(String JavaDoc s) {
124         attributes.remove(s);
125     }
126
127     public String JavaDoc getServletContextName() {
128         return null;
129     }
130
131     public void setServletInfo(String JavaDoc servletInfo) {
132         this.servletInfo = servletInfo;
133     }
134 }
135
Popular Tags