001: //WebOnSwing - Web Application Framework
002: //Copyright (C) 2003 Fernando Damian Petrola
003: //
004: //This library is free software; you can redistribute it and/or
005: //modify it under the terms of the GNU Lesser General Public
006: //License as published by the Free Software Foundation; either
007: //version 2.1 of the License, or (at your option) any later version.
008: //
009: //This library is distributed in the hope that it will be useful,
010: //but WITHOUT ANY WARRANTY; without even the implied warranty of
011: //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: //Lesser General Public License for more details.
013: //
014: //You should have received a copy of the GNU Lesser General Public
015: //License along with this library; if not, write to the Free Software
016: //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017:
018: package examples;
019:
020: import java.io.*;
021: import java.security.*;
022: import java.util.*;
023:
024: import javax.servlet.*;
025: import javax.servlet.http.*;
026:
027: import net.ar.webonswing.servlets.*;
028:
029: public class TestServlet {
030: public static void main(String[] args) throws ServletException,
031: IOException {
032: WebOnSwingServlet theServlet = new WebOnSwingServlet();
033: theServlet.init();
034: theServlet.service(new MyRequest("",
035: "/WosExamples/CheckBoxDemo.page", new HashMap()),
036: new MyResponse(new PrintWriter(System.out, true)));
037: }
038:
039: static class MyResponse implements HttpServletResponse {
040: private PrintWriter theWriter;
041:
042: public MyResponse(PrintWriter aWriter) {
043: theWriter = aWriter;
044: }
045:
046: public void addCookie(Cookie arg0) {
047:
048: }
049:
050: public boolean containsHeader(String arg0) {
051:
052: return false;
053: }
054:
055: public String encodeURL(String arg0) {
056:
057: return null;
058: }
059:
060: public String encodeRedirectURL(String arg0) {
061:
062: return null;
063: }
064:
065: public String encodeUrl(String arg0) {
066:
067: return null;
068: }
069:
070: public String encodeRedirectUrl(String arg0) {
071:
072: return null;
073: }
074:
075: public void sendError(int arg0, String arg1) throws IOException {
076:
077: }
078:
079: public void sendError(int arg0) throws IOException {
080:
081: }
082:
083: public void sendRedirect(String arg0) throws IOException {
084:
085: }
086:
087: public void setDateHeader(String arg0, long arg1) {
088:
089: }
090:
091: public void addDateHeader(String arg0, long arg1) {
092:
093: }
094:
095: public void setHeader(String arg0, String arg1) {
096:
097: }
098:
099: public void addHeader(String arg0, String arg1) {
100:
101: }
102:
103: public void setIntHeader(String arg0, int arg1) {
104:
105: }
106:
107: public void addIntHeader(String arg0, int arg1) {
108:
109: }
110:
111: public void setStatus(int arg0) {
112:
113: }
114:
115: public void setStatus(int arg0, String arg1) {
116:
117: }
118:
119: public String getCharacterEncoding() {
120:
121: return null;
122: }
123:
124: public ServletOutputStream getOutputStream() throws IOException {
125:
126: return null;
127: }
128:
129: public PrintWriter getWriter() throws IOException {
130: return theWriter;
131: }
132:
133: public void setContentLength(int arg0) {
134:
135: }
136:
137: public void setContentType(String arg0) {
138:
139: }
140:
141: public void setBufferSize(int arg0) {
142:
143: }
144:
145: public int getBufferSize() {
146:
147: return 0;
148: }
149:
150: public void flushBuffer() throws IOException {
151:
152: }
153:
154: public void resetBuffer() {
155:
156: }
157:
158: public boolean isCommitted() {
159:
160: return false;
161: }
162:
163: public void reset() {
164:
165: }
166:
167: public void setLocale(Locale arg0) {
168:
169: }
170:
171: public Locale getLocale() {
172:
173: return null;
174: }
175:
176: }
177:
178: static class MyRequest implements HttpServletRequest {
179: private Map theParameters;
180: private String theServletPath;
181: private String theContextPath;
182:
183: public MyRequest(String aContextPath, String aServletPath,
184: Map aParameters) {
185: theContextPath = aContextPath;
186: theServletPath = aServletPath;
187: theParameters = aParameters;
188: }
189:
190: public String getAuthType() {
191:
192: return null;
193: }
194:
195: public Cookie[] getCookies() {
196:
197: return null;
198: }
199:
200: public long getDateHeader(String arg0) {
201:
202: return 0;
203: }
204:
205: public String getHeader(String arg0) {
206:
207: return null;
208: }
209:
210: public Enumeration getHeaders(String arg0) {
211:
212: return null;
213: }
214:
215: public Enumeration getHeaderNames() {
216:
217: return null;
218: }
219:
220: public int getIntHeader(String arg0) {
221:
222: return 0;
223: }
224:
225: public String getMethod() {
226:
227: return null;
228: }
229:
230: public String getPathInfo() {
231:
232: return null;
233: }
234:
235: public String getPathTranslated() {
236:
237: return null;
238: }
239:
240: public String getContextPath() {
241: return theContextPath;
242: }
243:
244: public String getQueryString() {
245:
246: return null;
247: }
248:
249: public String getRemoteUser() {
250:
251: return null;
252: }
253:
254: public boolean isUserInRole(String arg0) {
255:
256: return false;
257: }
258:
259: public Principal getUserPrincipal() {
260:
261: return null;
262: }
263:
264: public String getRequestedSessionId() {
265:
266: return null;
267: }
268:
269: public String getRequestURI() {
270:
271: return null;
272: }
273:
274: public StringBuffer getRequestURL() {
275:
276: return null;
277: }
278:
279: public String getServletPath() {
280: return theServletPath;
281: }
282:
283: public HttpSession getSession(boolean arg0) {
284:
285: return null;
286: }
287:
288: public HttpSession getSession() {
289:
290: return null;
291: }
292:
293: public boolean isRequestedSessionIdValid() {
294:
295: return false;
296: }
297:
298: public boolean isRequestedSessionIdFromCookie() {
299:
300: return false;
301: }
302:
303: public boolean isRequestedSessionIdFromURL() {
304:
305: return false;
306: }
307:
308: public boolean isRequestedSessionIdFromUrl() {
309:
310: return false;
311: }
312:
313: public Object getAttribute(String arg0) {
314:
315: return null;
316: }
317:
318: public Enumeration getAttributeNames() {
319:
320: return null;
321: }
322:
323: public String getCharacterEncoding() {
324:
325: return null;
326: }
327:
328: public void setCharacterEncoding(String arg0)
329: throws UnsupportedEncodingException {
330:
331: }
332:
333: public int getContentLength() {
334:
335: return 0;
336: }
337:
338: public String getContentType() {
339:
340: return null;
341: }
342:
343: public ServletInputStream getInputStream() throws IOException {
344:
345: return null;
346: }
347:
348: public String getParameter(String arg0) {
349:
350: return null;
351: }
352:
353: public Enumeration getParameterNames() {
354: return new Enumeration() {
355: public boolean hasMoreElements() {
356: return false;
357: }
358:
359: public Object nextElement() {
360: return null;
361: }
362: };
363: }
364:
365: public String[] getParameterValues(String arg0) {
366:
367: return null;
368: }
369:
370: public Map getParameterMap() {
371: return theParameters;
372: }
373:
374: public String getProtocol() {
375:
376: return null;
377: }
378:
379: public String getScheme() {
380:
381: return null;
382: }
383:
384: public String getServerName() {
385:
386: return null;
387: }
388:
389: public int getServerPort() {
390:
391: return 0;
392: }
393:
394: public BufferedReader getReader() throws IOException {
395:
396: return null;
397: }
398:
399: public String getRemoteAddr() {
400:
401: return null;
402: }
403:
404: public String getRemoteHost() {
405:
406: return null;
407: }
408:
409: public void setAttribute(String arg0, Object arg1) {
410:
411: }
412:
413: public void removeAttribute(String arg0) {
414:
415: }
416:
417: public Locale getLocale() {
418:
419: return null;
420: }
421:
422: public Enumeration getLocales() {
423:
424: return null;
425: }
426:
427: public boolean isSecure() {
428:
429: return false;
430: }
431:
432: public RequestDispatcher getRequestDispatcher(String arg0) {
433:
434: return null;
435: }
436:
437: public String getRealPath(String arg0) {
438:
439: return null;
440: }
441: }
442:
443: }
|