A page resolver is used to tell polliwog which
hits in the log file(s) should be considered
pages and thus added to the statistics.
In general a
page is considered to be a page that the user actually
views. For example html files. The most common way of identifying pages is via the file extension in the passed in url.
A page resolver is created by implementing the
org.polliwog.resolvers.PageResolver interface.
The implementation of the interface can perform whatever tasks is needed to generate the mapping.
polliwog only creates a single instance of the resolver that is then used for the entire log, the instance is intialized by calling the
init(org.polliwog.data.VisitorEnvironment) method.
If no page resolver is provided then polliwog will consider
all hits to be pages.
The page resolver to use is specified in the
properties file by setting property:
pageResolverClass
If the hit is considered to be a page then polliwog set a flag in the
Hit class to indicate this, the value of that flag can be retreived by using method:
isPage().
A basic implementation of the page resolver is provided by the
org.polliwog.resolvers.BasicPageResolver class. This class uses a xml file to provide the logic to indicate what page should be considered a page.
The format of the xml file is as follows:
XML Definition Help
The Children column shows the child elements that can be used within the specified element. Child elements can appear in any order (there is no enforcement via a DTD).
- A + after the element name indicates that at least 1 child element with that name must be present.
- A * after the element name indicates that 0 or more elements can be present.
- A ? after the element name indicates that either 1 or no elements with that name can be present.
If no symbol is provided after the name then one element must be provided.
The Attributes column shows the attribute that can be used on the specified element. Attribute definitions are defined as: name(value_type,required|optional), where value_type is one of:
- string - A string value, this can be anything.
- integer - An integer value.
- class - A fully qualified classname.
- enum{values} - A specific value, one or more of those given in the brackets, which will be comma-separated.
- boolean - Either
true or false .
Required and optional are represented as: R and O respectively.
|
Name | Root | Children | Parent(s) | Attributes | Description |
---|
page-resolver | Y | NONE | NONE | NONE | The root element, the content of this element should contain a JoSQL WHERE clause that will determine what is a page. |
The resolver uses property:
basicPageResolverFile
to define the location of the xml file to use.
Note: the class available to the JoSQL WHERE clause is:
org.polliwog.fields.AbstractURIField.
Example
Only consider the specified file extensions to be pages.
<page-resolver>
pathExtension $IN ('/',
'html',
'htm',
'php',
'aspx',
'cgi',
'mp3',
'rm',
'pdf',
'doc')
</page-resolver>
Example
Only consider the paths specified to be pages, if they have the query parameter.
<page-resolver>
path $LIKE '/view-page/%'
AND
get (parameters, 'ID') != null
</page-resolver>