01: package pygmy.nntp.http;
02:
03: import pygmy.core.HttpRequest;
04:
05: import java.io.IOException;
06:
07: public class DocumentView extends ViewDecorator {
08:
09: String css;
10:
11: public DocumentView(String urlPrefix, String css, View view) {
12: super (urlPrefix, view);
13: this .css = css;
14: }
15:
16: protected void addHtmlHeader(String styleSheet) {
17: buffer.append("<html>\n");
18: buffer.append("<head>\n");
19: buffer
20: .append("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
21: buffer.append(styleSheet);
22: buffer.append("\">\n");
23: buffer.append("</head>\n");
24: }
25:
26: public String render(HttpRequest request) throws IOException {
27: addHtmlHeader(css);
28: buffer.append("<body>\n");
29: buffer.append(super .render(request));
30: buffer.append("</body>\n");
31: buffer.append("</html>\n");
32:
33: return buffer.toString();
34: }
35:
36: }
|