01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.getahead.dwrdemo.simpletext;
17:
18: import java.io.IOException;
19:
20: import javax.servlet.ServletException;
21:
22: import org.directwebremoting.WebContext;
23: import org.directwebremoting.WebContextFactory;
24:
25: /**
26: * Some simple text demos
27: * @author Joe Walker [joe at getahead dot ltd dot uk]
28: */
29: public class Demo {
30: /**
31: * Return a server side string to display on the client in real time
32: * @param name The name of person to say hello to
33: * @return A demo string
34: */
35: public String sayHello(String name) {
36: return "Hello, " + name;
37: }
38:
39: /**
40: * Fetch a resource using forwardToString()
41: * @return a demo HTML page
42: * @throws ServletException If the servlet engine breaks
43: * @throws IOException If the servlet engine breaks
44: */
45: public String getInclude() throws ServletException, IOException {
46: WebContext wctx = WebContextFactory.get();
47: return wctx.forwardToString("/simpletext/forward.html");
48: }
49: }
|