01: /**
02: * Copyright 2006 Webmedia Group Ltd.
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: **/package example;
16:
17: import java.io.Writer;
18: import org.araneaframework.InputData;
19: import org.araneaframework.OutputData;
20: import org.araneaframework.Path;
21: import org.araneaframework.core.BaseService;
22: import org.araneaframework.http.HttpOutputData;
23: import org.araneaframework.jsp.util.JspUtil;
24:
25: public class HelloWorldService extends BaseService {
26: protected void action(Path path, InputData input, OutputData output)
27: throws Exception {
28: ((HttpOutputData) output).setContentType("text/html");
29: Writer out = ((HttpOutputData) output).getWriter();
30:
31: try {
32: JspUtil.writeStartTag(out, "html");
33: {
34: JspUtil.writeStartTag(out, "head");
35: {
36: JspUtil.writeStartTag(out, "title");
37: {
38: out.write("Hello world!");
39: }
40: JspUtil.writeEndTag(out, "title");
41: }
42: JspUtil.writeEndTag(out, "head");
43:
44: JspUtil.writeStartTag(out, "body");
45: {
46: JspUtil.writeStartTag(out, "h1");
47: {
48: out.write("Hello world!");
49: }
50: JspUtil.writeEndTag(out, "h1");
51: }
52: JspUtil.writeEndTag(out, "body");
53:
54: }
55: JspUtil.writeEndTag(out, "html");
56:
57: out.flush();
58: } finally {
59: out.close();
60: }
61: }
62: }
|