Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CGITool |
|
| 4.0;4 |
1 | /* | |
2 | * Copyright (C) 1998-2000 Semiotek Inc. All Rights Reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted under the terms of either of the following | |
6 | * Open Source licenses: | |
7 | * | |
8 | * The GNU General Public License, version 2, or any later version, as | |
9 | * published by the Free Software Foundation | |
10 | * (http://www.fsf.org/copyleft/gpl.html); | |
11 | * | |
12 | * or | |
13 | * | |
14 | * The Semiotek Public License (http://webmacro.org/LICENSE.) | |
15 | * | |
16 | * This software is provided "as is", with NO WARRANTY, not even the | |
17 | * implied warranties of fitness to purpose, or merchantability. You | |
18 | * assume all risks and liabilities associated with its use. | |
19 | * | |
20 | * See www.webmacro.org for more information on the WebMacro project. | |
21 | */ | |
22 | ||
23 | ||
24 | package org.webmacro.servlet; | |
25 | ||
26 | import org.webmacro.Context; | |
27 | import org.webmacro.ContextTool; | |
28 | import org.webmacro.PropertyException; | |
29 | ||
30 | /** | |
31 | * Provide Template variables that implement the CGI standard for | |
32 | * script variable names. | |
33 | */ | |
34 | 63 | public class CGITool extends ContextTool |
35 | { | |
36 | public Object init (Context context) | |
37 | throws PropertyException | |
38 | { | |
39 | try | |
40 | { | |
41 | 0 | WebContext wc = (WebContext) context; |
42 | 0 | CGI_Impersonator cgi = new CGI_Impersonator(wc); |
43 | 0 | return cgi; |
44 | } | |
45 | 0 | catch (ClassCastException ce) |
46 | { | |
47 | 0 | throw new PropertyException( |
48 | "CGITool only works with WebContext", ce); | |
49 | } | |
50 | } | |
51 | ||
52 | } |