KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > servlet > view > DummyMacroRequestContext


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.web.servlet.view;
18
19 import java.util.Map JavaDoc;
20
21 import org.springframework.beans.TestBean;
22
23 /**
24  * used for VTL and FTL macro tests
25  *
26  * @author Darren Davison
27  * @since 25-Jan-05
28  */

29 public class DummyMacroRequestContext {
30     Map JavaDoc msgMap;
31     String JavaDoc contextPath;
32     TestBean command;
33
34     public String JavaDoc getMessage(String JavaDoc code) {
35         return (String JavaDoc) msgMap.get(code);
36     }
37     public String JavaDoc getMessage(String JavaDoc code, String JavaDoc defaultMsg) {
38         String JavaDoc msg = (String JavaDoc) msgMap.get(code);
39         return (msg == null) ? defaultMsg : msg;
40     }
41     public DummyBindStatus getBindStatus(String JavaDoc path) throws IllegalStateException JavaDoc {
42         return new DummyBindStatus();
43     }
44     public DummyBindStatus getBindStatus(String JavaDoc path, boolean htmlEscape) throws IllegalStateException JavaDoc {
45         return new DummyBindStatus();
46     }
47
48     public String JavaDoc getContextPath() {
49         return contextPath;
50     }
51     public void setContextPath(String JavaDoc contextPath) {
52         this.contextPath = contextPath;
53     }
54     public void setMsgMap(Map JavaDoc msgMap) {
55         this.msgMap = msgMap;
56     }
57     public TestBean getCommand() {
58         return command;
59     }
60     public void setCommand(TestBean command) {
61         this.command = command;
62     }
63     
64     public class DummyBindStatus {
65         public String JavaDoc getExpression() {
66             return "name";
67         }
68         public String JavaDoc getValue() {
69             return "Darren";
70         }
71     }
72 }
73
74
Popular Tags