|Home >> All >> com >> opensymphony >> module|
HTMLPage: Extension of Page providing access to HTML data. The page is parsed and the <title> , <head> (minus the <title> ) and <body> are split into chunks. These can then be used by a Decorator . Properties are also extracted from the HTML. Page Properties When the page is parsed, values from certain tags are added to the properties to allow easy access to them. The following tags have properties extracted from them. HTML Tag All attributes of the <html> tag shall be added as properties. TITLE Tag The contents of the <title> tag shall be added as the title property. ...
Page: The Page object wraps the contents of the original (undecorated) page. The original data in its entirity can be written using the writePage() methods. It may also contain a set of properties - these vary among different PageParser implementations. Typically a Page is no use to a Decorator as it needs specific details relevant to the content-type of that page ( e.g. HTML pages). The appropriate PageParser is responsible for returning extended implementations of pages such as HTMLPage which are of more use to the Decorator. New media types ( e.g. WML) could be added to the system by extending Page ...
AgentDecoratorMapper: The AgentDecoratorMapper can determine the user-agent (i.e. web-browser) requesting a page, and map to a suitable Decorator. This can be useful for supplying different versions of the same content for different browsers (e.g. vanilla HTML for Lynx, complex tables and frames for Netscape, extra stuff for IE5, etc). This can also be used to enhance search-engine ratings by using a 'bait and switch' system - this involves showing a search-engine friendly of the content to spiders only. When AgentDecoratorMapper is in the chain, it will request the appropriate Decorator from its parent. It will then ...
ApplyDecoratorTag: This tag inserts an external resource as a panel into the current Page. The page attribute should point to the panel resource which should expose an entire page (e.g. another JSP file producing HTML). This attribute can be relative to the page it is being called from or an absolute path from the context-root. OR If the page attribute is not specified, the body content is parsed into the com.opensymphony.module.sitemesh.Page object and has the com.opensymphony.module.sitemesh.Decorator applied. The (optional) decorator attribute is the name of the com.opensymphony.module.sitemesh.Decorator to apply ...
ParameterDecoratorMapper: The ParameterDecoratorMapper will map a suitable decorator based on request parameters. The ParameterDecoratorMapper is configured via three properties. decorator.parameter - the parameter which contains the name of the decorator which will be mapped. The default is "decorator". For example if decorator.parameter is "foobar" then myurl.jsp?foobar=mydecorator will map to the decorator named "mydecorator". You can also supply an optional 'confirmation parameter'. The decorator will only be mapped if the parameter named parameter.name is in the request URI and the value of that parameter is equal ...
ConfigLoader: The ConfigLoader reads a configuration XML file that contains Decorator definitions (name, url, init-params) and path-mappings (pattern, name). These can then be accessed by the getDecoratorByName() methods and getMappedName() methods respectively. The DTD for the configuration file in old (deprecated) format is located at http://www.opensymphony.com/dtds/sitemesh_1_0_decorators.dtd . The DTD for the configuration file in new format is located at http://www.opensymphony.com/dtds/sitemesh_1_5_decorators.dtd . Editing the config file will cause it to be auto-reloaded. This class is used by ConfigDecoratorMapper, ...
LanguageDecoratorMapper: The LanguageDecoratorMapper can determine the preferred language set in the browser requesting a page, and map to a suitable Decorator (using the "Accept-Language" HTTP header). This can be useful for supplying different versions of the same content for different languages. When LanguageDecoratorMapper is in the chain, it will request the appropriate Decorator from its parent. It will then add an extention to the filename of the Decorator, and if that file exists it shall be used as the Decorator instead. For example, if the Decorator path is /blah.jsp and the detected preferred language is en ...
EnvEntryDecoratorMapper: The EnvEntryDecoratorMapper allows the reference to a web-app environment entry for the decorator name, and falls back to ConfigDecoratorMapper's behavior if no matching environment entry is found. In some cases, it's desirable to allow a deployer, as opposed to a developer, to specify a decorator. In a .WAR file, this can be very difficult, since decorator mappings are specified in decorators.xml (more or less). This mapper corrects that by allowing two types of mapping. If the decorator name is found in an <env-entry> , the entry's value is used as the decorator reference. Known Issues: ...
AbstractPage: Abstract implementation of com.opensymphony.module.sitemesh.Page . Contains base methods for storing and accessing page properties. Also stores pageData 55 as byte and implements write???() methods. Concrete implementations need only set the pageData 55 and call addProperty(java.lang.String,java.lang.String) 55 to add all the required information.
PageDecoratorMapper: The PageDecoratorMapper allows the actual Page to determine the Decorator to be used. The 'meta.decorator' and 'decorator' properties of the page are accessed and if any of them contain the name of a valid Decorator, that Decorator shall be applied. As an example, if HTML is being used, the Decorator could be chosen by using a <html decorator="mydecorator"> root tag or by using a <meta name="decorator" content="mydecorator"> tag in the header. The actual properties to query are specified by passing properties to the mapper using the property.? prefix. As the properties are stored in ...
PathMapper: The PathMapper is used to map file patterns to keys, and find an approriate key for a given file path. The pattern rules are consistent with those defined in the Servlet 2.3 API on the whole. Wildcard patterns are also supported, using any combination of * and ?. Example PathMapper pm = new PathMapper(); pm.put("one","/"); pm.put("two","/mydir/*"); pm.put("three","*.xml"); pm.put("four","/myexactfile.html"); pm.put("five","/*\/admin/*.??ml"); String result1 = pm.get("/mydir/myfile.xml"); // returns "two"; String result2 = pm.get("/mydir/otherdir/admin/myfile.html"); // returns "five";
OSDecoratorMapper: The OSDecoratorMapper will map a suitable decorator based on the operating system of the remote client. OSDecoratorMapper works by checking to see if the "UA-OS" header was sent with the HTTP request. If it was, the class will check the value of the header with all the different os's the user has configured the Decorator Mapper to identify and, if a match is found, routes the request accordingly. Configuration is done using the sitemesh.xml file. The param name is a string literal (operating system name) you would like to match in the UA-OS header, and the value is what will be appended to the ...
PageParser: The PageParser is responsible for parsing the page data into an appropriate Page object. The implementation of this can be switched to parse different kind of data ( e.g. HTML, WML, FOP, images) or for performance enhancements. An implementation is obtained through the Factory . A single PageParser is reused, therefore the parse() methods need to be thread-safe.
Factory: Factory responsible for creating appropriate instances of implementations. This is specific to a web context and is obtained through getInstance(com.opensymphony.module.sitemesh.Config) 55 . The actual Factory method used is determined by the enviroment entry sitemesh.factory . If this doesn't exist, it defaults to com.opensymphony.module.sitemesh.factory.DefaultFactory .
PrintableDecoratorMapper: The PrintableDecoratorMapper is a sample DecoratorMapper that will check to see whether 'printable=true' is supplied as a request parameter and if so, use the specified decorator instead. The name of this decorator should be supplied in the decorator property. The exact 'printable=true' request criteria can be overriden with the parameter.name and parameter.value properties. Although this DecoratorMapper was designed for creating printable versions of a page, it can be used for much more imaginative purposes.
TagTokenizer: Splits a chunk of HTML into 'text' and 'tag' tokens, for easy processing. Is VERY tolerant to badly formed HTML. Usage You need to supply a custom TokenHandler that will receive callbacks as text and tags are processed. char input = ...; HTMLTagTokenizer tokenizer = new HTMLTagTokenizer(input); TokenHandler handler = new MyTokenHandler(); tokenizer.start(handler);
DecoratorMapper: The DecoratorMapper is responsible for determining which Decorator should be used for a Page . Implementations of this are returned by the Factory , and should be thread-safe.
CharArrayReader: This class implements a character buffer that can be used as a character-input stream. Modified from the JDK source in that it gets rid of the ensureOpen() method, so we get unexpected behaviour if the reader is closed. The second modification is that since this class is used internally by FastPageParser in a single thread, we don't need any locking or synchronization. Using this class instead of the standard CharArrayReader improves FastPageParser performance by 15-20%.
InlineDecoratorMapper: The InlineDecoratorMapper is used to determine the correct Decorator when using inline decorators. It will check the request attribute value defined by the key RequestConstants.DECORATOR > RequestConstants.DECORATOR 55 and use the appropriate named Decorator. This is passed across from the page:applyDecorator tag.
FrameSetDecoratorMapper: The FrameSetDecoratorMapper will use the specified decorator when the Page is an instance of com.opensymphony.module.sitemesh.HTMLPage and isFrameSet() returns true. The name of this decorator should be supplied in the decorator property - if no decorator property is supplied, no decorator is applied to frame based pages.
AbstractHTMLPage: Abstract implementation of com.opensymphony.module.sitemesh.HTMLPage . Adds to AbstractPage some HTML methods. To implement, follow guidelines of super-class, and implement the 2 abstract methods states below.
UsePageTag: Expose the Page as a bean to the page which can then be accessed from scriptlets. Depending on the TEI used, the object will be com.opensymphony.module.sitemesh.Page or com.opensymphony.module.sitemesh.HTMLPage .
Decorator: Representation of a Decorator. A Decorator is infact a Servlet/JSP, and this is a wrapper to reference it. An implementation is returned by the DecoratorMapper .
AbstractDecoratorMapper: Abstract DecoratorMapper implementation for easy creation of new DecoratorMappers. Typically, an implementation would override getNamedDecorator() or getDecorator(). If a Decorator cannot be returned from either of these, then they should delegate to their superclass.
HTMLPageParser: WARNING - This is experimental - use at own risk! Builds an HTMLPage object from an HTML document. This behaves similarly to the FastPageParser, however it's a complete rewrite that is simpler to add custom features to such as extraction and transformation of elements.