Adding menu controller, tomcat filter for menu page URL routing NIHVIVO-1073 NIHVIVO-597

This commit is contained in:
bdc34 2010-12-02 21:12:33 +00:00
parent 9e583a6205
commit e4503d3e43
4 changed files with 219 additions and 316 deletions

View file

@ -1,319 +1,97 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [ <!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" > <!ENTITY display "http://vitro.mannlib.cornell.edu/ontologies/display/1.1#">
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" > <!ENTITY owl "http://www.w3.org/2002/07/owl#">
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" > <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" > <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
<!ENTITY display "http://vitro.mannlib.cornell.edu/ontologies/display/1.1#" > <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
<!ENTITY display2 "http://vitro.mannlib.cornell.edu/ontologies/display/1.1/" >
]> ]>
<rdf:RDF xml:base="http://vitro.mannlib.cornell.edu/ontologies/display/1.1/"
xmlns:display="&display;"
xmlns:owl="&owl;"
xmlns:rdf="&rdf;"
xmlns:rdfs="&rdfs;">
<!-- Ontology Information -->
<owl:Ontology rdf:about=""
rdfs:label="Vitro display ontology"
owl:versionInfo="1.1"/>
<!-- Classes -->
<owl:Class rdf:about="#Menu"/>
<owl:Class rdf:about="#parameter"/>
<owl:Class rdf:about="&display;ExternallyLinkedNamespace"
rdfs:label="Externally Linked Namespace"/>
<owl:Class rdf:about="&display;NavigationElement"
rdfs:label="Navigation Element">
<rdfs:comment>This represents a menu item or other general navigation item.</rdfs:comment>
</owl:Class>
<owl:Class rdf:about="&display;Page"
rdfs:comment="Class of pages."
rdfs:label="Page"/>
<owl:Class rdf:about="&rdfs;subPropertyOf"/>
<owl:Class rdf:about="&owl;NamedIndividual"/>
<!-- Annotation Properties -->
<owl:AnnotationProperty rdf:about="&rdfs;comment"/>
<owl:AnnotationProperty rdf:about="&rdfs;label"/>
<owl:AnnotationProperty rdf:about="&owl;versionInfo"/>
<!-- Datatype Properties -->
<owl:DatatypeProperty rdf:about="#linkText"
rdfs:comment="Text to display to a link.">
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="&display;menuPosition"
rdfs:label="menu position">
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="&display;parameterName"
rdfs:label="parameter name"/>
<owl:DatatypeProperty rdf:about="&display;parameterValue"
rdfs:label="parameter value"/>
<owl:DatatypeProperty rdf:about="&display;requiresBodyTemplate"
rdfs:label="Body Template">
<rdfs:comment>Indicates that a page requires a body template.</rdfs:comment>
<rdfs:domain rdf:resource="&display;Page"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="&display;title"
rdfs:comment="Value for HTML title element."
rdfs:label="title">
<rdfs:domain rdf:resource="&display;Page"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="&display;urlMapping">
<rdfs:comment>Values from HttpRequest.getPathInfo() will be mapped to values from urlMapping.</rdfs:comment>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="&owl;DatatypeProperty"/>
<owl:DatatypeProperty rdf:about="&owl;topDataProperty"/>
<!-- Object Properties -->
<owl:ObjectProperty rdf:about="#hasElement">
<rdfs:domain rdf:resource="#Menu"/>
<rdfs:range rdf:resource="&display;NavigationElement"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="#hasParameter">
<rdfs:domain rdf:resource="&display;Page"/>
<rdfs:range rdf:resource="#parameter"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="excludeClass">
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="includeClass">
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="&display;toPage">
<rdfs:domain rdf:resource="&display;NavigationElement"/>
<rdfs:range rdf:resource="&display;Page"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="&owl;topObjectProperty"/>
<rdf:RDF xmlns="http://vitro.mannlib.cornell.edu/ontologies/display/1.1#"
xml:base="http://vitro.mannlib.cornell.edu/ontologies/display/1.1"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:display2="http://vitro.mannlib.cornell.edu/ontologies/display/1.1/"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:display="http://vitro.mannlib.cornell.edu/ontologies/display/1.1#">
<owl:Ontology rdf:about="http://vitro.mannlib.cornell.edu/ontologies/display/1.1/">
<rdfs:label>Vitro display ontology</rdfs:label>
<owl:versionInfo>1.1</owl:versionInfo>
</owl:Ontology>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Annotation properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<owl:AnnotationProperty rdf:about="&owl;versionInfo"/>
<owl:AnnotationProperty rdf:about="&rdfs;label"/>
<owl:AnnotationProperty rdf:about="&rdfs;comment"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#requiresValues -->
<owl:ObjectProperty rdf:about="&display;requiresValues">
<rdfs:label>requires values</rdfs:label>
</owl:ObjectProperty>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#toPage -->
<owl:ObjectProperty rdf:about="&display;toPage">
<rdfs:subPropertyOf rdf:resource="&owl;topObjectProperty"/>
</owl:ObjectProperty>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1/excludeClass -->
<owl:ObjectProperty rdf:about="&display2;excludeClass">
<rdfs:subPropertyOf rdf:resource="&owl;topObjectProperty"/>
</owl:ObjectProperty>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1/includeClass -->
<owl:ObjectProperty rdf:about="&display2;includeClass">
<rdfs:subPropertyOf rdf:resource="&owl;topObjectProperty"/>
</owl:ObjectProperty>
<!-- http://www.w3.org/2002/07/owl#topObjectProperty -->
<owl:ObjectProperty rdf:about="&owl;topObjectProperty"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Data properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#javaClassName -->
<owl:DatatypeProperty rdf:about="&display;javaClassName">
<rdfs:label>Java Class Name</rdfs:label>
<rdfs:comment>Java package and class name. ex edu.cornell.mannlib.vitro.webapps.functions.ExampleFunction</rdfs:comment>
</owl:DatatypeProperty>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#menuPosition -->
<owl:DatatypeProperty rdf:about="&display;menuPosition">
<rdfs:label>menu position</rdfs:label>
</owl:DatatypeProperty>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#parameterName -->
<owl:DatatypeProperty rdf:about="&display;parameterName">
<rdfs:label>parameter name</rdfs:label>
</owl:DatatypeProperty>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#parameterValue -->
<owl:DatatypeProperty rdf:about="&display;parameterValue">
<rdfs:label>parameter value</rdfs:label>
</owl:DatatypeProperty>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#requiresBodyTemplate -->
<owl:DatatypeProperty rdf:about="&display;requiresBodyTemplate">
<rdfs:label>Body Template</rdfs:label>
<rdfs:comment>Indicates that a page requires a body template.</rdfs:comment>
<rdfs:subPropertyOf rdf:resource="&owl;topDataProperty"/>
</owl:DatatypeProperty>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#title -->
<owl:DatatypeProperty rdf:about="&display;title">
<rdfs:label>title</rdfs:label>
<rdfs:comment>Value for HTML title element.</rdfs:comment>
<rdfs:subPropertyOf rdf:resource="&owl;topDataProperty"/>
</owl:DatatypeProperty>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#urlMapping -->
<owl:DatatypeProperty rdf:about="&display;urlMapping">
<rdfs:comment>Values from HttpRequest.getPathInfo() will be mapped to values from urlMapping.</rdfs:comment>
<rdfs:subPropertyOf rdf:resource="&owl;topDataProperty"/>
</owl:DatatypeProperty>
<!-- http://www.w3.org/2002/07/owl#topDataProperty -->
<owl:DatatypeProperty rdf:about="&owl;topDataProperty"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#NavigationElement -->
<owl:Class rdf:about="&display;NavigationElement">
<rdfs:label>Navigation Element</rdfs:label>
<rdfs:comment>This represents a menu item or other general navigation item.</rdfs:comment>
</owl:Class>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Page -->
<owl:Class rdf:about="&display;Page">
<rdfs:label>Page</rdfs:label>
<rdfs:comment>Class of pages.</rdfs:comment>
</owl:Class>
<!-- http://www.w3.org/2002/07/owl#Thing -->
<owl:Class rdf:about="&owl;Thing"/>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#ExternallyLinkedNamespace -->
<owl:Class rdf:about="&display;ExternallyLinkedNamespace">
<rdfs:label>Externally Linked Namespace</rdfs:label>
</owl:Class>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Individuals
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Events -->
<owl:NamedIndividual rdf:about="&display;Events">
<rdf:type rdf:resource="&display;Page"/>
</owl:NamedIndividual>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#EventsMenuItem -->
<owl:NamedIndividual rdf:about="&display;EventsMenuItem">
<rdf:type rdf:resource="&display;NavigationElement"/>
<toPage rdf:resource="&display;Events"/>
</owl:NamedIndividual>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Home -->
<owl:NamedIndividual rdf:about="&display;Home">
<rdf:type rdf:resource="&display;Page"/>
<title>Home</title>
<requiresBodyTemplate>home.ftl</requiresBodyTemplate>
<urlMapping>/home</urlMapping>
<requiresValues rdf:resource="&display;HomeValues"/>
</owl:NamedIndividual>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#HomeMenuItem -->
<owl:NamedIndividual rdf:about="&display;HomeMenuItem">
<rdf:type rdf:resource="&display;NavigationElement"/>
<toPage rdf:resource="&display;Home"/>
</owl:NamedIndividual>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#HomeValues -->
<owl:Thing rdf:about="&display;HomeValues">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<javaClassName>edu.cornell.mannlib.vitro.webapp.valuemap.HomeValueMap</javaClassName>
</owl:Thing>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Organizations -->
<owl:NamedIndividual rdf:about="&display;Organizations">
<rdf:type rdf:resource="&display;Page"/>
</owl:NamedIndividual>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#OrganizationsMenuItem -->
<owl:NamedIndividual rdf:about="&display;OrganizationsMenuItem">
<rdf:type rdf:resource="&display;NavigationElement"/>
<toPage rdf:resource="&display;Organizations"/>
</owl:NamedIndividual>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#People -->
<owl:NamedIndividual rdf:about="&display;People">
<rdf:type rdf:resource="&display;Page"/>
</owl:NamedIndividual>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#PeopleMenuItem -->
<owl:NamedIndividual rdf:about="&display;PeopleMenuItem">
<rdf:type rdf:resource="&display;NavigationElement"/>
<toPage rdf:resource="&display;People"/>
</owl:NamedIndividual>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Publications -->
<owl:NamedIndividual rdf:about="&display;Publications">
<rdf:type rdf:resource="&display;Page"/>
</owl:NamedIndividual>
<!-- http://vitro.mannlib.cornell.edu/ontologies/display/1.1#PublicationsMenuItem -->
<owl:NamedIndividual rdf:about="&display;PublicationsMenuItem">
<rdf:type rdf:resource="&display;NavigationElement"/>
</owl:NamedIndividual>
</rdf:RDF> </rdf:RDF>
<!-- Generated by the OWL API (version 3.0.0.1451) http://owlapi.sourceforge.net -->

View file

@ -0,0 +1,80 @@
# $This file is distributed under the terms of the license in /doc/license.txt$
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix core: <http://vivoweb.org/ontology/core#> .
### This file defines the default menu for vivo. ###
#### Default Menu ####
display:DefaultMenu
a display:MainMenu ;
display:hasElement display:EventsMenuItem ;
display:hasElement display:HomeMenuItem ;
display:hasElement display:OrganizationsMenuItem ;
display:hasElement display:PeopleMenuItem ;
display:hasElement display:PublicationsMenuItem .
#### Menu Items for Default Menu ####
display:HomeMenuItem
a display:NavigationElement ;
display:menuPosition 1;
display:linkText "Home";
display:toPage display:Home .
display:PeopleMenuItem
a display:NavigationElement ;
display:menuPosition 2;
display:linkText "People";
display:toPage display:People .
display:PublicationsMenuItem
a display:NavigationElement ;
display:menuPosition 3;
display:linkText "Publications";
display:toPage display:Publications .
display:EventsMenuItem
a display:NavigationElement ;
display:menuPosition 4;
display:linkText "Events";
display:toPage display:Events .
display:OrganizationsMenuItem
a display:NavigationElement ;
display:menuPosition 5;
display:linkText "Organizations";
display:toPage display:Organizations .
########## Pages ############
display:Home
a display:HomePage ;
a display:Page ;
display:title "Home" ;
display:urlMapping "/home" .
display:Events
a display:Page ;
display:title "Events" ;
display:urlMapping "/events" .
display:Organizations
a display:Page ;
display:title "Organizations" ;
display:urlMapping "/organizations" .
display:People
a display:Page ;
display:requiresBodyTemplate "menupage--classgroup-people.ftl" ;
display:title "People" ;
display:urlMapping "/people" .
display:Publications
a display:Page ;
display:title "Publications" ;
display:urlMapping "/publications" .

View file

@ -270,6 +270,16 @@
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</filter-mapping--> </filter-mapping-->
<filter>
<filter-name>PageRoutingFilter</filter-name>
<filter-class>edu.cornell.mannlib.vitro.webapp.filters.PageRoutingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PageRoutingFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>request</dispatcher>
</filter-mapping>
<!-- Spring setup **************************************************** --> <!-- Spring setup **************************************************** -->
<!-- <!--
<context-param> <context-param>
@ -1285,7 +1295,18 @@
<servlet-name>primitiveDelete</servlet-name> <servlet-name>primitiveDelete</servlet-name>
<url-pattern>/edit/primitiveDelete</url-pattern> <url-pattern>/edit/primitiveDelete</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet>
<servlet-name>PageController</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.freemarker.PageController</servlet-class>
</servlet>
<!-- PageController lacks a servlet-mapping since it gets called by getNamedDispatcher
<servlet-mapping>
<servlet-name>PageController</servlet-name>
<url-pattern>NONE</url-pattern>
</servlet-mapping>
-->
<!-- ============================== servlet-mappings ======================== --> <!-- ============================== servlet-mappings ======================== -->
<servlet-mapping> <servlet-mapping>
<servlet-name>fetch</servlet-name> <servlet-name>fetch</servlet-name>

View file

@ -0,0 +1,24 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<p>This body is from the the template file
vivo/productMods/templates/freemarker/body/menupage/publications.ftl.
In the display model, the publications page has a display:requiresBodyTemplate
property that defines that the publications page overrides the default template.
The default template for these pages is at /vitro/webapp/web/templates/freemarker/body/menupage/menupage.ftl </p>
<p> This technique could be used to define pages without menu items, that get
their content from a freemarker template. An example would be the about page.</p>
<code>
display:About <br>
a display:Page ; <br>
display:requiresBodyTemplate "about.ftl" ; <br>
display:title "About" ;<br>
display:urlMapping "/about" .<br>
<br>
</code>
<p>This would create a page that would use about.ftl as the body. The page would be
accessed via /about and would override all servlet mappings in web.xml</p>