01: /*
02: * Created on May 5, 2006
03: */
04: package uk.org.ponder.rsf.content;
05:
06: /** A "pea" holding information about a particular content type that may
07: * be used during a request cycle.
08: * @author Antranig Basman (antranig@caret.cam.ac.uk)
09: *
10: */
11:
12: public class ContentTypeInfo {
13: /** A constant representing the standard "full" ID allocation strategy,
14: * derived from the full ID of a component. This will only be applied to
15: * tags which already have an XML id attribute supplied in the template.
16: * Appropriate for HTML and similar dialects.
17: */
18: public static final String ID_FULL = "full";
19:
20: /** The same strategy as {@link #ID_FULL}, only the id attribute will be
21: * written onto every rendered tag (same as RSF pre-0.7 "full" strategy).
22: */
23: public static final String ID_FORCE = "force";
24: /** Suppress generation of the "id" attribute. Appropriate for some types
25: * of pure XML response.
26: */
27: public static final String ID_NONE = "none";
28: /** Pass through the rsf:id attribute unchanged. Appropriate for the
29: * (so far untried) strategy of using RSF to render RSF templates.
30: */
31: public static final String ID_RSF = "RSF";
32:
33: /** The name of the content/request type - e.g. HTML for html, AJAX for
34: * (XML) AJAX, XUL for XUL etc - {@link ContentTypeInfoRegistry} for examples.
35: */
36: public String typename;
37: /** The extension, omitting period ".", to be used when looking for templates
38: * in the filesystem.
39: */
40: public String fileextension;
41: /** The XML declaration to be served at the head of rendered content **/
42: public String declaration;
43: /** The value for the "ContentType" header served over HTTP for requests
44: * of this type.
45: */
46: public String contentTypeHeader;
47:
48: /** The strategy to be used for generating the values of "ID" elements - either
49: * ID_FULL, ID_NONE, or ID_RSF
50: */
51: public String IDStrategy;
52:
53: /** Whether the content type supports "direct" Action -> Render redirects.
54: */
55: public boolean directRedirects = true;
56:
57: public ContentTypeInfo() {
58: }
59:
60: public ContentTypeInfo(String typename, String fileextension,
61: String declaration, String contentTypeHeader) {
62: this .typename = typename;
63: this .fileextension = fileextension;
64: this .declaration = declaration;
65: this .contentTypeHeader = contentTypeHeader;
66: this .IDStrategy = ID_NONE;
67: }
68:
69: public ContentTypeInfo(String typename, String fileextension,
70: String declaration, String contentTypeHeader,
71: String IDStrategy, boolean directRedirects) {
72: this .typename = typename;
73: this .fileextension = fileextension;
74: this .declaration = declaration;
75: this .contentTypeHeader = contentTypeHeader;
76: this .IDStrategy = IDStrategy;
77: this .directRedirects = directRedirects;
78: }
79:
80: /** Pea proxying method **/
81: public ContentTypeInfo get() {
82: return this;
83: }
84: }
|