01: /*
02: *
03: * Copyright 2005 Joe Walker
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18: package uk.ltd.getahead.dwrdemo.simpletext;
19:
20: import java.io.IOException;
21:
22: import javax.servlet.ServletException;
23:
24: import org.directwebremoting.WebContext;
25: import org.directwebremoting.WebContextFactory;
26:
27: /**
28: * Some simple text demos
29: * @author Joe Walker [joe at getahead dot ltd dot uk]
30: */
31: public class Demo {
32: /**
33: * Return a server side string to display on the client in real time
34: * @param name The name of person to say hello to
35: * @return A demo string
36: */
37: public String sayHello(String name) {
38: return "Hello, " + name;
39: }
40:
41: /**
42: * Fetch a resource using forwardToString()
43: * @return a demo HTML page
44: * @throws ServletException If the servlet engine breaks
45: * @throws IOException If the servlet engine breaks
46: */
47: public String getInclude() throws ServletException, IOException {
48: WebContext wctx = WebContextFactory.get();
49: return wctx.forwardToString("/simpletext/forward.html");
50: }
51: }
|