KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > getahead > dwrdemo > simpletext > Demo


1 /*
2  * Copyright 2005 Joe Walker
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 package org.getahead.dwrdemo.simpletext;
17
18 import java.io.IOException JavaDoc;
19
20 import javax.servlet.ServletException JavaDoc;
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     /**
32      * Return a server side string to display on the client in real time
33      * @param name The name of person to say hello to
34      * @return A demo string
35      */

36     public String JavaDoc sayHello(String JavaDoc name)
37     {
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 JavaDoc getInclude() throws ServletException JavaDoc, IOException JavaDoc
48     {
49         WebContext wctx = WebContextFactory.get();
50         return wctx.forwardToString("/simpletext/forward.html");
51     }
52 }
53
Popular Tags