Apache Nutch is an extensible and scalable web crawler
new nutch ui
Sami Siren43ad9a0f700b
diff --git a/contrib/web2/README.txt b/contrib/web2/README.txtnew file mode 100644index 000000000..a4b62327d--- /dev/null+++ b/contrib/web2/README.txt@@ -0,0 +1,66 @@+This folder contains an alternative search frontend implementation+with a goal to be modular and extendable. Currently it+is still in very early stage of development and might miss+some functionality from the original ui.++To achieve the primary goal it uses tiles+http://struts.apache.org/struts-tiles/index.html+to represent blocks of functinality and layout on a search+(and related) pages. Layout is constructed by using following+tag libraries:++struts-logic+struts-tiles+struts-bean++These tiles blocks can be extended or overridden by plugins+implementing org.apache.nutch.webapp.UIExtensionPoint. A+plugin implementation typically contains own tiles-defs.xml+file that contains definitions (extensions or overriders)+it provides, tiles Controller, supporting classes and libraries.++WebApp extension can contain ui logic (in forms of tiles+controllers and pojos, jar libraries), ui markup+(in form of html, jsp), ui resources css, javascript. there's+no support for binary items at the time of writing this.++To compile you need to fist build your nutch (core and plugins)+after that run ant war to generate war.++The nutch plugins are no included in the generated war and you+need to properly configure where your plugins are. This is achieved+by editing the nutch configuration file <NUTCH_HOME>/conf/nutch-site.xml+the configuration parameter you need to edit is named+'plugin.folders'+++Todo:++-Provide some samples of ui plugins+++Directory contents++/lib+ contains required additional libraties, all Licenced and maintained by ASF.+ struts.jar (version 1.2.9) and libraries required by struts.++/res+ contains stylesheets to transform static html pages or page snippets++/src/main/java+ java sources++/src/main/resources+ resources to be packaged in .jar, currently the localized resource files++/src/main/webapp+ standard webapp folder++build.xml+ contains minimal build instructions to create a .war++README.txt+ this file++diff --git a/contrib/web2/build.xml b/contrib/web2/build.xmlnew file mode 100644index 000000000..a4aa2882d--- /dev/null+++ b/contrib/web2/build.xml@@ -0,0 +1,291 @@+<?xml version="1.0"?>+<!-- This is a minimal build.xml file to build the+webapp+-->+<project name="nutch-web2">++ <property name="name" value="${ant.project.name}" />+ <property name="root" value="${basedir}" />+ <property name="nutch.root" location="${root}/../../" />+++ <property name="build.dir" location="target" />+ <property name="build.classes" location="${build.dir}/classes" />+ <property name="build.test" location="${build.dir}/test" />++ <property name="src.dir" location="${root}/src/main/java" />+ <property name="src.test" location="${root}/src/test" />+ <property name="conf.dir" location="${nutch.root}/conf" />++ <property name="deploy.dir" location="target" />++ <property name="docs.src" value="${nutch.root}/src/web"/>+ <property name="web.src.dir" value="${basedir}/src/main/webapp"/>+ <property name="docs.dir" value="${build.dir}/${name}/"/>+ <property name="build.plugins" value="${nutch.root}/build/plugins"/>++ <property file="${nutch.root}/default.properties"/>++ <property name="web.final.name" value="${name}-${version}" />++ <fileset id="lib.jars" dir="." includes="lib/*.jar" />++ <!--+ Normal classpath+ -->+ <path id="classpath">+ <pathelement location="${build.classes}" />+ <fileset refid="lib.jars" />+ <pathelement location="${nutch.root}/build/classes" />+ <fileset dir="${nutch.root}/lib">+ <include name="servlet-api.jar" />+ <include name="hadoop-0.1.1.jar" />+ </fileset>+ </path>++ <!--+ Init+ -->+ <target name="init">+ <mkdir dir="${build.dir}" />+ <mkdir dir="${build.classes}" />+ <mkdir dir="${build.test}" />+ </target>++ <!--+ Compile Java files+ -->+ <target name="compile" depends="init">+ <echo message="Compiling ${name}" />+ <javac encoding="${build.encoding}" srcdir="${src.dir}" includes="**/*.java" destdir="${build.classes}" debug="${javac.debug}" optimize="${javac.optimize}" target="${javac.version}" source="${javac.version}" deprecation="${javac.deprecation}">+ <classpath refid="classpath" />+ </javac>+ </target>++ <target name="compile-core">+ <ant target="compile-core" inheritall="false" dir="${nutch.root}" />+ <ant target="compile" />+ </target>++ <!--+ Make webapp .jar+ -->+ <target name="jar" depends="compile">+ <jar jarfile="${build.dir}/${web.final.name}.jar">+ <zipfileset dir="${build.classes}"/>+ <!-- localized resources -->+ <zipfileset dir="src/main/resources"/>+ </jar>+ </target>++ <!--+ generate the nutch.xml (servlet context) file+ -->+ <target name="generate-context">+ <!-- xmlcatalog definition for xslt task -->+ <xmlcatalog id="docDTDs">+ <dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN"+ location="${nutch-root}/xmlcatalog/xhtml1-transitional.dtd"/>+ </xmlcatalog>+ <xslt in="${nutch.root}/conf/nutch-default.xml" out="${build.dir}/nutch.xml" style="${nutch.root}/conf/context.xsl">+ <xmlcatalog refid="docDTDs" />+ <outputproperty name="indent" value="yes" />+ </xslt>+ </target>++ <target name="war" depends="jar, generate-context, generate-pages">+ <war destfile="${build.dir}/${web.final.name}.war" webxml="src/main/webapp/WEB-INF/web.xml">+ <fileset dir="${web.src.dir}" excludes="WEB-INF/web.xml"/>+ <zipfileset dir="${docs.src}" includes="include/*.html" />+ <zipfileset dir="${build.docs}" includes="*/include/*.html" />+ <fileset dir="${docs.dir}" />+ <lib dir="${nutch.root}/lib">+ <include name="lucene-*.jar" />+ <include name="hadoop-*.jar" />+ <include name="commons-lang-*.jar" />+ </lib>++ <fileset dir="${nutch.root}/docs" includes="img/**"/>++ <!-- webapp .jar -->+ <lib dir="${build.dir}">+ <include name="${web.final.name}.jar"/>+ </lib>+ <lib dir="lib" includes="*.jar"/>++ <!-- nutch .jar -->+ <lib dir="${nutch.root}/build">+ <include name="*.jar" />+ </lib>+ <classes dir="${conf.dir}" excludes="**/*.template" />+<!-- no plugins+ <zipfileset prefix="WEB-INF/classes/plugins" dir="${build.plugins}" >+ <exclude name="parse-*/**"/>+ <exclude name="protocol-*/**"/>+ </zipfileset>+ -->+ </war>+ </target>++ <!--+ Deploy to ${deploy.dir}+ -->+ <target name="deploy" depends="war">+ <mkdir dir="${deploy.dir}" />+ <copy file="${build.dir}/${web.final.name}.war" todir="${deploy.dir}" failonerror="false" />+ </target>++ <!--+ Compile test code+ -->+ <target name="compile-test" depends="compile" if="test.available">+ <javac encoding="${build.encoding}" srcdir="${src.test}" includes="**/*.java" destdir="${build.test}" debug="${javac.debug}" optimize="${javac.optimize}" target="${javac.version}" source="${javac.version}" deprecation="${javac.deprecation}">+ <classpath refid="test.classpath" />+ </javac>+ </target>++ <!--+ Run unit tests+ -->+ <target name="test" depends="compile-test, deploy" if="test.available">+ <junit printsummary="yes" haltonfailure="no" fork="yes" errorProperty="tests.failed" failureProperty="tests.failed">+ <sysproperty key="test.data" value="${build.test}/data" />+ <sysproperty key="test.input" value="${root}/data" />+ <classpath refid="test.classpath" />+ <formatter type="plain" />+ <batchtest todir="${build.test}" unless="testcase">+ <fileset dir="${src.test}" includes="**/Test*.java" excludes="**/${test.exclude}.java" />+ </batchtest>+ <batchtest todir="${build.test}" if="testcase">+ <fileset dir="${src.test}" includes="**/${testcase}.java" />+ </batchtest>+ </junit>++ <fail if="tests.failed">Tests failed!</fail>++ </target>++ <!--+ Clean. Delete the build files, and their directories+ -->+ <target name="clean">+ <delete dir="${build.dir}" />+ <delete dir="${deploy.dir}" />+ </target>++ <target name="generate-locale" if="doc.locale">+ <echo message="Generating docs for locale=${doc.locale}"/>++ <mkdir dir="${build.docs}/${doc.locale}/include"/>+ <xslt in="${docs.src}/include/${doc.locale}/header.xml"+ out="${build.docs}/${doc.locale}/include/header.html"+ style="res/nutch-header.xsl">+ <xmlcatalog refid="docDTDs"/>+ </xslt>++ <dependset>+ <srcfileset dir="${docs.src}/include/${doc.locale}" includes="*.xml"/>+ <srcfileset dir="${docs.src}/style" includes="*.xsl"/>+ <targetfileset dir="${docs.dir}/${doc.locale}" includes="*.html"/>+ </dependset>++<!-- <copy file="${docs.src}/style/nutch-page.xsl"+ todir="${build.docs}/${doc.locale}"+ preservelastmodified="true"/>+-->+ <xslt basedir="${docs.src}/pages/${doc.locale}"+ destdir="${docs.dir}/${doc.locale}"+ includes="*.xml"+ style="res/nutch-page.xsl">+ <xmlcatalog refid="docDTDs"/>+ </xslt>+ </target>+++ <target name="generate-pages" depends="init">+ <mkdir dir="${build.docs}/include"/>+ <copy todir="${build.docs}/include">+ <fileset dir="${docs.src}/include"/>+ </copy>++ <antcall target="generate-locale">+ <param name="doc.locale" value="ca"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="de"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="en"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="es"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="fi"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="fr"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="hu"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="it"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="jp"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="ms"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="nl"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="pl"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="pt"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="sh"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="sr"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="sv"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="th"/>+ </antcall>++ <antcall target="generate-locale">+ <param name="doc.locale" value="zh"/>+ </antcall>++ <fixcrlf srcdir="${docs.dir}" eol="lf" encoding="utf-8"+ includes="**/*.html"/>++ <replace dir="${docs.dir}" token="search.jsp" value="search.do" includes="**/*.html"/>+ <replace dir="${docs.dir}" token="../" value="" includes="**/*.html"/>++ </target>++</project>diff --git a/contrib/web2/lib/commons-beanutils.jar b/contrib/web2/lib/commons-beanutils.jarnew file mode 100644index 000000000..b1b89c9c9Binary files /dev/null and b/contrib/web2/lib/commons-beanutils.jar differdiff --git a/contrib/web2/lib/commons-collections-3.0.jar b/contrib/web2/lib/commons-collections-3.0.jarnew file mode 100644index 000000000..5cc4f9062Binary files /dev/null and b/contrib/web2/lib/commons-collections-3.0.jar differdiff --git a/contrib/web2/lib/commons-digester.jar b/contrib/web2/lib/commons-digester.jarnew file mode 100644index 000000000..976549330Binary files /dev/null and b/contrib/web2/lib/commons-digester.jar differdiff --git a/contrib/web2/lib/struts.jar b/contrib/web2/lib/struts.jarnew file mode 100644index 000000000..7815901f3Binary files /dev/null and b/contrib/web2/lib/struts.jar differdiff --git a/contrib/web2/res/nutch-header.xsl b/contrib/web2/res/nutch-header.xslnew file mode 100644index 000000000..61116613b--- /dev/null+++ b/contrib/web2/res/nutch-header.xsl@@ -0,0 +1,49 @@+<?xml version="1.0"?>+<!-- XSLT stylesheet that generates localized versions of the page header. -->+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">+ <xsl:template match="header-menu">+ <xsl:comment>This file is automatically generated. Do not edit!</xsl:comment>+ <table width="635" border="0" cellpadding="0" cellspacing="0">+ <tr>+ <td valign="bottom" width="140" rowspan="2">+ <a href="./"><img src="img/reiter/logo_nutch.gif" border="0"/></a>+ <img src="img/reiter/spacer_666666.gif" width="140" height="1"/>+ </td>+ </tr>+ <tr>+ <td width="495" valign="bottom" align="right">+ <table border="0" cellpadding="0" cellspacing="0" width="495">+ <tr>+ <td background="img/reiter/_bg_reiter.gif" width="400">+ <xsl:text disable-output-escaping="yes">&#160;</xsl:text>+ </td>+<!-- menu -->+ <xsl:for-each select="item">+ <td height="28" valign="bottom" width="10">+ <xsl:choose>+ <xsl:when test="position()=1">+ <img src="img/reiter/reiter_inactive_le1.gif" border="0"/>+ </xsl:when>+ <xsl:otherwise>+ <img src="img/reiter/reiter_inactive_le.gif" border="0"/>+ </xsl:otherwise>+ </xsl:choose>+ </td>+ <td background="img/reiter/_bg_reiter_inactive.gif" valign="bottom" nowrap="nowrap">+ <xsl:variable name="url" select="a/@href"/>+ <a class="bodytext" href="{$url}">+ <xsl:value-of select="." disable-output-escaping="yes"/>+ </a>+ </td>+ <td height="28" valign="bottom" width="10">+ <img src="img/reiter/reiter_inactive_ri.gif" border="0"/>+ </td>+ </xsl:for-each>+<!-- menue -->+ </tr>+ </table>+ </td>+ </tr>+ </table>+ </xsl:template>+</xsl:stylesheet>diff --git a/contrib/web2/res/nutch-page.xsl b/contrib/web2/res/nutch-page.xslnew file mode 100644index 000000000..9e03efe37--- /dev/null+++ b/contrib/web2/res/nutch-page.xsl@@ -0,0 +1,84 @@+<?xml version="1.0"?>+<!-- XSLT stylesheet that adds Nutch style, header, and footer+ elements. This is used by Ant to generate static html pages. -->+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">+ <xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>+ <xsl:template match="page">+ <xsl:comment>This page is automatically generated. Do not edit!</xsl:comment>+ <table width="635" border="0" cellpadding="0" cellspacing="0">+ <tr valign="top">+ <td width="140">+ <xsl:call-template name="subnavi"/>+ </td>+ <td width="20" background="img/reiter/_spacer_cccccc.gif">+ <xsl:text disable-output-escaping="yes">&#160;</xsl:text>+ </td>+ <td width="475" class="body">+ <xsl:call-template name="body"/>+ </td>+ </tr>+ </table>+ </xsl:template>+<!-- included menu -->+ <xsl:template name="subnavi">+ <table width="100%" cellpadding="0" cellspacing="0">+ <xsl:for-each select="menu/item">+ <xsl:if test="not(.='')">+ <tr class="menuTd" height="25">+ <td class="menuTd" onmouseover="this.className='menuTdhover';" onmouseout="this.className='menuTd'" width="100%">+ <xsl:text disable-output-escaping="yes">&#160;:: </xsl:text>+ <xsl:variable name="url" select="a/@href"/>+ <a href="{$url}" class="menuEntry">+ <xsl:value-of select="."/>+ </a>+ </td>+ </tr>+ <tr height="1px">+ <td>+ <img src="img/reiter/spacer_666666.gif" height="1" width="100%"/>+ </td>+ </tr>+ </xsl:if>+ </xsl:for-each>+ <tr>+ <td>+ <xsl:text disable-output-escaping="yes">&#160;</xsl:text>+ </td>+ </tr>+ </table>+ </xsl:template>+<!-- /included menu -->+<!-- included body -->+ <xsl:template name="body">+ <table width="475" border="0" cellpadding="0" cellspacing="0">+ <tr>+ <td class="title" height="125" width="275" valign="bottom">+ <xsl:value-of select="title" disable-output-escaping="yes"/>+ </td>+ <td height="125" width="200" valign="bottom">+ <img src="img/reiter/robots.gif"/>+ </td>+ </tr>+ </table>+ <br class="br"/>+ <xsl:for-each select="body/node()">+ <xsl:choose>+<!-- orange intro -->+ <xsl:when test="name()='p' and position() < 3">+ <span class="intro">+ <xsl:copy-of select="."/>+ </span>+ </xsl:when>+<!-- all other text -->+ <xsl:otherwise>+ <span class="bodytext">+ <xsl:copy-of select="."/>+ </span>+ </xsl:otherwise>+ </xsl:choose>+ </xsl:for-each>+ <br class="br"/>+ <br class="br"/>+ </xsl:template>+<!-- /included body -->+</xsl:stylesheet>diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/BaseSearch.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/BaseSearch.javanew file mode 100644index 000000000..818a896b1--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/BaseSearch.java@@ -0,0 +1,148 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.common;++import java.util.HashMap;+import java.util.logging.Logger;++import org.apache.hadoop.conf.Configuration;+import org.apache.hadoop.util.LogFormatter;+import org.apache.nutch.plugin.Extension;+import org.apache.nutch.plugin.ExtensionPoint;+import org.apache.nutch.plugin.PluginRuntimeException;+import org.apache.nutch.webapp.extension.PostSearchExtensionPoint;+import org.apache.nutch.webapp.extension.PreSearchExtensionPoint;+import org.apache.nutch.webapp.extension.SearchExtensionPoint;++public class BaseSearch {++ public static Logger LOG = LogFormatter.getLogger(BaseSearch.class.getName());++ protected PreSearchExtensionPoint[] presearch;++ protected SearchExtensionPoint[] search;++ protected PostSearchExtensionPoint[] postsearch;++ protected Object[] setup(String xPoint, Configuration conf) {+ HashMap filters = new HashMap();+ try {+ ExtensionPoint point = serviceLocator.getPluginRepository()+ .getExtensionPoint(xPoint);+ if (point == null)+ throw new RuntimeException(xPoint + " not found.");+ Extension[] extensions = point.getExtensions();+ for (int i = 0; i < extensions.length; i++) {+ Extension extension = extensions[i];+ Object extensionInstance = extension.getExtensionInstance();+ if (!filters.containsKey(extensionInstance.getClass().getName())) {+ filters+ .put(extensionInstance.getClass().getName(), extensionInstance);+ }+ }+ return (Object[]) filters.values().toArray(new Object[filters.size()]);+ } catch (PluginRuntimeException e) {+ throw new RuntimeException(e);+ }+ }++ // private HttpServletRequest request;+ private SearchContextImpl context;++ private ServiceLocator serviceLocator;++ /**+ * Construct new BaseSearch object+ */+ public BaseSearch(ServiceLocator locator) {+ this.serviceLocator = locator;+ presearch = getPreSearchExtensions(serviceLocator.getConfiguration());+ search = getSearchExtensions(serviceLocator.getConfiguration());+ postsearch = getPostSearchExtensions(serviceLocator.getConfiguration());+ }++ public PreSearchExtensionPoint[] getPreSearchExtensions(Configuration conf) {+ if (conf.getObject(PreSearchExtensionPoint.X_POINT_ID) == null) {+ conf.set(PreSearchExtensionPoint.X_POINT_ID, setup(+ PreSearchExtensionPoint.X_POINT_ID, conf));+ }+ return (PreSearchExtensionPoint[]) conf+ .getObject(PreSearchExtensionPoint.X_POINT_ID);+ }++ public SearchExtensionPoint[] getSearchExtensions(Configuration conf) {+ if (conf.getObject(SearchExtensionPoint.X_POINT_ID) == null) {+ conf.set(SearchExtensionPoint.X_POINT_ID, setup(+ SearchExtensionPoint.X_POINT_ID, conf));+ }+ return (SearchExtensionPoint[]) conf+ .getObject(SearchExtensionPoint.X_POINT_ID);+ }++ public PostSearchExtensionPoint[] getPostSearchExtensions(Configuration conf) {+ if (conf.getObject(PostSearchExtensionPoint.X_POINT_ID) == null) {+ conf.set(PostSearchExtensionPoint.X_POINT_ID, setup(+ PostSearchExtensionPoint.X_POINT_ID, conf));+ }+ return (PostSearchExtensionPoint[]) conf+ .getObject(PostSearchExtensionPoint.X_POINT_ID);+ }++ /**+ * Call plugins participating PreSearch activities+ */+ void callPreSearch() {+ for (int i = 0; i < presearch.length; i++) {+ presearch[i].doPreSearch(context);+ }+ }++ /**+ * Call plugins participating Search activities+ */+ void callSearch() {+ for (int i = 0; i < search.length; i++) {+ search[i].doSearch(context);+ }+ }++ /**+ * Call plugins participating postSearch activities+ */+ void callPostSearch() {+ for (int i = 0; i < postsearch.length; i++) {+ postsearch[i].doPostSearch(context);+ }+ }++ /**+ * Entry point to execute the search+ */+ public void doSearch() {+ // initiate Search Object+ LOG.fine("create search");+ Search search = new Search(serviceLocator);+ // create context+ LOG.fine("create context");+ context = new SearchContextImpl(search, serviceLocator);+ LOG.fine("presearch");+ callPreSearch();+ LOG.fine("search");+ callSearch();+ LOG.fine("post");+ callPostSearch();+ }+}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/NavigationHelper.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/NavigationHelper.javanew file mode 100644index 000000000..ec50bc881--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/NavigationHelper.java@@ -0,0 +1,80 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.common;++/**+ * Helper class to aid when forming search result navigation+ *+ *+ */+public class NavigationHelper {++ private int pageStart;++ private int hitsPerPage;++ private long totalHits;++ private boolean totalIsExact;++ public NavigationHelper(int pageStart, int hitsPerPage, long totalHits,+ boolean totalIsExact) {+ this.pageStart = pageStart;+ this.hitsPerPage = hitsPerPage;+ this.totalHits = totalHits;+ this.totalIsExact = totalIsExact;+ }++ protected Boolean hasPrev() {+ return new Boolean(pageStart > 0);+ }++ protected Boolean hasNext() {+ return new Boolean((totalIsExact && pageStart + hitsPerPage < totalHits)+ || (!totalIsExact && totalHits > pageStart + hitsPerPage));++ }++ protected void next() {+ pageStart += hitsPerPage;+ }++ /**+ * Returns offset to next page+ *+ * @return+ */+ public long getNextStart() {+ return pageStart + hitsPerPage;+ }++ public void prev() {+ pageStart -= hitsPerPage;+ }++ public int getPageNumber() {+ return pageStart / hitsPerPage;+ }++ protected Boolean getShowAllHits() {+ return new Boolean(!totalIsExact && (totalHits <= pageStart + hitsPerPage));+ }++ public long getEnd() {+ return Math.min(totalHits, getNextStart());+ }++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/PluginResourceLoader.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/PluginResourceLoader.javanew file mode 100644index 000000000..3a2d09e8e--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/PluginResourceLoader.java@@ -0,0 +1,262 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.common;++import java.io.IOException;+import java.io.InputStream;+import java.net.URL;+import java.net.URLClassLoader;+import java.util.ArrayList;+import java.util.Enumeration;+import java.util.Iterator;+import java.util.logging.Logger;++import org.apache.hadoop.util.LogFormatter;+import org.apache.nutch.plugin.Extension;+import org.apache.nutch.plugin.ExtensionPoint;+import org.apache.nutch.plugin.PluginClassLoader;+import org.apache.nutch.webapp.extension.UIExtensionPoint;++/**+ * PluginResourceLoader is capable of loading plugged in resources.+ */+public class PluginResourceLoader extends ClassLoader {++ public class ThrowAwayClassLoader extends ClassLoader {++ private ClassLoader one;++ private ClassLoader two;++ public ThrowAwayClassLoader(ClassLoader two, ClassLoader one) {+ this.one = one;+ this.two = two;+ }++ /*+ * (non-Javadoc)+ *+ * @see java.lang.ClassLoader#getResource(java.lang.String)+ */+ public URL getResource(String name) {+ URL retVal = one.getResource(name);+ if (retVal == null)+ retVal = two.getResource(name);+ return retVal;+ }++ /*+ * (non-Javadoc)+ *+ * @see java.lang.ClassLoader#getResourceAsStream(java.lang.String)+ */+ public InputStream getResourceAsStream(String name) {+ InputStream retVal = one.getResourceAsStream(name);+ if (retVal == null)+ retVal = two.getResourceAsStream(name);+ return retVal;+ }++ /*+ * (non-Javadoc)+ *+ * @see java.lang.ClassLoader#getResources(java.lang.String)+ */+ public Enumeration getResources(String name) throws IOException {+ Enumeration retVal = one.getResources(name);+ if (retVal == null)+ retVal = two.getResources(name);+ return retVal;+ }++ /*+ * (non-Javadoc)+ *+ * @see java.lang.ClassLoader#loadClass(java.lang.String)+ */+ public Class loadClass(String name) throws ClassNotFoundException {+ LOG.info("loading class " + name + " from " + one);+ try {+ return one.loadClass(name);+ } catch (ClassNotFoundException e) {+ }+ LOG.info("loading class " + name + " from " + two);+ try {+ return two.loadClass(name);+ } catch (ClassNotFoundException e) {+ }+ LOG.info("could not find class, must throw Exception");+ throw new ClassNotFoundException(name);+ }+ }++ ClassLoader wrapped;++ ArrayList classloaders = new ArrayList();++ public static Logger LOG = LogFormatter.getLogger(PluginResourceLoader.class+ .getName());++ public static PluginResourceLoader getInstance(ServiceLocator locator,+ ClassLoader parent) {+ PluginResourceLoader loader = (PluginResourceLoader) locator+ .getConfiguration().getObject(PluginResourceLoader.class.getName());++ if (loader == null) {+ LOG.info("created new nutch loader with parent loader:" + parent);+ loader = new PluginResourceLoader(locator, parent);+ locator.getConfiguration().setObject(+ PluginResourceLoader.class.getName(), loader);+ }+ return loader;+ }++ private PluginResourceLoader(ServiceLocator locator, ClassLoader parent) {+ init(locator, parent);+ }++ protected void init(ServiceLocator locator, ClassLoader parent) {++ ArrayList seen = new ArrayList();++ ArrayList paths = new ArrayList();++ LOG+ .info("PluginResourceLoader : dynamically setting jars based on plugins implementing UIExtensionPoint.");++ ExtensionPoint point = locator.getPluginRepository().getExtensionPoint(+ UIExtensionPoint.X_POINT_ID);++ if (point == null) {+ LOG.info("Can't find extension point '" + UIExtensionPoint.X_POINT_ID+ + "'");+ classloaders.add(parent);+ return;+ }++ Extension[] extensions = point.getExtensions();++ for (int i = 0; i < extensions.length; i++) {+ Extension extension = extensions[i];++ PluginClassLoader loader = extension.getDescriptor().getClassLoader();++ // classloaders.add(loader);++ URL urls[] = loader.getURLs();++ for (int k = 0; k < urls.length; k++) {+ URL url = urls[k];+ if (!seen.contains(url)) {+ paths.add(url);+ LOG.info("Adding to classpath:" + url);+ }+ seen.add(url);+ }+ }++ URL[] urls = (URL[]) paths.toArray(new URL[paths.size()]);+ classloaders.add(new URLClassLoader(urls, parent));++ }++ /*+ * s (non-Javadoc)+ *+ * @see java.lang.ClassLoader#getResource(java.lang.String)+ */+ public URL getResource(String name) {+ Iterator i = classloaders.iterator();++ while (i.hasNext()) {+ ClassLoader loader = (ClassLoader) i.next();+ URL retVal = loader.getResource(name);+ if (retVal != null) {+ return retVal;+ }+ }+ return null;+ }++ /*+ * (non-Javadoc)+ *+ * @see java.lang.ClassLoader#getResourceAsStream(java.lang.String)+ */+ public InputStream getResourceAsStream(String name) {+ Iterator i = classloaders.iterator();++ while (i.hasNext()) {+ ClassLoader loader = (ClassLoader) i.next();+ InputStream retVal = loader.getResourceAsStream(name);+ if (retVal != null) {+ return retVal;+ }+ }+ return null;+ }++ /*+ * (non-Javadoc)+ *+ * @see java.lang.ClassLoader#getResources(java.lang.String)+ */+ public Enumeration getResources(String name) throws IOException {+ Iterator i = classloaders.iterator();++ while (i.hasNext()) {+ ClassLoader loader = (ClassLoader) i.next();+ Enumeration retVal = loader.getResources(name);+ if (retVal != null) {+ return retVal;+ }+ }+ return null;+ }++ /*+ * (non-Javadoc)+ *+ * @see java.lang.ClassLoader#loadClass(java.lang.String)+ */+ public Class loadClass(String name) throws ClassNotFoundException {++ try {+ // LOG.info("CUSTOM_LOADER->load");+ Iterator i = classloaders.iterator();+ Class retVal = null;+ while (i.hasNext()) {++ ClassLoader loader = (ClassLoader) i.next();+ // LOG.info("trying to load " + name + " from:" + loader);+ try {+ retVal = loader.loadClass(name);+ } catch (Exception e) {+ LOG.info("Exception in loader " + e);+ }+ if (retVal != null) {+ // LOG.info("CUSTOM_LOADER->found");+ return retVal;+ }+ }+ // LOG.info("CUSTOM_LOADER_not found");+ } catch (Exception e) {+ LOG.info("Exception in loader " + e);+ e.printStackTrace(System.out);+ }+ throw new ClassNotFoundException(name);+ }+}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Preferences.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Preferences.javanew file mode 100644index 000000000..5e9c8d5db--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Preferences.java@@ -0,0 +1,164 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.common;++import java.util.HashMap;+import java.util.Locale;++import javax.servlet.http.Cookie;+import javax.servlet.http.HttpServletRequest;+import javax.servlet.http.HttpServletResponse;++/**+ * Preferences represents (extendable) configuration object that is persistable+ * into user browser (as cookie)+ *+ * cookie is in format key-1=value-1,key-2=value-2,key-n=value-n+ */+public class Preferences extends HashMap {++ private static final long serialVersionUID = 1;++ public static final String KEY_LOCALE = "L";++ public static final String KEY_RESULTS_PER_PAGE = "R";++ public static final String KEY_RESULTS_PER_DUP = "S";++ public static final String KEY_DUP_FIELD = "D";++ // Name of web ui cookie that stores users cutomized user preferences+ public static String COOKIE_NAME = "NUTCH";++ // default preferences, used for all who have not customized+ static Preferences defaults = new Preferences();++ static {+ // results per page+ defaults.put(KEY_RESULTS_PER_PAGE, "10");++ // dup field+ defaults.put(KEY_DUP_FIELD, "site");+ }++ /**+ *+ * @return locale of user (from preferences if set, or from request)+ */+ public Locale getLocale(HttpServletRequest request) {+ if (containsKey(KEY_LOCALE))+ return new Locale((String) defaults.get(KEY_LOCALE));+ else+ return request.getLocale();+ }++ public static void setPreferencesCookie(HttpServletRequest request,+ HttpServletResponse response, Preferences prefs) {+ if (defaults.equals(prefs)) {+ removeCookie(response);+ } else {+ setPreferencesCookie(response, prefs);+ }+ }++ private static void setPreferencesCookie(HttpServletResponse response,+ Preferences prefs) {+ Cookie prefscookie = new Cookie(COOKIE_NAME, prefs.toString());+ prefscookie.setMaxAge(Integer.MAX_VALUE);+ response.addCookie(prefscookie);+ }++ public static void removeCookie(HttpServletResponse response) {+ Cookie prefscookie = new Cookie(COOKIE_NAME, "");+ prefscookie.setMaxAge(-1);+ response.addCookie(prefscookie);+ }++ /**+ * Parse Preferences from cookie+ *+ * @param request+ */+ public static Preferences parseCookie(HttpServletRequest request) {+ // find right cookie+ Cookie c[] = request.getCookies();++ if (c != null) {+ for (int i = 0; i < c.length; i++) {+ if (COOKIE_NAME.equals(c[i].getName())) {+ return Preferences.parse(c[i].getValue());+ }+ }+ }+ return defaults;+ }++ public static Preferences parse(String data) {+ Preferences p = new Preferences();+ p.putAll(defaults);+ String[] dataitems = data.split(",");+ for (int i = 0; i < dataitems.length; i++) {+ String keyvalue[] = dataitems[0].split("=");+ if (keyvalue.length == 2) {+ p.put(keyvalue[0], keyvalue[1]);+ break;+ }+ }+ return p;+ }++ public int getInt(String name, int defaultVal) {+ try {+ return get(name) == null ? defaultVal : Integer+ .parseInt((String) get(name));+ } catch (Exception e) {+ return defaultVal;+ }+ }++ /**+ * return value or default if non existing+ *+ */+ public String getString(String name, String defaultVal) {+ return get(name) == null ? defaultVal : (String) get(name);+ }++ public String toString() {+ StringBuffer txt = new StringBuffer();+ Object[] keys = keySet().toArray();++ for (int i = 0; i < keys.length; i++) {+ txt.append(keys[i].toString()).append("=").append(get(keys[i]));+ if (i < keys.length - 1)+ txt.append(",");+ }++ return txt.toString();+ }++ public static Preferences getPreferences(HttpServletRequest request) {+ Preferences prefs = (Preferences) request.getAttribute(Preferences.class+ .getName());+ // processing locale+ if (prefs == null) {+ prefs = Preferences.parseCookie(request);+ request.setAttribute(Preferences.class.getName(), prefs);+ }+ return prefs;+ }++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.javanew file mode 100644index 000000000..f5e02fcdb--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java@@ -0,0 +1,439 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.common;++import java.io.IOException;+import java.util.ArrayList;+import java.util.List;+import java.util.logging.Logger;++import org.apache.hadoop.util.LogFormatter;+import org.apache.nutch.html.Entities;+import org.apache.nutch.searcher.Hit;+import org.apache.nutch.searcher.HitDetails;+import org.apache.nutch.searcher.Hits;+import org.apache.nutch.searcher.NutchBean;+import org.apache.nutch.searcher.Query;++/**+ * Search is a bean that represents an ongoing search.+ *+ * After search searchBean that represents the search user doing (also the+ * results) might be a good candidate for caching ?+ *+ */+public class Search {++ public static Logger LOG = LogFormatter.getLogger(Search.class.getName());++ String queryString;++ String htmlQueryString;++ Query query;++ int maxHits;++ int startOffset;++ int hitsPerSite;++ int hitsPerPage;++ String sortColumn;++ boolean sortDesc;++ Hits hits;++ Hit[] show;++ HitDetails[] details;++ String[] summaries;++ ArrayList results = null;++ NavigationHelper navigationHelper;++ ServiceLocator locator;++ SearchForm form;++ String dupField;++ /**+ * Perform search described by this bean+ *+ * @param bean+ */+ public void performSearch(NutchBean bean) {++ try {+ hits = bean.search(getQuery(), getStartOffset() + getMaxHits(),+ getHitsPerSite(), getDupField(), getSortColumn(), isSortDesc());+ } catch (IOException e) {+ hits = new Hits(0, new Hit[0]);+ }++ navigationHelper = new NavigationHelper(startOffset, hitsPerPage, hits+ .getTotal(), hits.totalIsExact());++ // set offset to next page to form so it get's to ui+ if (navigationHelper.hasNext().booleanValue()) {+ form.setValue(SearchForm.NAME_START, Long.toString(navigationHelper+ .getNextStart()));+ }++ LOG.info("form:");+ LOG.info(locator.getSearchForm().toString());+ LOG.info("performing search");++ // found some unused code ?+ int realEnd = (int) Math.min(hits.getLength(), getStartOffset()+ + getMaxHits());++ show = hits.getHits(getStartOffset(), realEnd - getStartOffset());++ try {+ details = bean.getDetails(show);+ summaries = bean.getSummary(details, getQuery());+ } catch (IOException e) {+ LOG.info("Error getting hit information:" + e);+ e.printStackTrace();+ }+ }++ /**+ * gets the results of search to display+ *+ * @return+ */+ public List getResults() {+ if (results == null) {+ results = new ArrayList(details.length);+ for (int i = 0; i < details.length; i++) {+ results.add(new SearchResultBean(this, show[i], details[i],+ summaries[i]));+ }+ }+ return results;+ }++ protected int parseInt(String value, int defaultValue) {+ int ret = defaultValue;+ if (value != null) {+ try {+ ret = Integer.parseInt(value);+ } catch (Exception e) {+ // ignore+ }+ }+ return ret;+ }++ public Search(ServiceLocator locator) {+ this.locator = locator;+ Preferences prefs = locator.getPreferences();+ form = locator.getSearchForm();++ queryString = form.getValueString(SearchForm.NAME_QUERYSTRING);+ if (queryString == null)+ queryString = "";+ htmlQueryString = Entities.encode(queryString);++ startOffset = parseInt(form.getValueString(SearchForm.NAME_START), 0);+ hitsPerPage = parseInt(form.getValueString(SearchForm.NAME_HITSPERPAGE),+ prefs.getInt(Preferences.KEY_RESULTS_PER_PAGE, 10));+ hitsPerSite = parseInt(form.getValueString("hitsPerSite"), prefs.getInt(+ Preferences.KEY_RESULTS_PER_DUP, 2));++ maxHits = hitsPerPage;++ sortColumn = form.getValueString(SearchForm.NAME_SORTCOLUMN);++ sortDesc = (sortColumn != null && "true".equals(form+ .getValueString(SearchForm.NAME_SORTREVERSE)));++ dupField = form.getValueString(SearchForm.NAME_DUPCOLUMN);+ if (dupField == null)+ dupField = "site";++ try {+ query = Query.parse(queryString, locator.getConfiguration());+ } catch (IOException e) {+ LOG.info("Error parsing query:" + e);+ e.printStackTrace();+ }++ }++ /**+ * @return Returns the hitsPerPage.+ */+ public int getHitsPerPage() {+ return hitsPerPage;+ }++ /**+ * @param hitsPerPage+ * The hitsPerPage to set.+ */+ protected void setHitsPerPage(int hitsPerPage) {+ this.hitsPerPage = hitsPerPage;+ }++ /**+ * @return Returns the hitsPerSite.+ */+ public int getHitsPerSite() {+ return hitsPerSite;+ }++ /**+ * @param hitsPerSite+ * The hitsPerSite to set.+ */+ protected void setHitsPerSite(int hitsPerSite) {+ this.hitsPerSite = hitsPerSite;+ }++ /**+ * @return Returns the maxHits.+ */+ public int getMaxHits() {+ return maxHits;+ }++ /**+ * @param maxHits+ * The maxHits to set.+ */+ protected void setMaxHits(int maxHits) {+ this.maxHits = maxHits;+ }++ /**+ * @return Returns the query.+ */+ public Query getQuery() {+ return query;+ }++ /**+ * @param query+ * The query to set.+ */+ protected void setQuery(Query query) {+ this.query = query;+ }++ /**+ * @return Returns the queryString.+ */+ public String getQueryString() {+ return queryString;+ }++ /**+ * @param queryString+ * The queryString to set.+ */+ protected void setQueryString(String queryString) {+ this.queryString = queryString;+ }++ /**+ * Returns true if sort is descending+ *+ * @return Returns sort order+ */+ public boolean isSortDesc() {+ return sortDesc;+ }++ /**+ * Set sort order+ *+ * @param sortAsc+ * The sortAsc to set.+ */+ protected void setSortDesc(boolean sortAsc) {+ this.sortDesc = sortAsc;+ }++ /**+ * @return Returns the sortColumn.+ */+ public String getSortColumn() {+ return sortColumn;+ }++ /**+ * @param sortColumn+ * The sortColumn to set.+ */+ protected void setSortColumn(String sortColumn) {+ this.sortColumn = sortColumn;+ }++ /**+ * @return Returns the startOffset.+ */+ public int getStartOffset() {+ return startOffset;+ }++ /**+ * @param startOffset+ * The startOffset to set.+ */+ protected void setStartOffset(int startOffset) {+ this.startOffset = startOffset;+ }++ /**+ * @return Returns the htmlQueryString.+ */+ public String getHtmlQueryString() {+ return htmlQueryString;+ }++ /**+ * @param htmlQueryString+ * The htmlQueryString to set.+ */+ protected void setHtmlQueryString(String htmlQueryString) {+ this.htmlQueryString = htmlQueryString;+ }++ /**+ * @return Returns the details.+ */+ public HitDetails[] getDetails() {+ return details;+ }++ /**+ * @param details+ * The details to set.+ */+ protected void setDetails(HitDetails[] details) {+ this.details = details;+ }++ /**+ * @return Returns the hits.+ */+ public Hits getHits() {+ return hits;+ }++ /**+ * @param hits+ * The hits to set.+ */+ protected void setHits(Hits hits) {+ this.hits = hits;+ }++ /**+ * @return Returns the show.+ */+ public Hit[] getShow() {+ return show;+ }++ /**+ * @param show+ * The show to set.+ */+ protected void setShow(Hit[] show) {+ this.show = show;+ }++ /**+ * @return Returns the summaries.+ */+ public String[] getSummaries() {+ return summaries;+ }++ /**+ * @param summaries+ * The summaries to set.+ */+ protected void setSummaries(String[] summaries) {+ this.summaries = summaries;+ }++ /**+ * returns start, end, total, used for printing message on search page, this+ * is why offset is +1'd+ */+ public String[] getResultInfo() {+ return new String[] { Long.toString(startOffset + 1),+ Long.toString(navigationHelper.getEnd()),+ Long.toString(hits.getTotal()), getHtmlQueryString() };+ }++ /**+ * @return true if more results available+ */+ public Boolean getHasNextPage() {+ return navigationHelper.hasNext();+ }++ /**+ * @return true if previous page if available+ */+ public Boolean getHasPrevPage() {+ return navigationHelper.hasPrev();+ }++ public String getDupField() {+ return dupField;+ }++ protected SearchForm getForm() {+ return form;+ }++ /**+ *+ * @return+ */+ public List getFormProperties() {+ return form.getActive();+ }++ public Boolean getShowAllHits() {+ return navigationHelper.getShowAllHits();+ }++ /**+ * return boolean if there are results+ *+ * @return+ */+ public Boolean getHasResults() {+ return new Boolean(hits.getTotal() > 0);+ }++ public Boolean getIsSearch() {+ return new Boolean(queryString == null || queryString.trim().equals(""));+ }+}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchContext.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchContext.javanew file mode 100644index 000000000..8e13ff200--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchContext.java@@ -0,0 +1,77 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.common;++import org.apache.hadoop.conf.Configuration;++/**+ * SearchContext+ */+public interface SearchContext {++ /**+ * Get active search+ *+ * @return+ */+ Search getSearch();++ /**+ * Test is named parameter exits+ *+ * @param key+ * @return+ */+ boolean containsKey(Object key);++ /**+ * Return named parameter+ *+ * @param key+ * @return+ */+ String getParameter(Object key);++ /**+ * Return named object+ *+ * @param key+ * @return+ */+ Object get(Object key);++ /**+ * Return active Preferences+ *+ * @return+ */+ Preferences getPreferences();++ /**+ * Return active SearchForm+ *+ * @return+ */+ SearchForm getSearchForm();++ /**+ * Return active Configuration+ *+ * @return+ */+ Configuration getConfigiration();++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchContextImpl.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchContextImpl.javanew file mode 100644index 000000000..77b0ed889--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchContextImpl.java@@ -0,0 +1,93 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.common;++import java.util.HashMap;++import org.apache.hadoop.conf.Configuration;++/**+ * Default Implementation of+ *+ * @see SearchContext+ */+public class SearchContextImpl extends HashMap implements SearchContext {++ private static final long serialVersionUID = 1L;++ Search search;++ ServiceLocator serviceLocator;++ /**+ * Constructs a SearchContextImpl object and initializes it with provided data+ *+ * @param search+ * the Search object this context belongs to+ * @param locator+ * Used ServiceLocator+ */+ SearchContextImpl(Search search, ServiceLocator locator) {+ super();+ this.search = search;+ this.serviceLocator = locator;+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.nutch.webapp.common.SearchContext#getSearch()+ */+ public Search getSearch() {+ return search;+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.nutch.webapp.common.SearchContext#getParameter(java.lang.Object)+ */+ public String getParameter(Object key) {+ return (String) get(key);+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.nutch.webapp.common.SearchContext#getPreferences()+ */+ public Preferences getPreferences() {+ return serviceLocator.getPreferences();+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.nutch.webapp.common.SearchContext#getSearchForm()+ */+ public SearchForm getSearchForm() {+ return serviceLocator.getSearchForm();+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.nutch.webapp.common.SearchContext#getConfigiration()+ */+ public Configuration getConfigiration() {+ return serviceLocator.getConfiguration();+ }+}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchForm.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchForm.javanew file mode 100644index 000000000..60d463bd8--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchForm.java@@ -0,0 +1,304 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.common;++import java.io.UnsupportedEncodingException;+import java.net.URLEncoder;+import java.util.ArrayList;+import java.util.HashMap;+import java.util.Iterator;+import java.util.List;+import java.util.Map;++/**+ * SearchForm is a representation of query parameters submitted as part of+ * search form. It provides functionality to preserve all required parameters+ * for example when creating link to "next page"+ *+ * Plugins participating in search+ *+ * @see org.apache.nutch.webapp.extension.PreSearch,+ * @see org.apache.nutch.webapp.extension.Search,+ * @see org.apache.nutch.webapp.extension.PostSearch+ *+ * can by reading (existing) or setting values to/from this map make sure that+ * those parameters are persisted to forms/links requiring them without any+ * special tricks.+ *+ */+public class SearchForm {++ /**+ * General HTTP parameter name wich contains hits per page value+ */+ public static final String NAME_HITSPERPAGE = "hitsPerPage";++ public static final String NAME_HITSPERSITE = "hitsPerSite";++ public static final String NAME_START = "start";++ public static final String NAME_QUERYSTRING = "query";++ public static final String NAME_SORTCOLUMN = "sort";++ public static final String NAME_SORTREVERSE = "reverse";++ public static final String NAME_DUPCOLUMN = "dup";++ private static final long serialVersionUID = 1L;++ Map o_values;++ Map n_values = new HashMap();++ ArrayList active;++ /**+ * KeyValue presents a class that holds key value pair+ *+ */+ public static class KeyValue {++ String key;++ String value;++ /**+ * Construct new KeyValue with provided values+ *+ * @param key+ * the key+ * @param value+ * the value+ */+ public KeyValue(String key, String value) {+ this.key = key;+ this.value = value;+ }++ /**+ * Gets the key+ *+ * @return contained key+ */+ public String getKey() {+ return key;+ }++ /**+ * Gets the value+ *+ * @return contained value+ */+ public String getValue() {+ return value;+ }++ /**+ * Sets the value+ *+ * @param value+ * The value to set.+ */+ public void setValue(String value) {+ this.value = value;+ }++ /*+ * (non-Javadoc)+ *+ * @see java.lang.Object#toString()+ */+ public String toString() {+ return value.toString();+ }+ }++ /**+ * Construct new SearchForm based on provided map map values are String arrays+ *+ * @param parameters+ * original map from request+ */+ public SearchForm(Map parameters) {+ o_values = parameters;+ active = new ArrayList();+ }++ /**+ * Sets value for provided key+ *+ * @param key+ * the key to set the value on+ * @param value+ * the value to set+ */+ public void setValue(String key, String value) {+ if (n_values.containsKey(key)) {+ ((KeyValue) n_values.get(key)).setValue(value);+ } else {+ n_values.put(key, new KeyValue(key, value));+ }+ active.add(n_values.get(key));+ }++ /**+ * Gets the real value contained in keyed KeyValue+ *+ * @param key+ * @return+ */+ public String getValue(String key) {+ if (n_values.containsKey(key)) {+ active.add(n_values.get(key));+ return (String) ((KeyValue) n_values.get(key)).getValue();+ } else+ return null;+ }++ /**+ * Gets the String value contained in keyed KeyValue+ *+ * @param key+ * @return Object.toString()+ */+ public String getValueString(String key) {+ if (n_values.containsKey(key)) {+ active.add(n_values.get(key));+ } else if (o_values.containsKey(key)) {+ // get only the 1st parameter+ n_values.put(key, new KeyValue(key, ((String[]) o_values.get(key))[0]));+ active.add(n_values.get(key));+ } else+ return null;++ try {+ return (String) ((KeyValue) n_values.get(key)).getValue();+ } catch (ClassCastException e) {+ return ((KeyValue) n_values.get(key)).getValue().toString();+ }+ }++ /**+ * Remove named key (and the KeyValue)+ *+ * @param key+ * @return+ */+ public KeyValue remove(String key) {+ if (n_values.containsKey(key)) {+ active.remove(n_values.get(key));+ return (KeyValue) n_values.remove(key);+ } else+ return null;+ }++ /**+ * Get named KeyValue object+ *+ * @param key+ * @return named object or null if not existing+ */+ public KeyValue getKeyValue(String key) {+ if (n_values.containsKey(key)) {+ active.add(key);+ }+ return (KeyValue) n_values.get(key);+ }++ /**+ * returns list of KeyValue objects that have been read or set+ *+ * @return List containing KeyValue objects+ */+ public List getActive() {+ return active;+ }++ /*+ * (non-Javadoc)+ *+ * @see java.lang.Object#toString()+ */+ public String toString() {++ StringBuffer sb = new StringBuffer();++ sb.append("Original map {");++ Iterator i = o_values.keySet().iterator();++ while (i.hasNext()) {+ Object o = i.next();+ sb.append("[" + o.toString()).append(", ");+ sb.append(((String[]) o_values.get(o))[0]).append("] ");+ }+ sb.append("}\n");++ sb.append("Used map {");++ i = n_values.keySet().iterator();++ while (i.hasNext()) {+ Object o = i.next();+ sb.append("[" + o.toString()).append(", ");+ sb.append(n_values.get(o)).append("] ");+ }+ sb.append("}\n");++ return sb.toString();+ }++ /**+ * Returns a string usable in urls that contains all active parameters and+ * their values, if submitted encoding does not work values are encoded with+ * default encoding.+ *+ * @param encoding+ * @return+ */+ public String getParameterString(String encoding)+ throws UnsupportedEncodingException {++ boolean useEncoding = true;+ StringBuffer sb = new StringBuffer();++ try {+ URLEncoder.encode("", encoding);+ } catch (UnsupportedEncodingException e) {+ useEncoding = false;+ }++ List l = getActive();++ Iterator i = l.iterator();+ while (i.hasNext()) {+ KeyValue kv = (KeyValue) i.next();+ if (useEncoding) {+ sb.append(URLEncoder.encode(kv.getKey(), encoding)).append("=").append(+ URLEncoder.encode(kv.getValue(), encoding));+ } else {+ sb.append(URLEncoder.encode(kv.getKey())).append("=").append(+ URLEncoder.encode(kv.getValue()));+ }+ if (i.hasNext()) {+ sb.append("&");+ }+ }+ return sb.toString();+ }++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchResultBean.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchResultBean.javanew file mode 100644index 000000000..c59d36cb5--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/SearchResultBean.java@@ -0,0 +1,173 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.common;++import java.io.UnsupportedEncodingException;+import java.net.URLEncoder;++import org.apache.nutch.html.Entities;+import org.apache.nutch.searcher.Hit;+import org.apache.nutch.searcher.HitDetails;++/**+ * SearchResultBean contains information about one search result in easily+ * accessible form.+ */+public class SearchResultBean {++ Hit hit;++ String summary;++ HitDetails details;++ Search search;++ public SearchResultBean(Search search, Hit hit, HitDetails details,+ String summary) {+ this.search = search;+ this.hit = hit;+ this.details = details;+ this.summary = summary;+ }++ /**+ * Url of search result+ *+ * @return+ */+ public String getUrl() {+ return details.getValue("url");+ }++ /**+ * Title of search result+ *+ * @return+ */+ public String getTitle() {+ String title = details.getValue("title");+ return title == null || title.equals("") ? getUrl() : title;+ }++ /**+ * Id of search result+ *+ * @return+ */+ public String getId() {+ return "idx=" + hit.getIndexNo() + "&id=" + hit.getIndexDocNo();+ }++ /**+ * Summary of search result+ *+ * @return+ */+ public String getSummary() {+ return summary;+ }++ /**+ * Url of search result in encoded form+ *+ * @return+ */+ public String getEncodedUrl() {+ return Entities.encode(getUrl());+ }++ /**+ * Title of search result in encoded form+ *+ * @return+ */+ public String getEncodedTitle() {+ return Entities.encode(getTitle());+ }++ /**+ * "more" url this should be replaced with help of SearchForm+ *+ * @return+ *+ */+ public String getMoreUrl() throws UnsupportedEncodingException {+ String more = "";++ more = "query="+ + URLEncoder.encode(search.getDupField() + ":" + hit.getDedupValue()+ + " " + search.getQueryString(), "UTF8")+ + search.getForm().getParameterString("UTF8");// "&hitsPerSite=" + 0;++ return more;+ }++ /**+ * Dedup field name+ *+ * @return+ */+ public String getDedupValue() {+ return hit.getDedupValue();+ }++ /**+ * QueryString in encoded form+ *+ * @return+ */+ public String getUrlEncodedQuery() {+ try {+ if (search.getQueryString() != null)+ return URLEncoder.encode(search.getQueryString(), "UTF-8");+ } catch (UnsupportedEncodingException e) {+ // TODO Auto-generated catch block+ e.printStackTrace();+ }+ return search.queryString != null ? search.queryString : "";+ }++ /**+ * HitDetails of search result+ *+ * @return+ */+ public HitDetails getDetails() {+ return details;+ }++ /**+ * Hit of search result+ *+ * @return+ */+ public Hit getHit() {+ return hit;+ }++ /**+ * Boolean indicating that there are other, lower-scoring hits with the same+ * dedup value+ *+ * @see Hit#moreFromDupExcluded()+ *+ * @return true if more dups available+ */+ public Boolean getHasMore() {+ return new Boolean(hit.moreFromDupExcluded());+ }+}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/ServiceLocator.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/ServiceLocator.javanew file mode 100644index 000000000..5dacd0d41--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/ServiceLocator.java@@ -0,0 +1,82 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.common;++import java.util.Locale;++import org.apache.hadoop.conf.Configuration;++import org.apache.nutch.plugin.PluginRepository;+import org.apache.nutch.searcher.NutchBean;++/**+ * ServiceLocator interface. ServiceLocator is used to get handle to some of the+ * core services of nutch.+ */+public interface ServiceLocator {++ /**+ * Return active Configuration instance (application context)+ *+ * @return+ */+ public Configuration getConfiguration();++ /**+ * Return active PluginRepsository instance (application instance)+ *+ * @return+ */+ public PluginRepository getPluginRepository();++ /**+ * Return active SearchForm (request instance)+ *+ * @return+ */+ public SearchForm getSearchForm();++ /**+ * Return active Preferences (request context)+ *+ * @return+ */+ public Preferences getPreferences();++ /**+ * Return active NutchBean (application context)+ *+ * @return+ */+ public NutchBean getNutchBean();++ /**+ * Return active PluginResourceLoader (application context)+ *+ * @return+ */+ public PluginResourceLoader getPluginResourceLoader(ClassLoader loader);++ /**+ * Return active Search (request context)+ *+ * @return+ */+ public Search getSearch();++ public Locale getLocale();++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/ServletContextServiceLocator.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/ServletContextServiceLocator.javanew file mode 100644index 000000000..0170da339--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/ServletContextServiceLocator.java@@ -0,0 +1,133 @@+package org.apache.nutch.webapp.common;++import java.io.IOException;+import java.util.Locale;+import java.util.logging.Logger;++import javax.servlet.ServletContext;++import org.apache.hadoop.conf.Configuration;+import org.apache.hadoop.util.LogFormatter;+import org.apache.nutch.plugin.PluginRepository;+import org.apache.nutch.searcher.NutchBean;+import org.apache.nutch.util.NutchConfiguration;++public abstract class ServletContextServiceLocator implements ServiceLocator {++ /**+ * ServiceLocator will be saved in ServletContext under this key+ */+ private static final String KEY = ServletContextServiceLocator.class+ .getName();++ /**+ * Logger+ */+ public static Logger LOG = LogFormatter+ .getLogger(ServletContextServiceLocator.class.getName());++ /**+ * ServletContext this ServiceLocator is bound to+ */+ protected ServletContext servletContext;++ /**+ * Active configuration+ */+ protected Configuration config;++ /**+ * Active PluginRepository+ */+ private PluginRepository repository;++ /**+ * Active NutchBean+ */+ private NutchBean bean;++ /**+ * Private Constructor used to create new ServiceLocator when needed+ *+ * @param servletContext+ */+ private ServletContextServiceLocator(ServletContext servletContext) {+ this.servletContext = servletContext;+ config = NutchConfiguration.get(servletContext);+ repository = PluginRepository.get(config);+ try {+ bean = new NutchBean(config);+ } catch (IOException e) {+ e.printStackTrace();+ }+ }++ /**+ * Factory method to get handle to ServiceLocator, or if none exists in+ * ServletContext then one is created.+ *+ * @param context+ * @return ServiceLocator instance bound to ServletContext+ */+ public static ServiceLocator getInstance(ServletContext context) {+ ServiceLocator locator = (ServiceLocator) context.getAttribute(KEY);+ if (locator == null) {+ LOG.info("creating new serviceLocator for context:" + context);+ locator = new ServletContextServiceLocator(context) {+ public SearchForm getSearchForm() {+ return null;+ }++ public Preferences getPreferences() {+ return null;+ }++ public Search getSearch() {+ return null;+ }++ public Locale getLocale() {+ return null;+ }+ };+ context.setAttribute(KEY, locator);+ }+ return locator;+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.nutch.webapp.common.ServiceLocator#getConfiguration()+ */+ public Configuration getConfiguration() {+ return config;+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.nutch.webapp.common.ServiceLocator#getPluginRepository()+ */public PluginRepository getPluginRepository() {+ return repository;+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.nutch.webapp.common.ServiceLocator#getNutchBean()+ */+ public NutchBean getNutchBean() {+ return bean;+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.nutch.webapp.common.ServiceLocator#getPluginResourceLoader(java.lang.ClassLoader)+ */+ public PluginResourceLoader getPluginResourceLoader(ClassLoader loader) {+ return PluginResourceLoader.getInstance(this, loader);+ }++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/WebappInstanceServiceLocator.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/WebappInstanceServiceLocator.javanew file mode 100644index 000000000..5759754b6--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/WebappInstanceServiceLocator.java@@ -0,0 +1,138 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.common;++import java.util.Locale;+import java.util.logging.Logger;++import javax.servlet.ServletContext;+import javax.servlet.http.HttpServletRequest;++import org.apache.hadoop.conf.Configuration;+import org.apache.hadoop.util.LogFormatter;+import org.apache.nutch.plugin.PluginRepository;+import org.apache.nutch.searcher.NutchBean;++public class WebappInstanceServiceLocator implements ServiceLocator {++ public static Logger LOG = LogFormatter+ .getLogger(WebappInstanceServiceLocator.class.getName());++ HttpServletRequest request;++ ServiceLocator contextLocator;++ /**+ * Creates new WebappInstanceServiceLocator instance and binds it to request+ *+ * @param request+ * @param servletContext+ */+ public WebappInstanceServiceLocator(HttpServletRequest request,+ ServletContext servletContext) {+ this.request = request;+ contextLocator = ServletContextServiceLocator.getInstance(servletContext);+ WebappInstanceServiceLocator.register(request, this);+ }++ public Preferences getPreferences() {+ return Preferences.getPreferences(request);+ }++ public SearchForm getSearchForm() {+ if (request.getAttribute(SearchForm.class.getName()) == null) {+ request.setAttribute(SearchForm.class.getName(), new SearchForm(request+ .getParameterMap()));+ }+ return (SearchForm) request.getAttribute(SearchForm.class.getName());+ }++ public Search getSearch() {+ String key = Search.class.getName();+ Search search = (Search) request.getAttribute(key);+ if (search == null) {+ search = new Search(this);+ request.setAttribute(key, search);+ }++ return search;+ }++ /**+ *+ * @param request+ * @return+ */+ public static ServiceLocator getFrom(HttpServletRequest request) {+ return (ServiceLocator) request+ .getAttribute(WebappInstanceServiceLocator.class.getName());+ }++ /**+ *+ * @param request+ * @param locator+ */+ public static void register(HttpServletRequest request,+ WebappInstanceServiceLocator locator) {+ WebappInstanceServiceLocator l = (WebappInstanceServiceLocator) request+ .getAttribute(WebappInstanceServiceLocator.class.getName());+ if (locator != null && locator != l) {+ request.setAttribute(WebappInstanceServiceLocator.class.getName(),+ locator);+ }+ }++ /*+ * (non-Javadoc)+ * @see org.apache.nutch.webapp.common.ServiceLocator#getConfiguration()+ */+ public Configuration getConfiguration() {+ return contextLocator.getConfiguration();+ }++ /*+ * (non-Javadoc)+ * @see org.apache.nutch.webapp.common.ServiceLocator#getPluginRepository()+ */+ public PluginRepository getPluginRepository() {+ return contextLocator.getPluginRepository();+ }++ /*+ * (non-Javadoc)+ * @see org.apache.nutch.webapp.common.ServiceLocator#getNutchBean()+ */+ public NutchBean getNutchBean() {+ return contextLocator.getNutchBean();+ }++ /*+ * (non-Javadoc)+ * @see org.apache.nutch.webapp.common.ServiceLocator#getPluginResourceLoader(java.lang.ClassLoader)+ */+ public PluginResourceLoader getPluginResourceLoader(ClassLoader loader) {+ return contextLocator.getPluginResourceLoader(loader);+ }++ /*+ * (non-Javadoc)+ * @see org.apache.nutch.webapp.common.ServiceLocator#getLocale()+ */+ public Locale getLocale() {+ return getPreferences().getLocale(request);+ }+}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/common/web2_services.png b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/web2_services.pngnew file mode 100644index 000000000..5467f9e39Binary files /dev/null and b/contrib/web2/src/main/java/org/apache/nutch/webapp/common/web2_services.png differdiff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/AnchorsController.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/AnchorsController.javanew file mode 100644index 000000000..fea60e808--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/AnchorsController.java@@ -0,0 +1,78 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.controller;++import java.io.IOException;+import java.util.List;+import java.util.ArrayList;++import javax.servlet.ServletContext;+import javax.servlet.ServletException;+import javax.servlet.http.HttpServletRequest;+import javax.servlet.http.HttpServletResponse;++import org.apache.nutch.html.Entities;+import org.apache.nutch.searcher.Hit;+import org.apache.nutch.searcher.HitDetails;+import org.apache.nutch.searcher.NutchBean;+import org.apache.nutch.webapp.common.ServiceLocator;+import org.apache.struts.tiles.ComponentContext;++public class AnchorsController extends NutchController {++ public class AnchorsBean {+ HitDetails details;++ ArrayList anchors;++ protected AnchorsBean(ArrayList v, HitDetails details) {+ this.anchors = v;+ this.details = details;+ }++ public String getUrl() {+ return details.getValue("url");+ }++ public List getAnchors() {+ return anchors;+ }+ }++ public void nutchPerform(ComponentContext tileContext,+ HttpServletRequest request, HttpServletResponse response,+ ServletContext servletContext) throws ServletException, IOException {+ ServiceLocator locator = getServiceLocator(request);+ NutchBean bean = locator.getNutchBean();++ LOG.info("anchors request from " + request.getRemoteAddr());+ Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")), Integer+ .parseInt(request.getParameter("id")));++ HitDetails details = bean.getDetails(hit);++ String[] anchors = bean.getAnchors(details);+ ArrayList anchorVector = new ArrayList();+ if (anchors != null) {+ for (int i = 0; i < anchors.length; i++) {+ anchorVector.add(Entities.encode(anchors[i]));+ }+ }+ request+ .setAttribute("nutchAnchors", new AnchorsBean(anchorVector, details));+ logRequestAttributes(request);+ }+}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/CachedController.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/CachedController.javanew file mode 100644index 000000000..13143c14a--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/CachedController.java@@ -0,0 +1,50 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.controller;++import java.io.IOException;++import javax.servlet.ServletContext;+import javax.servlet.ServletException;+import javax.servlet.http.HttpServletRequest;+import javax.servlet.http.HttpServletResponse;++import org.apache.nutch.searcher.Hit;+import org.apache.nutch.searcher.HitDetails;+import org.apache.nutch.searcher.NutchBean;+import org.apache.nutch.searcher.Query;+import org.apache.nutch.webapp.common.ServiceLocator;+import org.apache.struts.tiles.ComponentContext;++public class CachedController extends NutchController {++ public void nutchPerform(ComponentContext tileContext,+ HttpServletRequest request, HttpServletResponse response,+ ServletContext servletContext) throws ServletException, IOException {+ ServiceLocator locator = getServiceLocator(request);+ NutchBean bean = locator.getNutchBean();++ Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")), Integer+ .parseInt(request.getParameter("id")));+ HitDetails details = bean.getDetails(hit);+ Query query = Query.parse(request.getParameter("query"), locator+ .getConfiguration());++ request.setAttribute("explanation", bean.getExplanation(query, hit));+ request.setAttribute("hitDetails", details);+ logRequestAttributes(request);+ }+}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/ExplainController.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/ExplainController.javanew file mode 100644index 000000000..b95ba18fb--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/ExplainController.java@@ -0,0 +1,51 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.controller;++import java.io.IOException;++import javax.servlet.ServletContext;+import javax.servlet.ServletException;+import javax.servlet.http.HttpServletRequest;+import javax.servlet.http.HttpServletResponse;++import org.apache.nutch.searcher.Hit;+import org.apache.nutch.searcher.HitDetails;+import org.apache.nutch.searcher.NutchBean;+import org.apache.nutch.searcher.Query;+import org.apache.nutch.webapp.common.ServiceLocator;+import org.apache.struts.tiles.ComponentContext;++public class ExplainController extends NutchController {++ public void nutchPerform(ComponentContext tileContext,+ HttpServletRequest request, HttpServletResponse response,+ ServletContext servletContext) throws ServletException, IOException {++ ServiceLocator locator = getServiceLocator(request);+ NutchBean bean = locator.getNutchBean();++ Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")), Integer+ .parseInt(request.getParameter("id")));+ HitDetails details = bean.getDetails(hit);+ Query query = Query.parse(request.getParameter("query"), locator+ .getConfiguration());++ // put explanation and hitDetails into request so view can access them+ request.setAttribute("explanation", bean.getExplanation(query, hit));+ request.setAttribute("hitDetails", details.toHtml());+ }+}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/I18NPageController.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/I18NPageController.javanew file mode 100644index 000000000..f7aed09de--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/I18NPageController.java@@ -0,0 +1,172 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.controller;++import java.io.BufferedReader;+import java.io.IOException;+import java.io.InputStream;+import java.io.InputStreamReader;+import java.util.HashMap;+import java.util.Iterator;+import java.util.List;+import java.util.ArrayList;+import java.util.Locale;++import javax.servlet.ServletContext;+import javax.servlet.ServletException;+import javax.servlet.http.HttpServletRequest;+import javax.servlet.http.HttpServletResponse;++import org.apache.nutch.webapp.common.ServiceLocator;+import org.apache.struts.tiles.ComponentContext;++/**+ * This controller can be used in pages that require displaying of localized+ * content. In nutch this means help etc. pages.+ */+public class I18NPageController extends NutchController {++ protected HashMap cached = new HashMap();++ public void nutchPerform(ComponentContext tileContext,+ HttpServletRequest request, HttpServletResponse response,+ ServletContext servletContext) throws ServletException, IOException {++ ServiceLocator locator = getServiceLocator(request);++ // get base page from tiles context+ String baseName = (String) tileContext.getAttribute("basePage");++ // get arequest attribute name (where content will be put)+ // from tiles context+ String attrName = (String) tileContext.getAttribute("attrName");++ // if not available use default+ if (attrName == null)+ attrName = "content";++ // get users preferred locale+ Locale locale = locator.getLocale();++ // see if we have a cached content available+ StringBuffer content = (StringBuffer) cached.get(baseName + locale);++ // not available, try to read from file+ // XXX this prevents plugins to provide content+ if (content == null) {+ content = new StringBuffer();+ List postfixes = calculateSuffixes(locale);+ Iterator iterator = postfixes.iterator();++ while (iterator.hasNext()) {+ String postfix = (String) iterator.next();+ String name = concatPostfix(baseName, postfix);+ InputStream is = servletContext.getResourceAsStream(name);+ if (is != null) {+ BufferedReader br = new BufferedReader(new InputStreamReader(is));++ String line;+ while ((line = br.readLine()) != null) {+ content.append(line).append("\n");+ }+ br.close();+ is.close();+ break;+ }+ }++ // put in cache for faster retrieval later+ cached.put(baseName + locale, content);++ }+ request.setAttribute(attrName, content.toString());+ }++ /**+ * Calculate the suffixes based on the locale.+ *+ * @param locale+ * the locale+ *+ * This method is borrowed from I18NFactorySet.java wich is part of tiles+ * (struts)+ *+ */+ private List calculateSuffixes(Locale locale) {++ List suffixes = new ArrayList(3);+ String language = locale.getLanguage();+ String country = locale.getCountry();+ String variant = locale.getVariant();++ StringBuffer suffix = new StringBuffer();+ // suffix.append('_');+ suffix.append(language);+ if (language.length() > 0) {+ suffixes.add(suffix.toString());+ }++ suffix.append('_');+ suffix.append(country);+ if (country.length() > 0) {+ suffixes.add(suffix.toString());+ }++ suffix.append('_');+ suffix.append(variant);+ if (variant.length() > 0) {+ suffixes.add(suffix.toString());+ }++ return suffixes;++ }++ /**+ * Concat postfix to the name. Take care of existing filename extension.+ * Transform the given name "name.ext" to have "name" + "postfix" + "ext". If+ * there is no ext, return "name" + "postfix".+ *+ * @param name+ * Filename.+ * @param postfix+ * Postfix to add.+ * @return Concatenated filename.+ *+ * This method is borrowed from I18NFactorySet.java wich is part of tiles+ * (struts)+ */+ private String concatPostfix(String name, String postfix) {+ if (postfix == null) {+ return name;+ }++ return "/" + postfix + name;++ // Search file name extension.+ // take care of Unix files starting with .++ /*+ * int dotIndex = name.lastIndexOf("."); int lastNameStart =+ * name.lastIndexOf(java.io.File.pathSeparator); if (dotIndex < 1 ||+ * dotIndex < lastNameStart) { return name + postfix; }+ *+ * String ext = name.substring(dotIndex); name = name.substring(0,+ * dotIndex); return name + postfix + ext;+ */+ }++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/NutchController.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/NutchController.javanew file mode 100644index 000000000..92b99c9d6--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/NutchController.java@@ -0,0 +1,137 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.controller;++import java.io.IOException;+import java.util.Enumeration;+import java.util.Iterator;+import java.util.logging.Logger;++import javax.servlet.ServletContext;+import javax.servlet.ServletException;+import javax.servlet.http.HttpServletRequest;+import javax.servlet.http.HttpServletResponse;++import org.apache.hadoop.util.LogFormatter;+import org.apache.nutch.webapp.common.ServiceLocator;+import org.apache.nutch.webapp.common.WebappInstanceServiceLocator;+import org.apache.struts.Globals;+import org.apache.struts.tiles.ComponentContext;+import org.apache.struts.tiles.Controller;+import org.apache.struts.util.MessageResources;++public abstract class NutchController implements Controller {++ public static Logger LOG = LogFormatter.getLogger(NutchController.class+ .getName());++ public final void execute(ComponentContext tileContext,+ HttpServletRequest request, HttpServletResponse response,+ ServletContext servletContext) throws ServletException, IOException {++ request.setCharacterEncoding("UTF-8");++ // this is not possible in servlet 2.3+ // response.setCharacterEncoding("UTF-8");++ // catch all errors that might occur so we can properly log the stack trace+ long t = System.currentTimeMillis();+ try {+ nutchPerform(tileContext, request, response, servletContext);+ } catch (Exception e) {+ LOG.info("Exception occured while executing nutch controller:");+ e.printStackTrace(System.err);+ }+ LOG.info("request processing time: " + (System.currentTimeMillis() - t)+ + "ms");+ }++ /**+ * Nutch controllers overwrite this method+ *+ * @param tileContext+ * @param request+ * @param response+ * @param servletContext+ * @throws ServletException+ * @throws IOException+ */+ public abstract void nutchPerform(ComponentContext tileContext,+ HttpServletRequest request, HttpServletResponse response,+ ServletContext servletContext) throws ServletException, IOException;++ /**+ * Get Active service locator from request or create on if not exiting+ *+ * @param request+ * @return+ */+ protected ServiceLocator getServiceLocator(HttpServletRequest request) {+ return WebappInstanceServiceLocator.getFrom(request);+ }++ /**+ * Log request attributes. used for debugging+ *+ * @param request+ */+ void logRequestAttributes(HttpServletRequest request) {+ Enumeration e = request.getAttributeNames();++ while (e.hasMoreElements()) {+ String name = (String) e.nextElement();+ LOG.info("request attrs:" + name + " = " + request.getAttribute(name));+ }+ }++ /**+ * Log tiles context. used for debugging+ *+ * @param context+ */+ void logComponentContext(ComponentContext context) {+ Iterator i = context.getAttributeNames();++ while (i.hasNext()) {+ String name = (String) i.next();+ LOG.info("request attrs:" + name + " = " + context.getAttribute(name));+ }+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.struts.tiles.Controller#perform(org.apache.struts.tiles.ComponentContext,+ * javax.servlet.http.HttpServletRequest,+ * javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext)+ */+ public void perform(ComponentContext tileContext, HttpServletRequest request,+ HttpServletResponse response, ServletContext servletContext)+ throws ServletException, IOException {+ execute(tileContext, request, response, servletContext);+ }++ /**+ * Get struts MessageResources from request+ *+ * @param request+ * @return+ */+ public MessageResources getResources(HttpServletRequest request) {+ return ((MessageResources) request.getAttribute(Globals.MESSAGES_KEY));+ }++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/SearchController.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/SearchController.javanew file mode 100644index 000000000..0a636c731--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/SearchController.java@@ -0,0 +1,47 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.controller;++import java.io.IOException;++import javax.servlet.ServletContext;+import javax.servlet.ServletException;+import javax.servlet.http.HttpServletRequest;+import javax.servlet.http.HttpServletResponse;++import org.apache.nutch.searcher.NutchBean;+import org.apache.nutch.webapp.common.Search;+import org.apache.nutch.webapp.common.ServiceLocator;+import org.apache.struts.tiles.ComponentContext;++/* This is the main controller of nutch search application+ */+public class SearchController extends NutchController {++ public void nutchPerform(ComponentContext tileContext, HttpServletRequest request,+ HttpServletResponse response, ServletContext servletContext)+ throws ServletException, IOException {++ ServiceLocator locator=getServiceLocator(request);++ Search search=locator.getSearch();+ request.setAttribute("nutchSearch", search);+ NutchBean bean = locator.getNutchBean();++ search.performSearch(bean);+ request.setAttribute("resultInfo", search.getResultInfo());+ }+}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/PostSearchExtensionPoint.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/PostSearchExtensionPoint.javanew file mode 100644index 000000000..614bedae4--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/PostSearchExtensionPoint.java@@ -0,0 +1,30 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.extension;++import org.apache.nutch.webapp.common.SearchContext;++/**+ * Plugins extending this extension point are run after the actual+ * search+ */+public interface PostSearchExtensionPoint {++ public static final String X_POINT_ID=PostSearchExtensionPoint.class.getName();++ void doPostSearch(SearchContext context);++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/PreSearchExtensionPoint.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/PreSearchExtensionPoint.javanew file mode 100644index 000000000..9aeb8d613--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/PreSearchExtensionPoint.java@@ -0,0 +1,30 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.extension;++import org.apache.nutch.webapp.common.SearchContext;++/**+ * Plugins extending this extension point are run before the actual+ * search+ */+public interface PreSearchExtensionPoint {++ public static final String X_POINT_ID=PreSearchExtensionPoint.class.getName();++ void doPreSearch(SearchContext context);++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/SearchExtensionPoint.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/SearchExtensionPoint.javanew file mode 100644index 000000000..8573f88af--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/SearchExtensionPoint.java@@ -0,0 +1,31 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.extension;++import org.apache.nutch.webapp.common.SearchContext;++/**+ * Plugins extending this interface can provide logic that+ * is run in parallel with the nutch search.+ *+ */+public interface SearchExtensionPoint {++ public static final String X_POINT_ID=SearchExtensionPoint.class.getName();++ void doSearch(SearchContext context);++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/UIExtensionPoint.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/UIExtensionPoint.javanew file mode 100644index 000000000..a8602825a--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/extension/UIExtensionPoint.java@@ -0,0 +1,28 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.extension;++/**+ * Plugins implementing UIExtensionPoint can provide+ * extensions web ui in form of layout components+ * or ui logic+ */+public interface UIExtensionPoint {++ /** The name of the extension point. */+ final static String X_POINT_ID = UIExtensionPoint.class.getName();++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/servlet/CachedServlet.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/servlet/CachedServlet.javanew file mode 100644index 000000000..d5b333aa0--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/servlet/CachedServlet.java@@ -0,0 +1,104 @@+/**+ * Copyright 2005 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++package org.apache.nutch.webapp.servlet;++import org.apache.nutch.metadata.Metadata;+import org.apache.nutch.net.protocols.Response;+import org.apache.nutch.searcher.NutchBean;+import org.apache.nutch.searcher.Hit;+import org.apache.nutch.searcher.HitDetails;+import org.apache.nutch.webapp.common.ServiceLocator;+import org.apache.nutch.webapp.common.ServletContextServiceLocator;++import javax.servlet.ServletConfig;+import javax.servlet.http.HttpServlet;+import javax.servlet.http.HttpServletRequest;+import javax.servlet.http.HttpServletResponse;++import java.io.OutputStream;+import java.io.IOException;++/**+ * A servlet that serves raw Content of any mime type.+ *+ * If it fails with java.lang.OutOfMemoryError, you may have to increase heap+ * size when starting container, such as -Xms1024M -Xmx1024M+ *+ * @author John Xing+ */++public class CachedServlet extends HttpServlet {++ private static final long serialVersionUID = 1L;++ NutchBean bean = null;++ public void init(ServletConfig conf) {+ ServiceLocator locator = ServletContextServiceLocator.getInstance(conf+ .getServletContext());+ bean = locator.getNutchBean();+ }++ public void destroy() {+ // maybe clean bean?+ // nothing now+ }++ public void doGet(HttpServletRequest request, HttpServletResponse response)+ throws IOException {++ // quit if no bean+ if (bean == null)+ return;++ NutchBean.LOG.info("request from " + request.getRemoteAddr());++ Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")), Integer+ .parseInt(request.getParameter("id")));+ HitDetails details = bean.getDetails(hit);++ // raw bytes+ byte[] bytes = bean.getContent(details);++ // pass all original headers? only these for now.+ Metadata metadata = bean.getParseData(details).getContentMeta();+ String contentType = metadata.get(Response.CONTENT_TYPE);+ // String lastModified = metadata.get(Metadata.LAST_MODIFIED);+ // String contentLength = metadata.get(Metadata.CONTENT_LENGTH);+ // better use this, since it may have been truncated during fetch+ // or give warning if they don't match?+ int contentLength = bytes.length;++ // response+ response.setContentType(contentType);+ response.setContentLength(contentLength);++ OutputStream os = response.getOutputStream();+ os.write(bytes);+ // need this or flush more frequently?+ // os.flush();+ os.close();++ return;+ }++ public void doPost(HttpServletRequest request, HttpServletResponse response)+ throws IOException {+ doGet(request, response);+ }++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/servlet/OpenSearchServlet.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/servlet/OpenSearchServlet.javanew file mode 100644index 000000000..dd172b32a--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/servlet/OpenSearchServlet.java@@ -0,0 +1,275 @@+/**+ * Copyright 2005 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++package org.apache.nutch.webapp.servlet;++import java.io.IOException;+import java.net.URLEncoder;+import java.util.logging.Level;+import java.util.Map;+import java.util.HashMap;+import java.util.Set;+import java.util.HashSet;++import javax.servlet.ServletException;+import javax.servlet.ServletConfig;+import javax.servlet.http.HttpServlet;+import javax.servlet.http.HttpServletRequest;+import javax.servlet.http.HttpServletResponse;++import javax.xml.parsers.*;++import org.apache.hadoop.conf.Configuration;+import org.apache.nutch.searcher.Hit;+import org.apache.nutch.searcher.HitDetails;+import org.apache.nutch.searcher.Hits;+import org.apache.nutch.searcher.NutchBean;+import org.apache.nutch.searcher.Query;+import org.apache.nutch.webapp.common.ServiceLocator;+import org.apache.nutch.webapp.common.ServletContextServiceLocator;+import org.w3c.dom.*;+import javax.xml.transform.TransformerFactory;+import javax.xml.transform.Transformer;+import javax.xml.transform.dom.DOMSource;+import javax.xml.transform.stream.StreamResult;++/**+ * Present search results using A9's OpenSearch extensions to RSS, plus a few+ * Nutch-specific extensions.+ */+public class OpenSearchServlet extends HttpServlet {+ private static final long serialVersionUID = 1L;++ private static final Map NS_MAP = new HashMap();++ static {+ NS_MAP.put("opensearch", "http://a9.com/-/spec/opensearchrss/1.0/");+ NS_MAP.put("nutch", "http://www.nutch.org/opensearchrss/1.0/");+ }++ private static final Set SKIP_DETAILS = new HashSet();+ static {+ SKIP_DETAILS.add("url"); // redundant with RSS link+ SKIP_DETAILS.add("title"); // redundant with RSS title+ }++ private NutchBean bean;++ private Configuration conf;++ public void init(ServletConfig conf) {+ ServiceLocator locator = ServletContextServiceLocator.getInstance(conf+ .getServletContext());+ bean = locator.getNutchBean();+ }++ public void doGet(HttpServletRequest request, HttpServletResponse response)+ throws ServletException, IOException {++ NutchBean.LOG.info("query request from " + request.getRemoteAddr());++ // get parameters from request+ request.setCharacterEncoding("UTF-8");+ String queryString = request.getParameter("query");+ if (queryString == null)+ queryString = "";+ String urlQuery = URLEncoder.encode(queryString, "UTF-8");++ int start = 0; // first hit to display+ String startString = request.getParameter("start");+ if (startString != null)+ start = Integer.parseInt(startString);++ int hitsPerPage = 10; // number of hits to display+ String hitsString = request.getParameter("hitsPerPage");+ if (hitsString != null)+ hitsPerPage = Integer.parseInt(hitsString);++ String sort = request.getParameter("sort");+ boolean reverse = sort != null+ && "true".equals(request.getParameter("reverse"));++ // De-Duplicate handling. Look for duplicates field and for how many+ // duplicates per results to return. Default duplicates field is 'site'+ // and duplicates per results default is '2'.+ String dedupField = request.getParameter("dedupField");+ if (dedupField == null || dedupField.length() == 0) {+ dedupField = "site";+ }+ int hitsPerDup = 2;+ String hitsPerDupString = request.getParameter("hitsPerDup");+ if (hitsPerDupString != null && hitsPerDupString.length() > 0) {+ hitsPerDup = Integer.parseInt(hitsPerDupString);+ } else {+ // If 'hitsPerSite' present, use that value.+ String hitsPerSiteString = request.getParameter("hitsPerSite");+ if (hitsPerSiteString != null && hitsPerSiteString.length() > 0) {+ hitsPerDup = Integer.parseInt(hitsPerSiteString);+ }+ }++ // Make up query string for use later drawing the 'rss' logo.+ String params = "&hitsPerPage="+ + hitsPerPage+ + (sort == null ? "" : "&sort=" + sort+ + (reverse ? "&reverse=true" : "")+ + (dedupField == null ? "" : "&dedupField=" + dedupField));++ Query query = Query.parse(queryString, this.conf);+ NutchBean.LOG.info("query: " + queryString);++ // execute the query+ Hits hits;+ try {+ hits = bean.search(query, start + hitsPerPage, hitsPerDup, dedupField,+ sort, reverse);+ } catch (IOException e) {+ NutchBean.LOG.log(Level.WARNING, "Search Error", e);+ hits = new Hits(0, new Hit[0]);+ }++ NutchBean.LOG.info("total hits: " + hits.getTotal());++ // generate xml results+ int end = (int) Math.min(hits.getLength(), start + hitsPerPage);+ int length = end - start;++ Hit[] show = hits.getHits(start, end - start);+ HitDetails[] details = bean.getDetails(show);+ String[] summaries = bean.getSummary(details, query);++ String requestUrl = request.getRequestURL().toString();+ String base = requestUrl.substring(0, requestUrl.lastIndexOf('/'));++ try {+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();+ factory.setNamespaceAware(true);+ Document doc = factory.newDocumentBuilder().newDocument();++ Element rss = addNode(doc, doc, "rss");+ addAttribute(doc, rss, "version", "2.0");+ addAttribute(doc, rss, "xmlns:opensearch", (String) NS_MAP+ .get("opensearch"));+ addAttribute(doc, rss, "xmlns:nutch", (String) NS_MAP.get("nutch"));++ Element channel = addNode(doc, rss, "channel");++ addNode(doc, channel, "title", "Nutch: " + queryString);+ addNode(doc, channel, "description", "Nutch search results for query: "+ + queryString);+ addNode(doc, channel, "link", base + "/search.jsp" + "?query=" + urlQuery+ + "&start=" + start + "&hitsPerDup=" + hitsPerDup + params);++ addNode(doc, channel, "opensearch", "totalResults", "" + hits.getTotal());+ addNode(doc, channel, "opensearch", "startIndex", "" + start);+ addNode(doc, channel, "opensearch", "itemsPerPage", "" + hitsPerPage);++ addNode(doc, channel, "nutch", "query", queryString);++ if ((hits.totalIsExact() && end < hits.getTotal()) // more hits to show+ || (!hits.totalIsExact() && (hits.getLength() > start + hitsPerPage))) {+ addNode(doc, channel, "nutch", "nextPage", requestUrl + "?query="+ + urlQuery + "&start=" + end + "&hitsPerDup=" + hitsPerDup + params);+ }++ if ((!hits.totalIsExact() && (hits.getLength() <= start + hitsPerPage))) {+ addNode(doc, channel, "nutch", "showAllHits", requestUrl + "?query="+ + urlQuery + "&hitsPerDup=" + 0 + params);+ }++ for (int i = 0; i < length; i++) {+ Hit hit = show[i];+ HitDetails detail = details[i];+ String title = detail.getValue("title");+ String url = detail.getValue("url");+ String id = "idx=" + hit.getIndexNo() + "&id=" + hit.getIndexDocNo();++ if (title == null || title.equals("")) // use url for docs w/o title+ title = url;++ Element item = addNode(doc, channel, "item");++ addNode(doc, item, "title", title);+ addNode(doc, item, "description", summaries[i]);+ addNode(doc, item, "link", url);++ addNode(doc, item, "nutch", "site", hit.getDedupValue());++ addNode(doc, item, "nutch", "cache", base + "/cached.jsp?" + id);+ addNode(doc, item, "nutch", "explain", base + "/explain.jsp?" + id+ + "&query=" + urlQuery);++ if (hit.moreFromDupExcluded()) {+ addNode(doc, item, "nutch", "moreFromSite", requestUrl+ + "?query="+ + URLEncoder.encode("site:" + hit.getDedupValue() + " "+ + queryString, "UTF-8") + "&hitsPerSite=" + 0 + params);+ }++ for (int j = 0; j < detail.getLength(); j++) { // add all from detail+ String field = detail.getField(j);+ if (!SKIP_DETAILS.contains(field))+ addNode(doc, item, "nutch", field, detail.getValue(j));+ }+ }++ // dump DOM tree++ DOMSource source = new DOMSource(doc);+ TransformerFactory transFactory = TransformerFactory.newInstance();+ Transformer transformer = transFactory.newTransformer();+ transformer.setOutputProperty("indent", "yes");+ StreamResult result = new StreamResult(response.getOutputStream());+ response.setContentType("text/xml");+ transformer.transform(source, result);++ } catch (javax.xml.parsers.ParserConfigurationException e) {+ throw new ServletException(e);+ } catch (javax.xml.transform.TransformerException e) {+ throw new ServletException(e);+ }++ }++ private static Element addNode(Document doc, Node parent, String name) {+ Element child = doc.createElement(name);+ parent.appendChild(child);+ return child;+ }++ private static void addNode(Document doc, Node parent, String name,+ String text) {+ Element child = doc.createElement(name);+ child.appendChild(doc.createTextNode(text));+ parent.appendChild(child);+ }++ private static void addNode(Document doc, Node parent, String ns,+ String name, String text) {+ Element child = doc.createElementNS((String) NS_MAP.get(ns), ns + ":"+ + name);+ child.appendChild(doc.createTextNode(text));+ parent.appendChild(child);+ }++ private static void addAttribute(Document doc, Element node, String name,+ String value) {+ Attr attribute = doc.createAttribute(name);+ attribute.setValue(value);+ node.getAttributes().setNamedItem(attribute);+ }++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/tiles/ExtendableDefinitionsFactory.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/tiles/ExtendableDefinitionsFactory.javanew file mode 100644index 000000000..df3568d69--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/tiles/ExtendableDefinitionsFactory.java@@ -0,0 +1,257 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.tiles;++import java.io.IOException;+import java.io.InputStream;+import java.util.HashMap;+import java.util.Iterator;+import java.util.Map;+import java.util.logging.Logger;++import javax.servlet.ServletContext;+import javax.servlet.ServletRequest;++import org.apache.hadoop.conf.Configuration;+import org.apache.hadoop.util.LogFormatter;++import org.apache.nutch.plugin.Extension;+import org.apache.nutch.plugin.ExtensionPoint;+import org.apache.nutch.webapp.common.PluginResourceLoader;+import org.apache.nutch.webapp.common.ServletContextServiceLocator;+import org.apache.nutch.webapp.extension.UIExtensionPoint;+import org.apache.struts.tiles.ComponentDefinition;+import org.apache.struts.tiles.DefinitionsFactory;+import org.apache.struts.tiles.DefinitionsFactoryConfig;+import org.apache.struts.tiles.DefinitionsFactoryException;+import org.apache.struts.tiles.NoSuchDefinitionException;+import org.apache.struts.tiles.xmlDefinition.XmlDefinition;+import org.apache.struts.tiles.xmlDefinition.XmlDefinitionsSet;+import org.apache.struts.tiles.xmlDefinition.XmlParser;++import org.xml.sax.SAXException;++/**+ * Tiles DefinitionsFactory that can be extended by activated plugins+ */+public class ExtendableDefinitionsFactory implements DefinitionsFactory {++ private static final long serialVersionUID = 1L;++ public static Logger LOG = LogFormatter+ .getLogger(ExtendableDefinitionsFactory.class.getName());++ DefinitionsFactoryConfig config;++ protected transient XmlParser xmlParser = new XmlParser();++ Map definitions;++ private ServletContext servletContext;++ HashMap locales = new HashMap();++ /*+ * (non-Javadoc)+ *+ * @see org.apache.struts.tiles.DefinitionsFactory#getDefinition(java.lang.String,+ * javax.servlet.ServletRequest, javax.servlet.ServletContext)+ */+ public ComponentDefinition getDefinition(String name, ServletRequest request,+ ServletContext servletContext) throws NoSuchDefinitionException,+ DefinitionsFactoryException {+ return (ComponentDefinition) definitions.get(name);+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.struts.tiles.xmlDefinition.DefinitionsFactory#putDefinition(org.apache.struts.tiles.ComponentDefinition)+ */+ public void putDefinition(ComponentDefinition definition) {+ LOG.info("putting definition:" + definition.getName());+ definitions.put(definition.getName(), definition);+ try {+ definition.getOrCreateController();+ } catch (Exception e) {+ e.printStackTrace(System.out);+ }+ LOG.fine("Restoring ClassLoader.");++ }++ protected XmlDefinitionsSet getDefinitions() {++ XmlDefinitionsSet definitions = new XmlDefinitionsSet();+ //+ // global definitions+ //+ String configFiles = config.getDefinitionConfigFiles();+ LOG.info("config files:" + configFiles);+ String[] files = configFiles.split(",");+ for (int i = 0; i < files.length; i++) {+ LOG.info("Trying to load " + files[i]);+ InputStream input = servletContext.getResourceAsStream(files[i]);++ if (input != null) {+ parseXMLDefinitionSet(input, definitions, files[i]);+ } else {+ LOG.info("Cannot find static " + files[i]);+ }+ }++ //+ // plugged implementations can override defaults if they wish+ //+ ExtensionPoint point = ServletContextServiceLocator.getInstance(+ servletContext).getPluginRepository().getExtensionPoint(+ UIExtensionPoint.X_POINT_ID);++ if (point != null) {++ Extension[] extensions = point.getExtensions();++ LOG.info("There are " + extensions.length+ + " extensions available for UI");++ for (int i = 0; i < extensions.length; i++) {+ LOG.info("Adding definitions from "+ + extensions[i].getDescriptor().getName());+ Extension extension = extensions[i];+ addToSet(definitions, extension);+ }+ } else {+ LOG.info("Cannot find extension point '" + UIExtensionPoint.X_POINT_ID + "'");+ }++ try {+ definitions.resolveInheritances();+ } catch (NoSuchDefinitionException e) {+ LOG.info("Error resolving:" + e);+ }+ return definitions;+ }++ protected void addToSet(XmlDefinitionsSet definitions, Extension extension) {++ InputStream is = extension.getDescriptor().getClassLoader()+ .getResourceAsStream("tiles-defs.xml");+ if (is == null) {+ LOG.info("Plugin " + extension.getId()+ + " did not contain tiles-defs.xml");+ return;+ }+ parseXMLDefinitionSet(is, definitions, "Plugin " + extension.getId()+ + " : tiles-defs.xml");+ try {+ is.close();+ } catch (Exception e) {+ e.printStackTrace(System.out);+ }+ }++ protected void parseXMLDefinitionSet(InputStream input,+ XmlDefinitionsSet definitions, String info) {+ try {+ xmlParser.parse(input, definitions);+ } catch (IOException e) {+ LOG.info("IOException (" + e.getMessage() + ") parsing definitions "+ + info);+ e.printStackTrace();+ } catch (SAXException e) {+ LOG.info("SAXException (" + e.getMessage() + ") parsing definitions "+ + info);+ e.printStackTrace();+ }++ LOG.info("Definitions:" + definitions.getDefinitions().size() + " : "+ + definitions.toString());+ }++ protected Configuration getNutchConfig(ServletContext context) {+ return ServletContextServiceLocator.getInstance(context).getConfiguration();+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.struts.tiles.DefinitionsFactory#init(org.apache.struts.tiles.DefinitionsFactoryConfig,+ * javax.servlet.ServletContext)+ */+ public void init(DefinitionsFactoryConfig config,+ ServletContext servletContext) throws DefinitionsFactoryException {+ this.config = config;++ this.servletContext = servletContext;++ xmlParser.setValidating(config.getParserValidate());+ XmlDefinitionsSet definitions = getDefinitions();+ ClassLoader current = Thread.currentThread().getContextClassLoader();++ PluginResourceLoader loader = ServletContextServiceLocator.getInstance(+ servletContext).getPluginResourceLoader(current);++ //TODO: fix this!!!+ Thread.currentThread().setContextClassLoader(loader);+ initDefinitions(definitions);+ Thread.currentThread().setContextClassLoader(current);++ this.definitions = definitions.getDefinitions();++ }++ private void initDefinitions(XmlDefinitionsSet definitions) {+ Iterator i = definitions.getDefinitions().keySet().iterator();++ while (i.hasNext()) {+ String key = (String) i.next();+ LOG.fine("Initializing controller: " + key);+ XmlDefinition d = definitions.getDefinition(key);+ try {+ d.getOrCreateController();+ } catch (Exception e) {+ e.printStackTrace(System.out);+ }+ }+ LOG.fine("Restoring ClassLoader.");+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.struts.tiles.DefinitionsFactory#destroy()+ */+ public void destroy() {+ LOG.info("destroy()");+ }++ /*+ * (non-Javadoc)+ *+ * @see org.apache.struts.tiles.DefinitionsFactory#setConfig(org.apache.struts.tiles.DefinitionsFactoryConfig,+ * javax.servlet.ServletContext)+ */+ public void setConfig(DefinitionsFactoryConfig config,+ ServletContext servletContext) throws DefinitionsFactoryException {+ this.config = config;+ this.servletContext = servletContext;+ }++ public DefinitionsFactoryConfig getConfig() {+ return config;+ }++}diff --git a/contrib/web2/src/main/java/org/apache/nutch/webapp/tiles/NutchRequestProcessor.java b/contrib/web2/src/main/java/org/apache/nutch/webapp/tiles/NutchRequestProcessor.javanew file mode 100644index 000000000..ccc2bf28e--- /dev/null+++ b/contrib/web2/src/main/java/org/apache/nutch/webapp/tiles/NutchRequestProcessor.java@@ -0,0 +1,44 @@+/*+ * Copyright 2006 The Apache Software Foundation+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.apache.nutch.webapp.tiles;++import javax.servlet.http.HttpServletRequest;+import javax.servlet.http.HttpServletResponse;++import org.apache.nutch.webapp.common.ServiceLocator;+import org.apache.nutch.webapp.common.WebappInstanceServiceLocator;+import org.apache.struts.Globals;+import org.apache.struts.tiles.TilesRequestProcessor;++public class NutchRequestProcessor extends TilesRequestProcessor {+++ /**+ * Process locale, override the default functionality and prevent+ * session from being created.+ */+ protected void processLocale(HttpServletRequest request,+ HttpServletResponse response) {++ ServiceLocator locator=WebappInstanceServiceLocator.getFrom(request);++ if(locator==null) {+ locator=new WebappInstanceServiceLocator(request, getServletContext());+ }++ request.setAttribute(Globals.LOCALE_KEY, locator.getLocale());+ }+}diff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources.propertiesnew file mode 100644index 000000000..86c768c06--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources.properties@@ -0,0 +1,60 @@+#This is the default resource file for nutch ui localization.+#If you create a new localized version of resources, please use+#this as the base++#language code used in html lang attribute+lang=en++#anchors page title+anchors.title=anchors+anchors.anchors=incoming anchor text:+anchors.page=page: <a href="{0}">{0}</a>++#cached page title+cached.title=nutch cache+cached.page=page: <a href="{0}">{0}</a>+cached.noContent=Sorry, no content is cached for this page.++#explain page title+explain.title=score explanation+explain.page=page+explain.scoreForQuery=score for query: <tt>{0}</tt>++#search page title+search.title=search results++#text in search button+search.search=Search++#text wich describes the search results (nn-nn out of nn)+search.hits=Results <b>{0}-{1}</b> of about <b>{2}</b> total matching pages for <b>{3}</b>.++#text displayed when there are no reults+search.noResults=Your search - <b>{0}</b> - did not match any documents.++#cached page link text+search.cached=cached++#explain page link text+search.explain=explain++#anchors page link text+search.anchors=anchors++#text in "next page" button+search.next=next page++#link text of+search.moreFrom=more from+search.showAllHits=show all hits++search.clustering=clustering+search.viewAsText=View as Plain Text++#search help link text+search.help=help++#view as text page title+text.title=plain text cache+text.note=This is the plain text version of the file: <a href="{0}">{0}</a>.+text.noText=<i>Sorry, no plain text version is available.</i>\ No newline at end of filediff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_ca.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_ca.propertiesnew file mode 100644index 000000000..c9ff450d6--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_ca.properties@@ -0,0 +1,9 @@+search.title = resultats de cerca+search.search = Cerca+search.hits = Coincid�ncies <b>{0}-{1}</b> (d'un total de {2} documents coincidents):+search.cached = en mem�ria+search.explain = explicaci�+search.anchors = �ncores+search.next = Seg�ent+search.clustering = clustering+search.viewAsText = View as Plain Textdiff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_de.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_de.propertiesnew file mode 100644index 000000000..ba00b28dd--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_de.properties@@ -0,0 +1,24 @@+lang=de+anchors.title = Verweise+anchors.anchors = Herzeigende Link-Texte:+anchors.page = Seite: <a href="{0}">{0}</a>+cached.title = Nutch Cache+cached.page = Seite: <a href="{0}">{0}</a>+cached.noContent = <i>Leider ist diese Seite nicht im Cache gespeichert.</i>+explain.title = Seiteninformationen & Rankingberechnung+explain.page = Gespeicherte Seiteninformationen+explain.scoreForQuery = Rankingberechnung für die Anfrage: <tt>{0}</tt>+search.title = Suchergebnisse+search.search = Suche+search.hits = Treffer <b>{0}-{1}</b> (von insgesammt {2} gefundenen Seiten):+search.cached = Im Cache+search.explain = Erklärung+search.anchors = Referenzen+search.next = Weiter+search.clustering = Clustern+search.viewAsText = HTML-Version+search.moreFrom = Mehr von+search.showAllHits = Alle Treffer anzeigen+text.title = Nutch Text Cache+text.note = Dies ist die Text-Version von: <a href="{0}">{0}</a>.+text.noText = <i>Leider ist keine Text-Version verfügbar.</i>diff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_es.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_es.propertiesnew file mode 100644index 000000000..c2b1d1d24--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_es.properties@@ -0,0 +1,10 @@+lang=es+search.title = resultados de la búsqueda+search.search = Buscar+search.hits = Resultados <b>{0}-{1}</b> (de un total de {2} documentos):+search.cached = en caché+search.explain = explicar+search.anchors = anchors+search.next = Siguiente+search.clustering = clustering+search.viewAsText = View as Plain Text\ No newline at end of filediff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_fi.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_fi.propertiesnew file mode 100644index 000000000..b21d05a0b--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_fi.properties@@ -0,0 +1,25 @@+lang=fi+anchors.title=linkit+anchors.anchors=sivulle johtavien linkkien tekstit:+anchors.page=sivu: <a href="{0}">{0}</a>+cached.title=v\u00E4limuisti+cached.page=sivu: <a href="{0}">{0}</a>+cached.noContent=<i>Sivua ei l�ydy v\u00E4limuistista.</i>+explain.title=pisteytyksen perusteet+explain.page=sivu+explain.scoreForQuery=pisteytys haulle: <tt>{0}</tt>+search.title=Hakutulokset+search.search=Hae+search.hits=Tulokset <b>{0}-{1}</b> (kaikkiaan {2} sopivasta dokumentista):+search.cached=v\u00E4limuistissa+search.explain=selit\u00E4+search.anchors=linkit+search.next=Seuraava+search.help=apua+search.clustering=ryv\u00e4stys+search.moreFrom=lis\u00e4\u00e4 osumia kohteesta+search.showAllHits=n\u00e4yt\u00e4 kaikki osumat+search.viewAsText=N\u00e4yt\u00e4 sivun tekstiversio+text.title=v\u00E4limuistin tekstiversio+text.note=T�m� on sivun <a href="{0}">{0}</a> v\u00E4limuistin tekstiversio.+text.noText=<i>Sivusta ei ole saatavilla tekstiversiota.</i>diff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_fr.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_fr.propertiesnew file mode 100644index 000000000..249cf1bf1--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_fr.properties@@ -0,0 +1,10 @@+lang=fr+search.title = R�sultats de recherche+search.search = Recherche+search.hits = R�sultats <b>{0}-{1}</b> (sur un total de {2}):+search.cached = En cache+search.explain = Explications+search.anchors = Ancres+search.next = Suivant+search.clustering = clustering+search.viewAsText = View as Plain Textdiff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_hu.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_hu.propertiesnew file mode 100644index 000000000..ce5668930--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_hu.properties@@ -0,0 +1,10 @@+lang=hu+search.title = keres�s eredm�nye+search.search = Keres�s+search.hits = <b>{0}-{1}</b>. tal�lat a {2} k�z�l:+search.cached = T�rolt+search.explain = Magyar�zat+search.anchors = Kapcsol�d�s+search.next = K�vetkez�+search.clustering = clustering+search.viewAsText = View as Plain Textdiff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_ms.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_ms.propertiesnew file mode 100644index 000000000..4d1339afe--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_ms.properties@@ -0,0 +1,10 @@+lang=ms+search.title = hasil carian+search.carian = Carian+search.bilangan hits = Bilangan Hits <b>{0}-{1}</b> (daripada {2} jumlah dokumen bersesuaian):+search.tampungan = tampungan+search.penerangan = penerangan+search.penunjuk = penunjuk+search.selepas = Selepas+search.clustering = clustering+search.viewAsText = View as Plain Textdiff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_nl.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_nl.propertiesnew file mode 100644index 000000000..16b7b3e20--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_nl.properties@@ -0,0 +1,10 @@+lang=nl+search.title = zoekresultaten+search.search = Zoek+search.hits = Treffers <b>{0}-{1}</b> (van in totaal {2} gevonden documenten):+search.cached = opgeslagen+search.explain = uitleg+search.anchors = verwijzers+search.next = Volgende+search.clustering = clustering+search.viewAsText = View as Plain Textdiff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_pl.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_pl.propertiesnew file mode 100644index 000000000..56c0e43da--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_pl.properties@@ -0,0 +1,21 @@+lang=pl+anchors.title = odno\u015bniki+anchors.anchors = tekst przychodz\u0105cego odno\u015bnika:+anchors.page = strona: <a href="{0}">{0}</a>+cached.title = kopia nutch-a+cached.page = strona: <a href="{0}">{0}</a>+cached.noContent = <i>Przepraszamy, brak kopii tej strony.</i>+explain.title = wyja\u015bnienie wyniku+explain.page = strona+explain.scoreForQuery = wynik dla zapytania: <tt>{0}</tt>+search.title = wyniki wyszukiwania+search.search = Szukaj+search.hits = Wyniki <b>{0}-{1}</b> (z oko\u0142o {2} pasuj\u0105cych dokument\u00f3w):+search.cached = kopia+search.explain = wyja\u015bnij+search.anchors = odno\u015bniki+search.next = Nast\u0119pna strona+search.moreFrom = Wi\u0119cej z+search.showAllHits = Poka\u017c wszystkie wyniki+search.clustering = grupowanie+search.viewAsText = View as Plain Textdiff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_pt.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_pt.propertiesnew file mode 100644index 000000000..5e221b5ce--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_pt.properties@@ -0,0 +1,10 @@+lang=pt+search.title = resultados da pesquisa+search.search = Localizar+search.hits = Resultados <b>{0}-{1}</b> (de um total de {2} documentos):+search.cached = arquivado+search.explain = explica��o+search.anchors = semelhantes+search.next = Pr�ximo+search.clustering = clustering+search.viewAsText = View as Plain Textdiff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_sh.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_sh.propertiesnew file mode 100644index 000000000..9eb2618ba--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_sh.properties@@ -0,0 +1,13 @@+lang=sh+search.title = rezulati pretra\u017eivanja+search.help = pomo\u0107+search.search = Pretra\u017ei+search.hits = Rezultati <b>{0}-{1}</b> (od oko {2} ukupno prona\u0111enih dokumenata):+search.cached = ke\u0161irano+search.explain = objasni+search.anchors = veze+search.next = slede\u0107a stranica+search.moreFrom = ostali rezultati sa+search.showAllHits = prika\u017ei sve rezultate+search.clustering = clustering+search.viewAsText = Prika\u017ei samo tekstdiff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_sr.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_sr.propertiesnew file mode 100644index 000000000..eb0cddf29--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_sr.properties@@ -0,0 +1,14 @@+lang=sr+search.title = \u0440\u0435\u0437\u0443\u043B\u0430\u0442\u0438 \u043F\u0440\u0435\u0442\u0440\u0430\u0436\u0438\u0432\u0430\u045A\u0430+search.help = \u043F\u043E\u043C\u043E\u045B+search.search = \u041F\u0440\u0435\u0442\u0440\u0430\u0436\u0438+search.hits = \u0420\u0435\u0437\u0443\u043B\u0442\u0430\u0442\u0438 <b>{0}-{1}</b> (\u043E\u0434 \u043E\u043A\u043E {2} \u0443\u043A\u0443\u043F\u043D\u043E \u043F\u0440\u043E\u043D\u0430\u0452\u0435\u043D\u0438\u0445 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0430\u0442\u0430):+search.cached = \u043A\u0435\u0448\u0438\u0440\u0430\u043D\u043E+search.explain = \u043E\u0431\u0458\u0430\u0441\u043D\u0438+search.anchors = \u0432\u0435\u0437\u0435+search.next = \u0441\u043B\u0435\u0434\u0435\u045B\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430+search.moreFrom = \u043E\u0441\u0442\u0430\u043B\u0438 \u0440\u0435\u0437\u0443\u043B\u0442\u0430\u0442\u0438 \u0441\u0430+search.showAllHits = \u043F\u0440\u0438\u043A\u0430\u0436\u0438 \u0441\u0432\u0435 \u0440\u0435\u0437\u0443\u043B\u0442\u0430\u0442\u0435+search.clustering = clustering+search.viewAsText = \u041F\u0440\u0438\u043A\u0430\u0436\u0438 \u0441\u0430\u043C\u043E \u0442\u0435\u043A\u0441\u0442+diff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_sv.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_sv.propertiesnew file mode 100644index 000000000..1e86b42eb--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_sv.properties@@ -0,0 +1,12 @@+lang=sv+search.title = s�kresultat+search.search = S�k+search.hits = Tr�ffar <b>{0}-{1}</b> (av ungef�r totalt {2} matchande sidor):+search.cached = cashad+search.explain = f�rklara+search.anchors = ankare+search.next = n�sta sida+search.moreFrom = mer fr�n+search.showAllHits = visa alla tr�ffar+search.clustering = klustring+search.viewAsText = View as Plain Text\ No newline at end of filediff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_th.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_th.propertiesnew file mode 100644index 000000000..3599dd802--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_th.properties@@ -0,0 +1,10 @@+lang=th+search.title = \u0e1c\u0e25\u0e01\u0e32\u0e23\u0e04\u0e49\u0e19\u0e2b\u0e32+search.search = \u0e04\u0e49\u0e19\u0e2b\u0e32+search.hits = \u0e1e\u0e1a <b>{0}-{1}</b> (\u0e08\u0e32\u0e01\u0e17\u0e31\u0e49\u0e07\u0e2b\u0e21\u0e14 {2} \u0e2b\u0e19\u0e49\u0e32):+search.cached = \u0e2b\u0e19\u0e49\u0e32\u0e17\u0e35\u0e48\u0e40\u0e01\u0e47\u0e1a\u0e44\u0e27\u0e49+search.explain = \u0e04\u0e33\u0e2d\u0e18\u0e34\u0e1a\u0e32\u0e22+search.anchors = \u0e41\u0e2d\u0e07\u0e40\u0e04\u0e2d\u0e23\u0e4c+search.next = \u0e2b\u0e19\u0e49\u0e32\u0e15\u0e48\u0e2d\u0e44\u0e1b+search.clustering = clustering+search.viewAsText = View as Plain Textdiff --git a/contrib/web2/src/main/resources/org/nutch/jsp/resources_zh.properties b/contrib/web2/src/main/resources/org/nutch/jsp/resources_zh.propertiesnew file mode 100644index 000000000..481c1a4cf--- /dev/null+++ b/contrib/web2/src/main/resources/org/nutch/jsp/resources_zh.properties@@ -0,0 +1,10 @@+lang=zh+search.title = \u67e5\u8be2\u7ed3\u679c+search.search = \u641c\u7d22+search.hits = \u7b2c<b>{0}-{1}</b>\u9879 (\u5171\u6709 {2} \u9879\u67e5\u8be2\u7ed3\u679c):+search.cached = \u7f51\u9875\u5feb\u7167+search.explain = \u8bc4\u5206\u8be6\u89e3+search.anchors = anchors+search.next = \u4e0b\u4e00\u9875+search.clustering = clustering+search.viewAsText = View as Plain Textdiff --git a/contrib/web2/src/main/webapp/WEB-INF/dtd/struts-config_1_2.dtd b/contrib/web2/src/main/webapp/WEB-INF/dtd/struts-config_1_2.dtdnew file mode 100644index 000000000..eb47d74d9--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/dtd/struts-config_1_2.dtd@@ -0,0 +1,686 @@+<!--+ DTD for the Struts Application Configuration File++ To support validation of your configuration file, include the following+ DOCTYPE element at the beginning (after the "xml" declaration):++ <!DOCTYPE struts-config PUBLIC+ "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"+ "http://struts.apache.org/dtds/struts-config_1_2.dtd">++ $Id: struts-config_1_2.dtd 55025 2004-10-18 17:40:29Z craigmcc $+-->+++<!-- ========== Defined Types ============================================= -->+++<!-- An "AttributeName" is the identifier of a page, request, session, or+ application scope attribute.+-->+<!ENTITY % AttributeName "CDATA">+++<!-- A "BeanName" is the identifier of a JavaBean, such as a form bean,+ and also serves as the name of the corresponding scripting variable+ and the name of the JSP attribute under which the bean is accessed.+ Therefore, it must conform to the rules for a Java identifier.+-->+<!ENTITY % BeanName "CDATA">+++<!-- A "Boolean" is the string representation of a boolean (true or false)+ variable.+-->+<!ENTITY % Boolean "(true|false|yes|no)">+++<!-- A "ClassName" is the fully qualified name of a Java class that is+ instantiated to provide the functionality of the enclosing element.+-->+<!ENTITY % ClassName "CDATA">+++<!-- An "Integer" is a character string consisting solely of numeric digits,+ optionally preceeded by a minus sign, that can be converted to a+ 32-bit integer.+-->+<!ENTITY % Integer "CDATA">+++<!-- A "Location" is a relative path, delimited by "/" characters, that+ defines the location of a resource relative to the location of the+ Struts configuration file itself.+-->+<!ENTITY % Location "#PCDATA">+++<!-- A "PropName" is the name of a JavaBeans property, and must begin with+ a lower case letter and contain only characters that are legal in a+ Java identifier.+-->+<!ENTITY % PropName "CDATA">+++<!-- A "RequestPath" is an module-relative URI path, beginning with a+ slash, that identifies a mapped resource (such as a JSP page or a servlet)+ within this web application.+-->+<!ENTITY % RequestPath "CDATA">+++<!-- The name of a JSP bean scope within which such a form bean may be+ accessed.+-->+<!ENTITY % RequestScope "(request|session)">+++<!-- ========== Top Level Elements ======================================== -->+++<!-- The "struts-config" element is the root of the configuration file+ hierarchy, and contains nested elements for all of the other+ configuration settings.+-->+<!ELEMENT struts-config (display-name?, description?, data-sources?, form-beans?, global-exceptions?, global-forwards?, action-mappings?, controller?, message-resources*, plug-in*)>+<!ATTLIST struts-config id ID #IMPLIED>+++<!-- The "data-sources" element describes a set of DataSource objects [JDBC 2.0+ Standard Extension]. The individual DataSource objects are configured through+ nested <data-source> elements.+-->+<!ELEMENT data-sources (data-source*)>+<!ATTLIST data-sources id ID #IMPLIED>+++<!-- The "data-source" element describes a DataSource object [JDBC 2.0 Standard+ Extension] that will be instantiated, configured, and made available as a+ servlet context attribute (or "application-scope bean"). Any object can be+ specified so long as it implements [javax.sql.DataSource] and can be+ configured entirely from JavaBean properties. The following attributes+ are required:++ className The configuration bean for this DataSource object. If+ specified, the object must be a subclass of the default+ configuration bean.+ ["org.apache.struts.config.DataSourceConfig"]++ key Servlet context attribute key under which this data source+ will be stored. Default is the value specified by string+ constant defined by Globals.DATA_SOURCE_KEY. The application+ module prefix (if any) is appended to the key+ (${key}$prefix}).+ [org.apache.struts.Globals.DATA_SOURCE_KEY]++ NOTE: The application module prefix includes the leading+ slash, so the default datasource for a module named "foo" is+ stored under "org.apache.struts.action.DATA_SOURCE/foo".++ type Fully qualified Java class name for this data source object.+ The class must implement DataSource [javax.sql.DataSource],+ and the object must be configurable entirely from JavaBean+ properties.+-->+<!ELEMENT data-source (set-property*)>+<!ATTLIST data-source id ID #IMPLIED>+<!ATTLIST data-source className %ClassName; #IMPLIED>+<!ATTLIST data-source key %AttributeName; #IMPLIED>+<!ATTLIST data-source type %ClassName; #REQUIRED>+++<!-- The "form-beans" element describes the set of form bean descriptors for this+ module. The following attributes are defined:++ type Fully qualified Java class to use when instantiating+ ActionFormBean objects. If specified, the object must be a+ subclass of the default class type.++ WARNING: For Struts 1.0, this value is ignored. You+ can set the default implementation class name with the+ "formBean" initialization parameter to the Struts+ controller servlet.+-->+<!ELEMENT form-beans (form-bean*)>+<!ATTLIST form-beans id ID #IMPLIED>+<!ATTLIST form-beans type %ClassName; #IMPLIED>+++<!-- The "form-bean" element describes an ActionForm subclass+ [org.apache.struts.action.ActionForm] that can be referenced by an "action"+ element.+++The "form-bean" element describes a particular form bean, which is a+ JavaBean that implements the org.apache.struts.action.ActionForm+ class. The following attributes are defined:++ className The configuration bean for this form bean object. If+ specified, the object must be a subclass of the default+ configuration bean.+ ["org.apache.struts.config.FormBeanConfig"]++ name The unique identifier for this form bean. Referenced by the+ <action> element to specify which form bean to use with its+ request.++ type Fully qualified Java class name of the ActionForm subclass+ to use with this form bean.+-->+<!ELEMENT form-bean (icon?, display-name?, description?, set-property*, form-property*)>+<!ATTLIST form-bean id ID #IMPLIED>+<!ATTLIST form-bean className %ClassName; #IMPLIED>+<!ATTLIST form-bean dynamic %Boolean; #IMPLIED>+<!ATTLIST form-bean name %BeanName; #REQUIRED>+<!ATTLIST form-bean type %ClassName; #REQUIRED>+++<!-- The "form-property" element describes a JavaBean property that can be used to+ configure an instance of a DynaActionForm or a subclass thereof. This element+ is only utilized when the "type" attribute of the enclosing "form-bean" element+ is [org.apache.struts.action.DynaActionForm] or a subclass of DynaActionForm. If+ a custom DynaActionForm subclass is used, then the "dynamic" attribute of the+ enclosing <form-bean> element must be set to "true". Since Struts 1.1.++ className The configuration bean for this form property object. If+ specified, the object must be a subclass of the default+ configuration bean.+ ["org.apache.struts.config.FormPropertyConfig"]++ initial String representation of the initial value for this property.+ If not specified, primitives will be initialized to zero and+ objects initialized to the zero-argument instantiation of that+ object class. For example, Strings will be initialized to ""+++ name The name of the JavaBean property described by this element.++ size The number of array elements to create if the value of the+ "type" attribute specifies an array, but there is no value+ specified for the "initial" attribute.++ type Fully qualified Java class name of the field underlying this+ property, optionally followed by "[]" to indicate that the+ field is indexed.+-->+<!ELEMENT form-property (set-property*)>+<!ATTLIST form-property className %ClassName; #IMPLIED>+<!ATTLIST form-property initial CDATA #IMPLIED>+<!ATTLIST form-property name %PropName; #REQUIRED>+<!ATTLIST form-property size %Integer; #IMPLIED>+<!ATTLIST form-property type %ClassName; #REQUIRED>+++<!-- The "global-exceptions" element describes a set of exceptions that might be+ thrown by an Action object. The handling of individual exception types is+ configured through nested exception elements. An <action> element may+ override a global exception handler by registering a local exception handler+ for the same exception type. Since Struts 1.1.+-->+<!ELEMENT global-exceptions (exception*)>+<!ATTLIST global-exceptions id ID #IMPLIED>+++<!-- The "exception" element registers an ExceptionHandler for an exception type.+ The following attributes are defined:++ bundle Servlet context attribute for the message resources bundle+ associated with this handler. The default attribute is the+ value specified by the string constant declared at+ Globals.MESSAGES_KEY.+ [org.apache.struts.Globals.MESSAGES_KEY]++ className The configuration bean for this ExceptionHandler object.+ If specified, className must be a subclass of the default+ configuration bean+ ["org.apache.struts.config.ExceptionConfig"]++ handler Fully qualified Java class name for this exception handler.+ ["org.apache.struts.action.ExceptionHandler"]++ key The key to use with this handler's message resource bundle+ that will retrieve the error message template for this+ exception.++ path The module-relative URI to the resource that will complete+ the request/response if this exception occurs.++ scope The context ("request" or "session") that is used to access+ the ActionError object [org.apache.struts.action.ActionError]+ for this exception.++ type Fully qualified Java class name of the exception type to+ register with this handler.+-->+<!ELEMENT exception (icon?, display-name?, description?, set-property*)>+<!ATTLIST exception id ID #IMPLIED>+<!ATTLIST exception bundle %AttributeName; #IMPLIED>+<!ATTLIST exception className %ClassName; #IMPLIED>+<!ATTLIST exception handler %ClassName; #IMPLIED>+<!ATTLIST exception key CDATA #REQUIRED>+<!ATTLIST exception path %RequestPath; #IMPLIED>+<!ATTLIST exception scope CDATA #IMPLIED>+<!ATTLIST exception type %ClassName; #REQUIRED>+++<!-- The "global-forwards" element describes a set of ActionForward objects+ [org.apache.struts.action.ActionForward] that are available to all Action+ objects as a return value. The individual ActionForwards are configured+ through nested <forward> elements. An <action> element may override a global+ forward by defining a local <forward> of the same name.++ type Fully qualified Java class to use when instantiating+ ActionForward objects. If specified, the object must be a+ subclass of the default class type.++ WARNING: For Struts 1.0, this value is ignored. You+ can set the default implementation class name with the+ "forward" initialization parameter to the Struts+ controller servlet.+-->+<!ELEMENT global-forwards (forward*)>+<!ATTLIST global-forwards id ID #IMPLIED>+<!ATTLIST global-forwards type %ClassName; #IMPLIED>+++<!-- The "forward" element describes an ActionForward that is to be made+ available to an Action as a return value. An ActionForward is referenced by+ a logical name and encapsulates a URI. A "forward" element may be used to+ describe both global and local ActionForwards. Global forwards are available+ to all the Action objects in the module. Local forwards can be+ nested within an <action> element and only available to an Action object+ when it is invoked through that ActionMapping.++ className Fully qualified Java class name of ActionForward+ subclass to use for this object.+ ["org.apache.struts.action.ActionForward"]++ contextRelative Set this to "true" if, in a modular application, the path+ attribute starts with a slash "/" and should be considered+ relative to the entire web application rather than the module.+ Since Struts 1.1.+ DEPRECATED.+ [false]++ module The module prefix to use with this path. This value should+ begin with a slash ("/").++ name The unique identifier for this forward. Referenced by the+ Action object at runtime to select - by its logical name -+ the resource that should complete the request/response.++ path The module-relative or context-relative path to the resources+ that is encapsulated by the logical name of this ActionForward.+ If the path is to be considered context-relative when used in+ a modular application, then the contextRelative attribute+ should be set to "true". This value should begin with a slash+ ("/") character.++ redirect Set to "true" if a redirect instruction should be issued to+ the user-agent so that a new request is issued for this+ forward's resource. If true, RequestDispatcher.Redirect is+ called. If "false", RequestDispatcher.forward is called instead.+ [false]+-->+<!ELEMENT forward (icon?, display-name?, description?, set-property*)>+<!ATTLIST forward id ID #IMPLIED>+<!ATTLIST forward className %ClassName; #IMPLIED>+<!ATTLIST forward contextRelative %Boolean; #IMPLIED>+<!ATTLIST forward module %RequestPath; #IMPLIED>+<!ATTLIST forward name CDATA #REQUIRED>+<!ATTLIST forward path %RequestPath; #REQUIRED>+<!ATTLIST forward redirect %Boolean; #IMPLIED>+++<!-- The "action-mappings" element describes a set of ActionMapping objects+ [org.apache.struts.action.ActionMapping] that are available to process+ requests matching the url-pattern our ActionServlet registered with the+ container. The individual ActionMappings are configured through nested+ <action> elements. The following attributes are defined:++ type Fully qualified Java class to use when instantiating+ ActionMapping objects. If specified, the object must be a+ subclass of the default class type.++ WARNING: For Struts 1.0, this value is ignored. You+ can set the default implementation class name with the+ "mapping" initialization parameter to the Struts+ controller servlet.+-->+<!ELEMENT action-mappings (action*)>+<!ATTLIST action-mappings id ID #IMPLIED>+<!ATTLIST action-mappings type %ClassName; #IMPLIED>+++<!-- The "action" element describes an ActionMapping object that is to be used+ to process a request for a specific module-relative URI. The following+ attributes are defined:++ attribute Name of the request-scope or session-scope attribute that+ is used to access our ActionForm bean, if it is other than+ the bean's specified "name". Optional if "name" is specified,+ else not valid.++ className The fully qualified Java class name of the ActionMapping+ subclass to use for this action mapping object. Defaults to+ the type specified by the enclosing <action-mappings>+ element or to "org.apache.struts.action.ActionMapping" if+ not specified.+ ["org.apache.struts.action.ActionMapping"]++ forward Module-relative path of the servlet or other resource that+ will process this request, instead of the Action class+ specified by "type". The path WILL NOT be processed+ through the "forwardPattern" attribute that is configured+ on the "controller" element for this module.+ Exactly one of "forward", "include", or "type" must be+ specified.++ include Module-relative path of the servlet or other resource that+ will process this request, instead of the Action class+ specified by "type". The path WILL NOT be processed+ through the "forwardPattern" attribute that is configured+ on the "controller" element for this module.+ Exactly one of "forward", "include", or "type" must be+ specified.++ input Module-relative path of the action or other resource to+ which control should be returned if a validation error is+ encountered. Valid only when "name" is specified. Required+ if "name" is specified and the input bean returns+ validation errors. Optional if "name" is specified and the+ input bean does not return validation errors.++ name Name of the form bean, if any, that is associated with this+ action mapping.++ path The module-relative path of the submitted request, starting+ with a "/" character, and without the filename extension if+ extension mapping is used.++ NOTE: Do *not* include a period in your path name,+ because it will look like a filename extension and+ cause your Action to not be located.++ parameter General-purpose configuration parameter that can be used to+ pass extra information to the Action object selected by+ this action mapping.++ prefix Prefix used to match request parameter names to ActionForm+ property names, if any. Optional if "name" is specified,+ else not allowed.++ roles Comma-delimited list of security role names that are allowed+ access to this ActionMapping object. Since Struts 1.1.++ scope The context ("request" or "session") that is used to+ access our ActionForm bean, if any. Optional if "name" is+ specified, else not valid. [session]++ suffix Suffix used to match request parameter names to ActionForm+ bean property names, if any. Optional if "name" is+ specified, else not valid.++ type Fully qualified Java class name of the Action subclass+ [org.apache.struts.action.Action] that will process requests+ for this action mapping. Not valid if either the "forward"+ or "include" attribute is specified. Exactly one of+ "forward", "include", or "type" must be specified.++ unknown Set to "true" if this object should be configured as the+ default action mapping for this module. If a request does not+ match another object, it will be passed to the ActionMapping+ object with unknown set to "true". Only one ActionMapping+ can be marked as "unknown" within a module.+ [false]++ validate Set to "true" if the validate method of the ActionForm bean+ should be called prior to calling the Action object for this+ action mapping, or set to "false" if you do not want the+ validate method called.+ [true]+-->+<!ELEMENT action (icon?, display-name?, description?, set-property*, exception*, forward*)>+<!ATTLIST action id ID #IMPLIED>+<!ATTLIST action attribute %BeanName; #IMPLIED>+<!ATTLIST action className %ClassName; #IMPLIED>+<!ATTLIST action forward %RequestPath; #IMPLIED>+<!ATTLIST action include %RequestPath; #IMPLIED>+<!ATTLIST action input %RequestPath; #IMPLIED>+<!ATTLIST action name %BeanName; #IMPLIED>+<!ATTLIST action parameter CDATA #IMPLIED>+<!ATTLIST action path %RequestPath; #REQUIRED>+<!ATTLIST action prefix CDATA #IMPLIED>+<!ATTLIST action roles CDATA #IMPLIED>+<!ATTLIST action scope %RequestScope; #IMPLIED>+<!ATTLIST action suffix CDATA #IMPLIED>+<!ATTLIST action type %ClassName; #IMPLIED>+<!ATTLIST action unknown %Boolean; #IMPLIED>+<!ATTLIST action validate %Boolean; #IMPLIED>+++<!-- The "controller" element describes the ControllerConfig bean+ [org.apache.struts.config.ControllerConfig] that encapsulates+ a module's runtime configuration. The following+ attributes are defined:++ bufferSize The size of the input buffer used when processing+ file uploads.+ [4096]++ className Fully qualified Java class name of the+ ControllerConfig subclass for this controller object.+ If specified, the object must be a subclass of the+ default class.+ ["org.apache.struts.config.ControllerConfig"]++ contentType Default content type (and optional character encoding) to+ be set on each response. May be overridden by the Action,+ JSP, or other resource to which the request is forwarded.+ ["text/html"]++ forwardPattern Replacement pattern defining how the "path" attribute of a+ <forward> element is mapped to a context-relative URL when+ it starts with a slash (and when the contextRelative+ property is false). This value may consist of any+ combination of the following:+ - "$M" - Replaced by the module prefix of this module+ - "$P" - Replaced by the "path" attribute of the selected+ "forward" element+ - "$$" - Causes a literal dollar sign to be rendered+ - "$x" - (Where "x" is any character not defined above)+ Silently swallowed, reserved for future use+ If not specified, the default forwardPattern is "$M$P",+ which is consistent with the previous behavior of+ forwards. Since Struts 1.1. ["$M$P"]++ inputForward Set to "true" if you want the "input" attribute of+ <action> elements to be the name of a local or global+ ActionForward, which will then be used to calculate the+ ultimate URL. Set to "false" (the default) to treat the+ "input" parameter of <action> elements as a+ module-relative path to the resource+ to be used as the input form. Since Struts 1.1.+ [false]++ locale Set to "true" if you want a Locale object stored in the+ user's session if not already present.+ [true]++ maxFileSize The maximum size (in bytes) of a file to be accepted as a+ file upload. Can be expressed as a number followed by a+ "K", "M", or "G", which are interpreted to mean kilobytes,+ megabytes, or gigabytes, respectively.+ ["250M"]++ memFileSize The maximum size (in bytes) of a file whose contents will+ be retained in memory after uploading. Files larger than+ this threshold will be written to some alternative storage+ medium, typically a hard disk. Can be expressed as a number+ followed by a "K", "M", or "G", which are interpreted to+ mean kilobytes, megabytes, or gigabytes, respectively.+ ["256K"]++ multipartClass The fully qualified Java class name of the multipart+ request handler class to be used with this module.+ ["org.apache.struts.upload.CommonsMultipartRequestHandler"]++ nocache Set to "true" if you want the controller to add HTTP+ headers for defeating caching to every response from+ this module. [false]++ pagePattern Replacement pattern defining how the "page" attribute of+ custom tags using it is mapped to a context-relative URL+ of the corresponding resource. This value may consist of+ any combination of the following:+ - "$M" - Replaced by the module prefix of this module+ - "$P" - Replaced by the value of the "page" attribute+ - "$$" - Causes a literal dollar sign to be rendered+ - "$x" - (Where "x" is any character not defined above)+ Silently swallowed, reserved for future use+ If not specified, the default forwardPattern is+ "$M$P", which is consistent with previous hard coded+ behavior of URL evaluation for "page" attributes.+ ["$M$P"]++ processorClass The fully qualified Java class name of the+ RequestProcessor subclass to be used with this module.+ ["org.apache.struts.action.RequestProcessor"]++ tempDir Temporary working directory to use when processing+ file uploads.+ [{Directory provided by servlet container}]+-->+<!ELEMENT controller (set-property*)>+<!ATTLIST controller id ID #IMPLIED>+<!ATTLIST controller bufferSize %Integer; #IMPLIED>+<!ATTLIST controller className %ClassName; #IMPLIED>+<!ATTLIST controller contentType CDATA #IMPLIED>+<!ATTLIST controller forwardPattern CDATA #IMPLIED>+<!ATTLIST controller inputForward %Boolean; #IMPLIED>+<!ATTLIST controller locale %Boolean; #IMPLIED>+<!ATTLIST controller maxFileSize CDATA #IMPLIED>+<!ATTLIST controller memFileSize CDATA #IMPLIED>+<!ATTLIST controller multipartClass %ClassName; #IMPLIED>+<!ATTLIST controller nocache %Boolean; #IMPLIED>+<!ATTLIST controller pagePattern CDATA #IMPLIED>+<!ATTLIST controller processorClass %ClassName; #IMPLIED>+<!ATTLIST controller tempDir CDATA #IMPLIED>+++<!-- The "message-resources" element describes a MessageResources object with+ message templates for this module. The following attributes are defined:++ className The configuration bean for this message resources object.+ If specified, the object must be a subclass of the default+ configuration bean.+ ["org.apache.struts.config.MessageResourcesConfig"]++ factory Fully qualified Java class name of the+ MessageResourcesFactory subclass to use for this message+ resources object.+ ["org.apache.struts.util.PropertyMessageResourcesFactory"]++ key Servlet context attribute under which this message+ resources bundle will be stored. The default attribute is+ the value specified by the string constant at+ [Globals.MESSAGES_KEY]. The module prefix (if+ any) is appended to the key (${key}${prefix}).+ [org.apache.struts.Globals.MESSAGES_KEY]++ NOTE: The module prefix includes the leading+ slash, so the default message resource bundle for a module+ named "foo" is stored under+ "org.apache.struts.action.MESSAGE/foo".++ null Set to "true" if you want our message resources to return a+ null string for unknown message keys, or "false" to return a+ message with the bad key value.++ parameter Configuration parameter to be passed to the createResources+ method of our factory object.+-->+<!ELEMENT message-resources (set-property*)>+<!ATTLIST message-resources id ID #IMPLIED>+<!ATTLIST message-resources className %ClassName; #IMPLIED>+<!ATTLIST message-resources factory %ClassName; #IMPLIED>+<!ATTLIST message-resources key %AttributeName; #IMPLIED>+<!ATTLIST message-resources null %Boolean; #IMPLIED>+<!ATTLIST message-resources parameter CDATA #REQUIRED>+++<!-- The "plug-in" element specifies the fully qualified class name of a+ general-purpose application plug-in module that receives notification of+ application startup and shutdown events. An instance of the specified class+ is created for each element, and can be configured with nested <set-property>+ elements. The following attributes are supported:++ className Fully qualified Java class name of the plug-in class; must+ implement [org.apache.struts.action.PlugIn].+-->+<!ELEMENT plug-in (set-property*)>+<!ATTLIST plug-in id ID #IMPLIED>+<!ATTLIST plug-in className %ClassName; #REQUIRED>+++<!-- ========== Subordinate Elements ====================================== -->+++<!-- The "description" element contains descriptive (paragraph length) text+ about the surrounding element, suitable for use in GUI tools.+-->+<!ELEMENT description (#PCDATA)>+<!ATTLIST description id ID #IMPLIED>+++<!-- The "display-name" element contains a short (one line) description of+ the surrounding element, suitable for use in GUI tools.+-->+<!ELEMENT display-name (#PCDATA)>+<!ATTLIST display-name id ID #IMPLIED>+++<!-- The "icon" element contains a small-icon and large-icon element which+ specify the location, relative to the Struts configuration file, for small+ and large images used to represent the surrounding element in GUI tools.+-->+<!ELEMENT icon (small-icon?, large-icon?)>+<!ATTLIST icon id ID #IMPLIED>+++<!-- The "large-icon" element specifies the location, relative to the Struts+ configuration file, of a resource containing a large (32x32 pixel)+ icon image.+-->+<!ELEMENT large-icon (%Location;)>+<!ATTLIST large-icon id ID #IMPLIED>+++<!-- The "set-property" element specifies the method name and initial value of+ an additional JavaBean configuration property. When the object representing+ the surrounding element is instantiated, the accessor for the indicated+ property is called and passed the indicated value. The "set-property"+ element is especially useful when a custom subclass is used with+ <data-source>, <forward>, <action>, or <plug-in> elements. The subclass+ can be passed whatever other properties may be required to configure the+ object without changing how the struts-config is parsed.++ property Name of the JavaBeans property whose setter method+ will be called.++ value String representation of the value to which this+ property will be set, after suitable type conversion+-->+<!ELEMENT set-property EMPTY>+<!ATTLIST set-property id ID #IMPLIED>+<!ATTLIST set-property property %PropName; #REQUIRED>+<!ATTLIST set-property value CDATA #REQUIRED>+++<!-- The "small-icon" element specifies the location, relative to the Struts+ configuration file, of a resource containing a small (16x16 pixel)+ icon image.+-->+<!ELEMENT small-icon (%Location;)>+<!ATTLIST small-icon id ID #IMPLIED>+diff --git a/contrib/web2/src/main/webapp/WEB-INF/dtd/tiles-config_1_1.dtd b/contrib/web2/src/main/webapp/WEB-INF/dtd/tiles-config_1_1.dtdnew file mode 100644index 000000000..92675c8f7--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/dtd/tiles-config_1_1.dtd@@ -0,0 +1,281 @@+<!--+ DTD for the Tile Definition File, Version 1.1++ To support validation of your configuration file, include the following+ DOCTYPE element at the beginning (after the "xml" declaration):++ <!DOCTYPE tiles-definitions PUBLIC+ "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"+ "http://struts.apache.org/dtds/tiles-config_1_1.dtd">++ $Id: tiles-config_1_1.dtd 51703 2004-09-01 10:41:11Z niallp $+-->+++<!-- ========== Defined Types ============================================= -->+++<!-- A "Boolean" is the string representation of a boolean (true or false)+ variable.+-->+<!ENTITY % Boolean "(true|false)">+++<!-- A "ContentType" is the content type of an attribute passed to a tile+ component.+-->+<!ENTITY % ContentType "(string|page|template|definition)">++<!-- A "ClassName" is the fully qualified name of a Java class that is+ instantiated to provide the functionality of the enclosing element.+-->+<!ENTITY % ClassName "CDATA">++<!-- A "RequestPath" is an module-relative URI path, beginning with a+ slash, that identifies a mapped resource (such as a JSP page or a servlet)+ within this web application.+-->+<!ENTITY % RequestPath "CDATA">++<!-- A "DefinitionName" is the unique identifier of a definition. This identifier+ is a logical name used to reference the definition.+-->+<!ENTITY % DefinitionName "CDATA">++<!-- A "BeanName" is the identifier of a JavaBean, such as a form bean,+ and also serves as the name of the corresponding scripting variable+ and the name of the JSP attribute under which the bean is accessed.+ Therefore, it must conform to the rules for a Java identifier.+-->+<!ENTITY % BeanName "CDATA">++<!-- A "PropName" is the name of a JavaBeans property, and must begin with+ a lower case letter and contain only characters that are legal in a+ Java identifier.+-->+<!ENTITY % PropName "CDATA">++<!-- A "Location" is a relative path, delimited by "/" characters, that+ defines the location of a resource relative to the location of the+ configuration file itself.+-->+<!ENTITY % Location "#PCDATA">++++<!-- ========== Top Level Elements ======================================== -->+++ <!-- deprecated: use tiles-definitions instead.-->+<!ELEMENT component-definitions (definition+)>++<!-- The "tiles-definitions" element is the root of the configuration file+ hierarchy, and contains nested elements for all of the other+ configuration settings.+-->+<!ELEMENT tiles-definitions (definition+)>++<!-- The "definition" element describes a definition that can be inserted in a jsp+ page. This definition is identified by its logical name. A definition allows+ to define all the attributes that can be set in <insert> tag from a jsp page.++ controllerClass The fully qualified Java class name of the controller+ subclass to call immediately before the tiles is inserted.+ Only one of controllerClass or controllerUrl should be+ specified.++ controllerUrl The context-relative path to the resource used as controller+ called immediately before the tiles is inserted.+ Only one of controllerClass or controllerUrl should be+ specified.++ extends Name of a definition that is used as ancestor of this definition.+ All attributes from the ancestor are available to the new+ definition. Any attribute inherited from the ancestor can+ be overloaded by providing a new value.++ name The unique identifier for this definition.++ page Same as path.++ path The context-relative path to the resource used as tiles to+ insert. This tiles will be inserted and a tiles context+ containing appropriate attributes will be available.++ role Security role name that is allowed access to this definition+ object. The definition is inserted only if the role name is+ allowed.++ template Same as path. For compatibility with the template tag library.+-->+<!ELEMENT definition (icon?, display-name?, description?, put*, putList*)>+<!ATTLIST definition id ID #IMPLIED>+<!ATTLIST definition controllerClass %ClassName; #IMPLIED>+<!ATTLIST definition controllerUrl %RequestPath; #IMPLIED>+<!ATTLIST definition extends %DefinitionName; #IMPLIED>+<!ATTLIST definition name %DefinitionName; #REQUIRED>+<!ATTLIST definition page %RequestPath; #IMPLIED>+<!ATTLIST definition path %RequestPath; #IMPLIED>+<!ATTLIST definition role CDATA #IMPLIED>+<!ATTLIST definition template %RequestPath; #IMPLIED>+++<!-- The "put" element describes an attribute of a definition. It allows to+ specify the tiles attribute name and its value. The tiles value can be+ specified as an xml attribute, or in the body of the <put> tag.++ content Same as value. For compatibility with the template tag library.++ direct Same as type="string". For compatibility with the template+ tag library.++ name The unique identifier for this put.++ type The type of the value. Can be: string, page, template or definition.+ By default, no type is associated to a value. If a type is+ associated, it will be used as a hint to process the value+ when the attribute will be used in the inserted tiles.++ value The value associated to this tiles attribute. The value should+ be specified with this tag attribute, or in the body of the tag.+-->+<!ELEMENT put (#PCDATA)>+<!ATTLIST put id ID #IMPLIED>+<!ATTLIST put content CDATA #IMPLIED>+<!ATTLIST put direct %Boolean; #IMPLIED>+<!ATTLIST put name CDATA #REQUIRED>+<!ATTLIST put type %ContentType; #IMPLIED>+<!ATTLIST put value CDATA #IMPLIED>+++<!-- The "putList" element describes a list attribute of a definition. It allows to+ specify an attribute that is a java List containing any kind of values. In+ the config file, the list elements are specified by nested <add>, <item> or+ <putList>.++ name The unique identifier for this put list.+-->+<!ELEMENT putList ( (add* | item* | bean* | putList*)+) >+<!ATTLIST putList id ID #IMPLIED>+<!ATTLIST putList name CDATA #REQUIRED>++<!-- ========== Subordinate Elements ====================================== -->++<!-- The "add" element describes an element of a list. It is similar to the+ <put> element.++ content Same as value. For compatibility with the template tag library.++ direct Same as type="string". For compatibility with the template+ tag library.++ type The type of the value. Can be: string, page, template or definition.+ By default, no type is associated to a value. If a type is+ associated, it will be used as a hint to process the value+ when the attribute will be used in the inserted tiles.++ value The value associated to this tiles attribute. The value should+ be specified with this tag attribute, or in the body of the tag.+-->+<!ELEMENT add (#PCDATA)>+<!ATTLIST add id ID #IMPLIED>+<!ATTLIST add content CDATA #IMPLIED>+<!ATTLIST add direct %Boolean; #IMPLIED>+<!ATTLIST add type %ContentType; #IMPLIED>+<!ATTLIST add value CDATA #IMPLIED>+++<!-- The "bean" element describes an element of a list. It create a bean of the+ specified java classtype. This bean is initialized with appropriate nested+ <set-property>.++ classtype The fully qualified classname for this bean.+-->+<!ELEMENT bean (set-property*)>+<!ATTLIST bean id ID #IMPLIED>+<!ATTLIST bean classtype %ClassName; #REQUIRED>++<!-- The "set-property" element specifies the method name and initial value of+ a bean property. When the object representing+ the surrounding element is instantiated, the accessor for the indicated+ property is called and passed the indicated value.++ property Name of the JavaBeans property whose setter method+ will be called.++ value String representation of the value to which this+ property will be set, after suitable type conversion+-->+<!ELEMENT set-property EMPTY>+<!ATTLIST set-property id ID #IMPLIED>+<!ATTLIST set-property property %PropName; #REQUIRED>+<!ATTLIST set-property value CDATA #REQUIRED>+++<!-- The "item" element describes an element of a list. It create a bean added as+ element to the list. Each bean can contain different properties: value, link,+ icon, tooltip. These properties are to be interpreted by the jsp page using+ them.+ By default the bean is of type+ "org.apache.struts.tiles.beans.SimpleMenuItem". This bean is useful to+ create a list of beans used as menu items.++ classtype The fully qualified classtype for this bean.+ If specified, the classtype must be a subclass of the interface+ "org.apache.struts.tiles.beans.MenuItem".++ icon The bean 'icon' property.++ link The bean 'link' property.++ tooltip The bean 'tooltip' property.++ value The bean 'value' property.+-->+<!ELEMENT item (#PCDATA)>+<!ATTLIST item id ID #IMPLIED>+<!ATTLIST item classtype %ClassName; #IMPLIED>+<!ATTLIST item icon CDATA #IMPLIED>+<!ATTLIST item link CDATA #REQUIRED>+<!ATTLIST item tooltip CDATA #IMPLIED>+<!ATTLIST item value CDATA #REQUIRED>+++<!-- ========== Info Elements ====================================== -->++<!-- The "description" element contains descriptive (paragraph length) text+ about the surrounding element, suitable for use in GUI tools.+-->+<!ELEMENT description (#PCDATA)>+<!ATTLIST description id ID #IMPLIED>+++<!-- The "display-name" element contains a short (one line) description of+ the surrounding element, suitable for use in GUI tools.+-->+<!ELEMENT display-name (#PCDATA)>+<!ATTLIST display-name id ID #IMPLIED>+++<!-- The "icon" element contains a small-icon and large-icon element which+ specify the location, relative to the Struts configuration file, for small+ and large images used to represent the surrounding element in GUI tools.+-->+<!ELEMENT icon (small-icon?, large-icon?)>+<!ATTLIST icon id ID #IMPLIED>+++<!-- The "large-icon" element specifies the location, relative to the Struts+ configuration file, of a resource containing a large (32x32 pixel)+ icon image.+-->+<!ELEMENT large-icon (%Location;)>+<!ATTLIST large-icon id ID #IMPLIED>+++<!-- The "small-icon" element specifies the location, relative to the Struts+ configuration file, of a resource containing a small (16x16 pixel)+ icon image.+-->+<!ELEMENT small-icon (%Location;)>+<!ATTLIST small-icon id ID #IMPLIED>diff --git a/contrib/web2/src/main/webapp/WEB-INF/dtd/web-app_2_2.dtd b/contrib/web2/src/main/webapp/WEB-INF/dtd/web-app_2_2.dtdnew file mode 100644index 000000000..172dafa71--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/dtd/web-app_2_2.dtd@@ -0,0 +1,565 @@++<!--+The web-app element is the root of the deployment descriptor for+a web application+-->++<!ELEMENT web-app (icon?, display-name?, description?, distributable?,+context-param*, servlet*, servlet-mapping*, session-config?,+mime-mapping*, welcome-file-list?, error-page*, taglib*,+resource-ref*, security-constraint*, login-config?, security-role*,+env-entry*, ejb-ref*)>++<!--+The icon element contains a small-icon and a large-icon element+which specify the location within the web application for a small and+large image used to represent the web application in a GUI tool. At a+minimum, tools must accept GIF and JPEG format images.+-->++<!ELEMENT icon (small-icon?, large-icon?)>++<!--+The small-icon element contains the location within the web+application of a file containing a small (16x16 pixel) icon image.+-->++<!ELEMENT small-icon (#PCDATA)>++<!--+The large-icon element contains the location within the web+application of a file containing a large (32x32 pixel) icon image.+-->++<!ELEMENT large-icon (#PCDATA)>++<!--+The display-name element contains a short name that is intended+to be displayed by GUI tools+-->++<!ELEMENT display-name (#PCDATA)>++<!--+The description element is used to provide descriptive text about+the parent element.+-->++<!ELEMENT description (#PCDATA)>++<!--+The distributable element, by its presence in a web application+deployment descriptor, indicates that this web application is+programmed appropriately to be deployed into a distributed servlet+container+-->++<!ELEMENT distributable EMPTY>++<!--+The context-param element contains the declaration of a web+application's servlet context initialization parameters.+-->++<!ELEMENT context-param (param-name, param-value, description?)>++<!--+The param-name element contains the name of a parameter.+-->++<!ELEMENT param-name (#PCDATA)>++<!--+The param-value element contains the value of a parameter.+-->++<!ELEMENT param-value (#PCDATA)>++<!--+The servlet element contains the declarative data of a+servlet. If a jsp-file is specified and the load-on-startup element is+present, then the JSP should be precompiled and loaded.+-->++<!ELEMENT servlet (icon?, servlet-name, display-name?, description?,+(servlet-class|jsp-file), init-param*, load-on-startup?, security-role-ref*)>++<!--+The servlet-name element contains the canonical name of the+servlet.+-->++<!ELEMENT servlet-name (#PCDATA)>++<!--+The servlet-class element contains the fully qualified class name+of the servlet.+-->++<!ELEMENT servlet-class (#PCDATA)>++<!--+The jsp-file element contains the full path to a JSP file within+the web application.+-->++<!ELEMENT jsp-file (#PCDATA)>++<!--+The init-param element contains a name/value pair as an+initialization param of the servlet+-->++<!ELEMENT init-param (param-name, param-value, description?)>++<!--+The load-on-startup element indicates that this servlet should be+loaded on the startup of the web application. The optional contents of+these element must be a positive integer indicating the order in which+the servlet should be loaded. Lower integers are loaded before higher+integers. If no value is specified, or if the value specified is not a+positive integer, the container is free to load it at any time in the+startup sequence.+-->++<!ELEMENT load-on-startup (#PCDATA)>++<!--+The servlet-mapping element defines a mapping between a servlet+and a url pattern+-->++<!ELEMENT servlet-mapping (servlet-name, url-pattern)>++<!--+The url-pattern element contains the url pattern of the+mapping. Must follow the rules specified in Section 10 of the Servlet+API Specification.+-->++<!ELEMENT url-pattern (#PCDATA)>++<!--+The session-config element defines the session parameters for+this web application.+-->++<!ELEMENT session-config (session-timeout?)>++<!--+The session-timeout element defines the default session timeout+interval for all sessions created in this web application. The+specified timeout must be expressed in a whole number of minutes.+-->++<!ELEMENT session-timeout (#PCDATA)>++<!--+The mime-mapping element defines a mapping between an extension+and a mime type.+-->++<!ELEMENT mime-mapping (extension, mime-type)>++<!--+The extension element contains a string describing an+extension. example: "txt"+-->++<!ELEMENT extension (#PCDATA)>++<!--+The mime-type element contains a defined mime type. example:+"text/plain"+-->++<!ELEMENT mime-type (#PCDATA)>++<!--+The welcome-file-list contains an ordered list of welcome files+elements.+-->++<!ELEMENT welcome-file-list (welcome-file+)>++<!--+The welcome-file element contains file name to use as a default+welcome file, such as index.html+-->++<!ELEMENT welcome-file (#PCDATA)>++<!--+The taglib element is used to describe a JSP tag library.+-->++<!ELEMENT taglib (taglib-uri, taglib-location)>++<!--+The taglib-uri element describes a URI, relative to the location+of the web.xml document, identifying a Tag Library used in the Web+Application.+-->++<!ELEMENT taglib-uri (#PCDATA)>++<!--+the taglib-location element contains the location (as a resource+relative to the root of the web application) where to find the Tag+Libary Description file for the tag library.+-->++<!ELEMENT taglib-location (#PCDATA)>++<!--+The error-page element contains a mapping between an error code+or exception type to the path of a resource in the web application+-->++<!ELEMENT error-page ((error-code | exception-type), location)>++<!--+The error-code contains an HTTP error code, ex: 404+-->++<!ELEMENT error-code (#PCDATA)>++<!--+The exception type contains a fully qualified class name of a+Java exception type.+-->++<!ELEMENT exception-type (#PCDATA)>++<!--+The location element contains the location of the resource in the+web application+-->++<!ELEMENT location (#PCDATA)>++<!--+The resource-ref element contains a declaration of a Web+Application's reference to an external resource.+-->++<!ELEMENT resource-ref (description?, res-ref-name, res-type, res-auth)>++<!--+The res-ref-name element specifies the name of the resource+factory reference name.+-->++<!ELEMENT res-ref-name (#PCDATA)>++<!--+The res-type element specifies the (Java class) type of the data+source.+-->++<!ELEMENT res-type (#PCDATA)>++<!--+The res-auth element indicates whether the application component+code performs resource signon programmatically or whether the+container signs onto the resource based on the principle mapping+information supplied by the deployer. Must be CONTAINER or SERVLET+-->++<!ELEMENT res-auth (#PCDATA)>++<!--+The security-constraint element is used to associate security+constraints with one or more web resource collections+-->++<!ELEMENT security-constraint (web-resource-collection+,+auth-constraint?, user-data-constraint?)>++<!--+The web-resource-collection element is used to identify a subset+of the resources and HTTP methods on those resources within a web+application to which a security constraint applies. If no HTTP methods+are specified, then the security constraint applies to all HTTP+methods.+-->++<!ELEMENT web-resource-collection (web-resource-name, description?,+url-pattern*, http-method*)>++<!--+The web-resource-name contains the name of this web resource+collection+-->++<!ELEMENT web-resource-name (#PCDATA)>++<!--+The http-method contains an HTTP method (GET | POST |...)+-->++<!ELEMENT http-method (#PCDATA)>++<!--+The user-data-constraint element is used to indicate how data+communicated between the client and container should be protected+-->++<!ELEMENT user-data-constraint (description?, transport-guarantee)>++<!--+The transport-guarantee element specifies that the communication+between client and server should be NONE, INTEGRAL, or+CONFIDENTIAL. NONE means that the application does not require any+transport guarantees. A value of INTEGRAL means that the application+requires that the data sent between the client and server be sent in+such a way that it can't be changed in transit. CONFIDENTIAL means+that the application requires that the data be transmitted in a+fashion that prevents other entities from observing the contents of+the transmission. In most cases, the presence of the INTEGRAL or+CONFIDENTIAL flag will indicate that the use of SSL is required.+-->++<!ELEMENT transport-guarantee (#PCDATA)>++<!--+The auth-constraint element indicates the user roles that should+be permitted access to this resource collection. The role used here+must appear in a security-role-ref element.+-->++<!ELEMENT auth-constraint (description?, role-name*)>++<!--+The role-name element contains the name of a security role.+-->++<!ELEMENT role-name (#PCDATA)>++<!--+The login-config element is used to configure the authentication+method that should be used, the realm name that should be used for+this application, and the attributes that are needed by the form login+mechanism.+-->++<!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)>++<!--+The realm name element specifies the realm name to use in HTTP+Basic authorization+-->++<!ELEMENT realm-name (#PCDATA)>++<!--+The form-login-config element specifies the login and error pages+that should be used in form based login. If form based authentication+is not used, these elements are ignored.+-->++<!ELEMENT form-login-config (form-login-page, form-error-page)>++<!--+The form-login-page element defines the location in the web app+where the page that can be used for login can be found+-->++<!ELEMENT form-login-page (#PCDATA)>++<!--+The form-error-page element defines the location in the web app+where the error page that is displayed when login is not successful+can be found+-->++<!ELEMENT form-error-page (#PCDATA)>++<!--+The auth-method element is used to configure the authentication+mechanism for the web application. As a prerequisite to gaining access+to any web resources which are protected by an authorization+constraint, a user must have authenticated using the configured+mechanism. Legal values for this element are "BASIC", "DIGEST",+"FORM", or "CLIENT-CERT".+-->++<!ELEMENT auth-method (#PCDATA)>++<!--+The security-role element contains the declaration of a security+role which is used in the security-constraints placed on the web+application.+-->++<!ELEMENT security-role (description?, role-name)>++<!--+The role-name element contains the name of a role. This element+must contain a non-empty string.+-->++<!ELEMENT security-role-ref (description?, role-name, role-link)>++<!--+The role-link element is used to link a security role reference+to a defined security role. The role-link element must contain the+name of one of the security roles defined in the security-role+elements.+-->++<!ELEMENT role-link (#PCDATA)>++<!--+The env-entry element contains the declaration of an+application's environment entry. This element is required to be+honored on in J2EE compliant servlet containers.+-->++<!ELEMENT env-entry (description?, env-entry-name, env-entry-value?,+env-entry-type)>++<!--+The env-entry-name contains the name of an application's+environment entry+-->++<!ELEMENT env-entry-name (#PCDATA)>++<!--+The env-entry-value element contains the value of an+application's environment entry+-->++<!ELEMENT env-entry-value (#PCDATA)>++<!--+The env-entry-type element contains the fully qualified Java type+of the environment entry value that is expected by the application+code. The following are the legal values of env-entry-type:+java.lang.Boolean, java.lang.String, java.lang.Integer,+java.lang.Double, java.lang.Float.+-->++<!ELEMENT env-entry-type (#PCDATA)>++<!--+The ejb-ref element is used to declare a reference to an+enterprise bean.+-->++<!ELEMENT ejb-ref (description?, ejb-ref-name, ejb-ref-type, home, remote,+ejb-link?)>++<!--+The ejb-ref-name element contains the name of an EJB+reference. This is the JNDI name that the servlet code uses to get a+reference to the enterprise bean.+-->++<!ELEMENT ejb-ref-name (#PCDATA)>++<!--+The ejb-ref-type element contains the expected java class type of+the referenced EJB.+-->++<!ELEMENT ejb-ref-type (#PCDATA)>++<!--+The ejb-home element contains the fully qualified name of the+EJB's home interface+-->++<!ELEMENT home (#PCDATA)>++<!--+The ejb-remote element contains the fully qualified name of the+EJB's remote interface+-->++<!ELEMENT remote (#PCDATA)>++<!--+The ejb-link element is used in the ejb-ref element to specify+that an EJB reference is linked to an EJB in an encompassing Java2+Enterprise Edition (J2EE) application package. The value of the+ejb-link element must be the ejb-name of and EJB in the J2EE+application package.+-->++<!ELEMENT ejb-link (#PCDATA)>++<!--+The ID mechanism is to allow tools to easily make tool-specific+references to the elements of the deployment descriptor. This allows+tools that produce additional deployment information (i.e information+beyond the standard deployment descriptor information) to store the+non-standard information in a separate file, and easily refer from+these tools-specific files to the information in the standard web-app+deployment descriptor.+-->++<!ATTLIST web-app id ID #IMPLIED>+<!ATTLIST icon id ID #IMPLIED>+<!ATTLIST small-icon id ID #IMPLIED>+<!ATTLIST large-icon id ID #IMPLIED>+<!ATTLIST display-name id ID #IMPLIED>+<!ATTLIST description id ID #IMPLIED>+<!ATTLIST distributable id ID #IMPLIED>+<!ATTLIST context-param id ID #IMPLIED>+<!ATTLIST param-name id ID #IMPLIED>+<!ATTLIST param-value id ID #IMPLIED>+<!ATTLIST servlet id ID #IMPLIED>+<!ATTLIST servlet-name id ID #IMPLIED>+<!ATTLIST servlet-class id ID #IMPLIED>+<!ATTLIST jsp-file id ID #IMPLIED>+<!ATTLIST init-param id ID #IMPLIED>+<!ATTLIST load-on-startup id ID #IMPLIED>+<!ATTLIST servlet-mapping id ID #IMPLIED>+<!ATTLIST url-pattern id ID #IMPLIED>+<!ATTLIST session-config id ID #IMPLIED>+<!ATTLIST session-timeout id ID #IMPLIED>+<!ATTLIST mime-mapping id ID #IMPLIED>+<!ATTLIST extension id ID #IMPLIED>+<!ATTLIST mime-type id ID #IMPLIED>+<!ATTLIST welcome-file-list id ID #IMPLIED>+<!ATTLIST welcome-file id ID #IMPLIED>+<!ATTLIST taglib id ID #IMPLIED>+<!ATTLIST taglib-uri id ID #IMPLIED>+<!ATTLIST taglib-location id ID #IMPLIED>+<!ATTLIST error-page id ID #IMPLIED>+<!ATTLIST error-code id ID #IMPLIED>+<!ATTLIST exception-type id ID #IMPLIED>+<!ATTLIST location id ID #IMPLIED>+<!ATTLIST resource-ref id ID #IMPLIED>+<!ATTLIST res-ref-name id ID #IMPLIED>+<!ATTLIST res-type id ID #IMPLIED>+<!ATTLIST res-auth id ID #IMPLIED>+<!ATTLIST security-constraint id ID #IMPLIED>+<!ATTLIST web-resource-collection id ID #IMPLIED>+<!ATTLIST web-resource-name id ID #IMPLIED>+<!ATTLIST http-method id ID #IMPLIED>+<!ATTLIST user-data-constraint id ID #IMPLIED>+<!ATTLIST transport-guarantee id ID #IMPLIED>+<!ATTLIST auth-constraint id ID #IMPLIED>+<!ATTLIST role-name id ID #IMPLIED>+<!ATTLIST login-config id ID #IMPLIED>+<!ATTLIST realm-name id ID #IMPLIED>+<!ATTLIST form-login-config id ID #IMPLIED>+<!ATTLIST form-login-page id ID #IMPLIED>+<!ATTLIST form-error-page id ID #IMPLIED>+<!ATTLIST auth-method id ID #IMPLIED>+<!ATTLIST security-role id ID #IMPLIED>+<!ATTLIST security-role-ref id ID #IMPLIED>+<!ATTLIST role-link id ID #IMPLIED>+<!ATTLIST env-entry id ID #IMPLIED>+<!ATTLIST env-entry-name id ID #IMPLIED>+<!ATTLIST env-entry-value id ID #IMPLIED>+<!ATTLIST env-entry-type id ID #IMPLIED>+<!ATTLIST ejb-ref id ID #IMPLIED>+<!ATTLIST ejb-ref-name id ID #IMPLIED>+<!ATTLIST ejb-ref-type id ID #IMPLIED>+<!ATTLIST home id ID #IMPLIED>+<!ATTLIST remote id ID #IMPLIED>+<!ATTLIST ejb-link id ID #IMPLIED>diff --git a/contrib/web2/src/main/webapp/WEB-INF/dtd/web-app_2_3.dtd b/contrib/web2/src/main/webapp/WEB-INF/dtd/web-app_2_3.dtdnew file mode 100644index 000000000..56bfb11dc--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/dtd/web-app_2_3.dtd@@ -0,0 +1,1059 @@+<!--+Copyright 2000-2001 Sun Microsystems, Inc. 901 San Antonio Road,+Palo Alto, CA 94303, U.S.A. All rights reserved.++This product or document is protected by copyright and distributed+under licenses restricting its use, copying, distribution, and+decompilation. No part of this product or documentation may be+reproduced in any form by any means without prior written authorization+of Sun and its licensors, if any.++Third party software, including font technology, is copyrighted and+licensed from Sun suppliers.++Sun, Sun Microsystems, the Sun Logo, Solaris, Java, JavaServer Pages, Java+Naming and Directory Interface, JDBC, JDK, JavaMail and Enterprise JavaBeans,+are trademarks or registered trademarks of Sun Microsystems, Inc in the U.S.+and other countries.++All SPARC trademarks are used under license and are trademarks+or registered trademarks of SPARC International, Inc.+in the U.S. and other countries. Products bearing SPARC+trademarks are based upon an architecture developed by Sun Microsystems, Inc.++PostScript is a registered trademark of Adobe Systems, Inc.++Federal Acquisitions: Commercial Software - Government Users Subject to+Standard License Terms and Conditions.++DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED+CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY+IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR+PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT+TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY+INVALID.++_________________________________________________________________________++Copyright 2000-2001 Sun Microsystems, Inc.,+901 San Antonio Road, Palo Alto, CA 94303, Etats-Unis.+Tous droits re'serve's.+++Ce produit ou document est prote'ge' par un copyright et distribue' avec+des licences qui en restreignent l'utilisation, la copie, la distribution,+et la de'compilation. Aucune partie de ce produit ou de sa documentation+associe'e ne peut e^tre reproduite sous aucune forme, par quelque moyen+que ce soit, sans l'autorisation pre'alable et e'crite de Sun et de ses+bailleurs de licence, s'il y en a.++Le logiciel de'tenu par des tiers, et qui comprend la technologie+relative aux polices de caracte`res, est prote'ge' par un copyright+et licencie' par des fournisseurs de Sun.++Sun, Sun Microsystems, le logo Sun, Solaris, Java, JavaServer Pages, Java+Naming and Directory Interface, JDBC, JDK, JavaMail, et Enterprise JavaBeans,+sont des marques de fabrique ou des marques de'pose'es de Sun+Microsystems, Inc. aux Etats-Unis et dans d'autres pays.++Toutes les marques SPARC sont utilise'es sous licence et sont+des marques de fabrique ou des marques de'pose'es de SPARC+International, Inc. aux Etats-Unis et dans+d'autres pays. Les produits portant les marques SPARC sont+base's sur une architecture de'veloppe'e par Sun Microsystems, Inc.++Postcript est une marque enregistre'e d'Adobe Systems Inc.++LA DOCUMENTATION EST FOURNIE "EN L'ETAT" ET TOUTES AUTRES CONDITIONS,+DECLARATIONS ET GARANTIES EXPRESSES OU TACITES SONT FORMELLEMENT EXCLUES,+DANS LA MESURE AUTORISEE PAR LA LOI APPLICABLE, Y COMPRIS NOTAMMENT+TOUTE GARANTIE IMPLICITE RELATIVE A LA QUALITE MARCHANDE, A L'APTITUDE+A UNE UTILISATION PARTICULIERE OU A L'ABSENCE DE CONTREFACON.+-->++<!--+This is the XML DTD for the Servlet 2.3 deployment descriptor.+All Servlet 2.3 deployment descriptors must include a DOCTYPE+of the following form:++ <!DOCTYPE web-app PUBLIC+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"+ "http://java.sun.com/dtd/web-app_2_3.dtd">++-->++<!--+The following conventions apply to all J2EE deployment descriptor+elements unless indicated otherwise.++- In elements that contain PCDATA, leading and trailing whitespace+ in the data may be ignored.++- In elements whose value is an "enumerated type", the value is+ case sensitive.++- In elements that specify a pathname to a file within the same+ JAR file, relative filenames (i.e., those not starting with "/")+ are considered relative to the root of the JAR file's namespace.+ Absolute filenames (i.e., those starting with "/") also specify+ names in the root of the JAR file's namespace. In general, relative+ names are preferred. The exception is .war files where absolute+ names are preferred for consistency with the servlet API.+-->+++<!--+The web-app element is the root of the deployment descriptor for+a web application.+-->+<!ELEMENT web-app (icon?, display-name?, description?, distributable?,+context-param*, filter*, filter-mapping*, listener*, servlet*,+servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?,+error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*,+login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref*)>++<!--+The auth-constraint element indicates the user roles that should+be permitted access to this resource collection. The role-name+used here must either correspond to the role-name of one of the+security-role elements defined for this web application, or be+the specially reserved role-name "*" that is a compact syntax for+indicating all roles in the web application. If both "*" and+rolenames appear, the container interprets this as all roles.+If no roles are defined, no user is allowed access to the portion of+the web application described by the containing security-constraint.+The container matches role names case sensitively when determining+access.+++Used in: security-constraint+-->+<!ELEMENT auth-constraint (description?, role-name*)>++<!--+The auth-method element is used to configure the authentication+mechanism for the web application. As a prerequisite to gaining access to any web resources which are protected by an authorization+constraint, a user must have authenticated using the configured+mechanism. Legal values for this element are "BASIC", "DIGEST",+"FORM", or "CLIENT-CERT".++Used in: login-config+-->+<!ELEMENT auth-method (#PCDATA)>++<!--+The context-param element contains the declaration of a web+application's servlet context initialization parameters.++Used in: web-app+-->+<!ELEMENT context-param (param-name, param-value, description?)>++<!--+The description element is used to provide text describing the parent+element. The description element should include any information that+the web application war file producer wants to provide to the consumer of+the web application war file (i.e., to the Deployer). Typically, the tools+used by the web application war file consumer will display the description+when processing the parent element that contains the description.++Used in: auth-constraint, context-param, ejb-local-ref, ejb-ref,+env-entry, filter, init-param, resource-env-ref, resource-ref, run-as,+security-role, security-role-ref, servlet, user-data-constraint,+web-app, web-resource-collection+-->+<!ELEMENT description (#PCDATA)>++<!--+The display-name element contains a short name that is intended to be+displayed by tools. The display name need not be unique.++Used in: filter, security-constraint, servlet, web-app++Example:++<display-name>Employee Self Service</display-name>+-->+<!ELEMENT display-name (#PCDATA)>++<!--+The distributable element, by its presence in a web application+deployment descriptor, indicates that this web application is+programmed appropriately to be deployed into a distributed servlet+container++Used in: web-app+-->+<!ELEMENT distributable EMPTY>++<!--+The ejb-link element is used in the ejb-ref or ejb-local-ref+elements to specify that an EJB reference is linked to an+enterprise bean.++The name in the ejb-link element is composed of a+path name specifying the ejb-jar containing the referenced enterprise+bean with the ejb-name of the target bean appended and separated from+the path name by "#". The path name is relative to the war file+containing the web application that is referencing the enterprise bean.+This allows multiple enterprise beans with the same ejb-name to be+uniquely identified.++Used in: ejb-local-ref, ejb-ref++Examples:++ <ejb-link>EmployeeRecord</ejb-link>++ <ejb-link>../products/product.jar#ProductEJB</ejb-link>++-->+<!ELEMENT ejb-link (#PCDATA)>++<!--+The ejb-local-ref element is used for the declaration of a reference to+an enterprise bean's local home. The declaration consists of:++ - an optional description+ - the EJB reference name used in the code of the web application+ that's referencing the enterprise bean+ - the expected type of the referenced enterprise bean+ - the expected local home and local interfaces of the referenced+ enterprise bean+ - optional ejb-link information, used to specify the referenced+ enterprise bean++Used in: web-app+-->+<!ELEMENT ejb-local-ref (description?, ejb-ref-name, ejb-ref-type,+ local-home, local, ejb-link?)>++<!--+The ejb-ref element is used for the declaration of a reference to+an enterprise bean's home. The declaration consists of:++ - an optional description+ - the EJB reference name used in the code of+ the web application that's referencing the enterprise bean+ - the expected type of the referenced enterprise bean+ - the expected home and remote interfaces of the referenced+ enterprise bean+ - optional ejb-link information, used to specify the referenced+ enterprise bean++Used in: web-app+-->+<!ELEMENT ejb-ref (description?, ejb-ref-name, ejb-ref-type,+ home, remote, ejb-link?)>++<!--+The ejb-ref-name element contains the name of an EJB reference. The+EJB reference is an entry in the web application's environment and is+relative to the java:comp/env context. The name must be unique+within the web application.++It is recommended that name is prefixed with "ejb/".++Used in: ejb-local-ref, ejb-ref++Example:++<ejb-ref-name>ejb/Payroll</ejb-ref-name>+-->+<!ELEMENT ejb-ref-name (#PCDATA)>++<!--+The ejb-ref-type element contains the expected type of the+referenced enterprise bean.++The ejb-ref-type element must be one of the following:++ <ejb-ref-type>Entity</ejb-ref-type>+ <ejb-ref-type>Session</ejb-ref-type>++Used in: ejb-local-ref, ejb-ref+-->+<!ELEMENT ejb-ref-type (#PCDATA)>++<!--+The env-entry element contains the declaration of a web application's+environment entry. The declaration consists of an optional+description, the name of the environment entry, and an optional+value. If a value is not specified, one must be supplied+during deployment.+-->+<!ELEMENT env-entry (description?, env-entry-name, env-entry-value?,+env-entry-type)>++<!--+The env-entry-name element contains the name of a web applications's+environment entry. The name is a JNDI name relative to the+java:comp/env context. The name must be unique within a web application.++Example:++<env-entry-name>minAmount</env-entry-name>++Used in: env-entry+-->+<!ELEMENT env-entry-name (#PCDATA)>++<!--+The env-entry-type element contains the fully-qualified Java type of+the environment entry value that is expected by the web application's+code.++The following are the legal values of env-entry-type:++ java.lang.Boolean+ java.lang.Byte+ java.lang.Character+ java.lang.String+ java.lang.Short+ java.lang.Integer+ java.lang.Long+ java.lang.Float+ java.lang.Double++Used in: env-entry+-->+<!ELEMENT env-entry-type (#PCDATA)>++<!--+The env-entry-value element contains the value of a web application's+environment entry. The value must be a String that is valid for the+constructor of the specified type that takes a single String+parameter, or for java.lang.Character, a single character.++Example:++<env-entry-value>100.00</env-entry-value>++Used in: env-entry+-->+<!ELEMENT env-entry-value (#PCDATA)>++<!--+The error-code contains an HTTP error code, ex: 404++Used in: error-page+-->+<!ELEMENT error-code (#PCDATA)>++<!--+The error-page element contains a mapping between an error code+or exception type to the path of a resource in the web application++Used in: web-app+-->+<!ELEMENT error-page ((error-code | exception-type), location)>++<!--+The exception type contains a fully qualified class name of a+Java exception type.++Used in: error-page+-->+<!ELEMENT exception-type (#PCDATA)>++<!--+The extension element contains a string describing an+extension. example: "txt"++Used in: mime-mapping+-->+<!ELEMENT extension (#PCDATA)>++<!--+Declares a filter in the web application. The filter is mapped to+either a servlet or a URL pattern in the filter-mapping element, using+the filter-name value to reference. Filters can access the+initialization parameters declared in the deployment descriptor at+runtime via the FilterConfig interface.++Used in: web-app+-->+<!ELEMENT filter (icon?, filter-name, display-name?, description?,+filter-class, init-param*)>++<!--+The fully qualified classname of the filter.++Used in: filter+-->+<!ELEMENT filter-class (#PCDATA)>++<!--+Declaration of the filter mappings in this web application. The+container uses the filter-mapping declarations to decide which filters+to apply to a request, and in what order. The container matches the+request URI to a Servlet in the normal way. To determine which filters+to apply it matches filter-mapping declarations either on servlet-name,+or on url-pattern for each filter-mapping element, depending on which+style is used. The order in which filters are invoked is the order in+which filter-mapping declarations that match a request URI for a+servlet appear in the list of filter-mapping elements.The filter-name+value must be the value of the <filter-name> sub-elements of one of the+<filter> declarations in the deployment descriptor.++Used in: web-app+-->+<!ELEMENT filter-mapping (filter-name, (url-pattern | servlet-name))>++<!--+The logical name of the filter. This name is used to map the filter.+Each filter name is unique within the web application.++Used in: filter, filter-mapping+-->+<!ELEMENT filter-name (#PCDATA)>++<!--+The form-error-page element defines the location in the web app+where the error page that is displayed when login is not successful+can be found. The path begins with a leading / and is interpreted+relative to the root of the WAR.++Used in: form-login-config+-->+<!ELEMENT form-error-page (#PCDATA)>++<!--+The form-login-config element specifies the login and error pages+that should be used in form based login. If form based authentication+is not used, these elements are ignored.++Used in: login-config+-->+<!ELEMENT form-login-config (form-login-page, form-error-page)>++<!--+The form-login-page element defines the location in the web app+where the page that can be used for login can be found. The path+begins with a leading / and is interpreted relative to the root of the WAR.++Used in: form-login-config+-->+<!ELEMENT form-login-page (#PCDATA)>++<!--+The home element contains the fully-qualified name of the enterprise+bean's home interface.++Used in: ejb-ref++Example:++<home>com.aardvark.payroll.PayrollHome</home>+-->+<!ELEMENT home (#PCDATA)>++<!--+The http-method contains an HTTP method (GET | POST |...).++Used in: web-resource-collection+-->+<!ELEMENT http-method (#PCDATA)>++<!--+The icon element contains small-icon and large-icon elements that+specify the file names for small and a large GIF or JPEG icon images+used to represent the parent element in a GUI tool.++Used in: filter, servlet, web-app+-->+<!ELEMENT icon (small-icon?, large-icon?)>++<!--+The init-param element contains a name/value pair as an+initialization param of the servlet++Used in: filter, servlet+-->+<!ELEMENT init-param (param-name, param-value, description?)>++<!--+The jsp-file element contains the full path to a JSP file within+the web application beginning with a `/'.++Used in: servlet+-->+<!ELEMENT jsp-file (#PCDATA)>++<!--+The large-icon element contains the name of a file+containing a large (32 x 32) icon image. The file+name is a relative path within the web application's+war file.++The image may be either in the JPEG or GIF format.+The icon can be used by tools.++Used in: icon++Example:++<large-icon>employee-service-icon32x32.jpg</large-icon>+-->+<!ELEMENT large-icon (#PCDATA)>++<!--+The listener element indicates the deployment properties for a web+application listener bean.++Used in: web-app+-->+<!ELEMENT listener (listener-class)>++<!--+The listener-class element declares a class in the application must be+registered as a web application listener bean. The value is the fully qualified classname of the listener class.+++Used in: listener+-->+<!ELEMENT listener-class (#PCDATA)>++<!--+The load-on-startup element indicates that this servlet should be+loaded (instantiated and have its init() called) on the startup+of the web application. The optional contents of+these element must be an integer indicating the order in which+the servlet should be loaded. If the value is a negative integer,+or the element is not present, the container is free to load the+servlet whenever it chooses. If the value is a positive integer+or 0, the container must load and initialize the servlet as the+application is deployed. The container must guarantee that+servlets marked with lower integers are loaded before servlets+marked with higher integers. The container may choose the order+of loading of servlets with the same load-on-start-up value.++Used in: servlet+-->+<!ELEMENT load-on-startup (#PCDATA)>++<!--++The local element contains the fully-qualified name of the+enterprise bean's local interface.++Used in: ejb-local-ref++-->+<!ELEMENT local (#PCDATA)>++<!--++The local-home element contains the fully-qualified name of the+enterprise bean's local home interface.++Used in: ejb-local-ref+-->+<!ELEMENT local-home (#PCDATA)>++<!--+The location element contains the location of the resource in the web+application relative to the root of the web application. The value of+the location must have a leading `/'.++Used in: error-page+-->+<!ELEMENT location (#PCDATA)>++<!--+The login-config element is used to configure the authentication+method that should be used, the realm name that should be used for+this application, and the attributes that are needed by the form login+mechanism.++Used in: web-app+-->+<!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)>++<!--+The mime-mapping element defines a mapping between an extension+and a mime type.++Used in: web-app+-->+<!ELEMENT mime-mapping (extension, mime-type)>++<!--+The mime-type element contains a defined mime type. example:+"text/plain"++Used in: mime-mapping+-->+<!ELEMENT mime-type (#PCDATA)>++<!--+The param-name element contains the name of a parameter. Each parameter+name must be unique in the web application.+++Used in: context-param, init-param+-->+<!ELEMENT param-name (#PCDATA)>++<!--+The param-value element contains the value of a parameter.++Used in: context-param, init-param+-->+<!ELEMENT param-value (#PCDATA)>++<!--+The realm name element specifies the realm name to use in HTTP+Basic authorization.++Used in: login-config+-->+<!ELEMENT realm-name (#PCDATA)>++<!--+The remote element contains the fully-qualified name of the enterprise+bean's remote interface.++Used in: ejb-ref++Example:++<remote>com.wombat.empl.EmployeeService</remote>+-->+<!ELEMENT remote (#PCDATA)>++<!--+The res-auth element specifies whether the web application code signs+on programmatically to the resource manager, or whether the Container+will sign on to the resource manager on behalf of the web application. In the+latter case, the Container uses information that is supplied by the+Deployer.++The value of this element must be one of the two following:++ <res-auth>Application</res-auth>+ <res-auth>Container</res-auth>++Used in: resource-ref+-->+<!ELEMENT res-auth (#PCDATA)>++<!--+The res-ref-name element specifies the name of a resource manager+connection factory reference. The name is a JNDI name relative to the+java:comp/env context. The name must be unique within a web application.++Used in: resource-ref+-->+<!ELEMENT res-ref-name (#PCDATA)>++<!--+The res-sharing-scope element specifies whether connections obtained+through the given resource manager connection factory reference can be+shared. The value of this element, if specified, must be one of the+two following:++ <res-sharing-scope>Shareable</res-sharing-scope>+ <res-sharing-scope>Unshareable</res-sharing-scope>++The default value is Shareable.++Used in: resource-ref+-->+<!ELEMENT res-sharing-scope (#PCDATA)>++<!--+The res-type element specifies the type of the data source. The type+is specified by the fully qualified Java language class or interface+expected to be implemented by the data source.++Used in: resource-ref+-->+<!ELEMENT res-type (#PCDATA)>++<!--+The resource-env-ref element contains a declaration of a web application's+reference to an administered object associated with a resource+in the web application's environment. It consists of an optional+description, the resource environment reference name, and an+indication of the resource environment reference type expected by+the web application code.++Used in: web-app++Example:++<resource-env-ref>+ <resource-env-ref-name>jms/StockQueue</resource-env-ref-name>+ <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>+</resource-env-ref>+-->+<!ELEMENT resource-env-ref (description?, resource-env-ref-name,+ resource-env-ref-type)>++<!--+The resource-env-ref-name element specifies the name of a resource+environment reference; its value is the environment entry name used in+the web application code. The name is a JNDI name relative to the+java:comp/env context and must be unique within a web application.++Used in: resource-env-ref+-->+<!ELEMENT resource-env-ref-name (#PCDATA)>++<!--+The resource-env-ref-type element specifies the type of a resource+environment reference. It is the fully qualified name of a Java+language class or interface.++Used in: resource-env-ref+-->+<!ELEMENT resource-env-ref-type (#PCDATA)>++<!--+The resource-ref element contains a declaration of a web application's+reference to an external resource. It consists of an optional+description, the resource manager connection factory reference name,+the indication of the resource manager connection factory type+expected by the web application code, the type of authentication+(Application or Container), and an optional specification of the+shareability of connections obtained from the resource (Shareable or+Unshareable).++Used in: web-app++Example:++ <resource-ref>+ <res-ref-name>jdbc/EmployeeAppDB</res-ref-name>+ <res-type>javax.sql.DataSource</res-type>+ <res-auth>Container</res-auth>+ <res-sharing-scope>Shareable</res-sharing-scope>+ </resource-ref>+-->+<!ELEMENT resource-ref (description?, res-ref-name, res-type, res-auth,+ res-sharing-scope?)>++<!--+The role-link element is a reference to a defined security role. The+role-link element must contain the name of one of the security roles+defined in the security-role elements.++Used in: security-role-ref+-->+<!ELEMENT role-link (#PCDATA)>++<!--+The role-name element contains the name of a security role.++The name must conform to the lexical rules for an NMTOKEN.++Used in: auth-constraint, run-as, security-role, security-role-ref+-->+<!ELEMENT role-name (#PCDATA)>++<!--+The run-as element specifies the run-as identity to be used for the+execution of the web application. It contains an optional description, and+the name of a security role.++Used in: servlet+-->+<!ELEMENT run-as (description?, role-name)>++<!--+The security-constraint element is used to associate security+constraints with one or more web resource collections++Used in: web-app+-->+<!ELEMENT security-constraint (display-name?, web-resource-collection+,+auth-constraint?, user-data-constraint?)>++<!--+The security-role element contains the definition of a security+role. The definition consists of an optional description of the+security role, and the security role name.++Used in: web-app++Example:++ <security-role>+ <description>+ This role includes all employees who are authorized+ to access the employee service application.+ </description>+ <role-name>employee</role-name>+ </security-role>+-->+<!ELEMENT security-role (description?, role-name)>++<!--+The security-role-ref element contains the declaration of a security+role reference in the web application's code. The declaration consists+of an optional description, the security role name used in the code,+and an optional link to a security role. If the security role is not+specified, the Deployer must choose an appropriate security role.++The value of the role-name element must be the String used as the+parameter to the EJBContext.isCallerInRole(String roleName) method+or the HttpServletRequest.isUserInRole(String role) method.++Used in: servlet++-->+<!ELEMENT security-role-ref (description?, role-name, role-link?)>++<!--+The servlet element contains the declarative data of a+servlet. If a jsp-file is specified and the load-on-startup element is+present, then the JSP should be precompiled and loaded.++Used in: web-app+-->+<!ELEMENT servlet (icon?, servlet-name, display-name?, description?,+(servlet-class|jsp-file), init-param*, load-on-startup?, run-as?, security-role-ref*)>++<!--+The servlet-class element contains the fully qualified class name+of the servlet.++Used in: servlet+-->+<!ELEMENT servlet-class (#PCDATA)>++<!--+The servlet-mapping element defines a mapping between a servlet+and a url pattern++Used in: web-app+-->+<!ELEMENT servlet-mapping (servlet-name, url-pattern)>++<!--+The servlet-name element contains the canonical name of the+servlet. Each servlet name is unique within the web application.++Used in: filter-mapping, servlet, servlet-mapping+-->+<!ELEMENT servlet-name (#PCDATA)>++<!--+The session-config element defines the session parameters for+this web application.++Used in: web-app+-->+<!ELEMENT session-config (session-timeout?)>++<!--+The session-timeout element defines the default session timeout+interval for all sessions created in this web application. The+specified timeout must be expressed in a whole number of minutes.+If the timeout is 0 or less, the container ensures the default+behaviour of sessions is never to time out.++Used in: session-config+-->+<!ELEMENT session-timeout (#PCDATA)>++<!--+The small-icon element contains the name of a file+containing a small (16 x 16) icon image. The file+name is a relative path within the web application's+war file.++The image may be either in the JPEG or GIF format.+The icon can be used by tools.++Used in: icon++Example:++<small-icon>employee-service-icon16x16.jpg</small-icon>+-->+<!ELEMENT small-icon (#PCDATA)>++<!--+The taglib element is used to describe a JSP tag library.++Used in: web-app+-->+<!ELEMENT taglib (taglib-uri, taglib-location)>++<!--+the taglib-location element contains the location (as a resource+relative to the root of the web application) where to find the Tag+Libary Description file for the tag library.++Used in: taglib+-->+<!ELEMENT taglib-location (#PCDATA)>++<!--+The taglib-uri element describes a URI, relative to the location+of the web.xml document, identifying a Tag Library used in the Web+Application.++Used in: taglib+-->+<!ELEMENT taglib-uri (#PCDATA)>++<!--+The transport-guarantee element specifies that the communication+between client and server should be NONE, INTEGRAL, or+CONFIDENTIAL. NONE means that the application does not require any+transport guarantees. A value of INTEGRAL means that the application+requires that the data sent between the client and server be sent in+such a way that it can't be changed in transit. CONFIDENTIAL means+that the application requires that the data be transmitted in a+fashion that prevents other entities from observing the contents of+the transmission. In most cases, the presence of the INTEGRAL or+CONFIDENTIAL flag will indicate that the use of SSL is required.++Used in: user-data-constraint+-->+<!ELEMENT transport-guarantee (#PCDATA)>++<!--+The url-pattern element contains the url pattern of the mapping. Must+follow the rules specified in Section 11.2 of the Servlet API+Specification.++Used in: filter-mapping, servlet-mapping, web-resource-collection+-->+<!ELEMENT url-pattern (#PCDATA)>++<!--+The user-data-constraint element is used to indicate how data+communicated between the client and container should be protected.++Used in: security-constraint+-->+<!ELEMENT user-data-constraint (description?, transport-guarantee)>++<!--+The web-resource-collection element is used to identify a subset+of the resources and HTTP methods on those resources within a web+application to which a security constraint applies. If no HTTP methods+are specified, then the security constraint applies to all HTTP+methods.++Used in: security-constraint+-->+<!ELEMENT web-resource-collection (web-resource-name, description?,+url-pattern*, http-method*)>++<!--+The web-resource-name contains the name of this web resource+collection.++Used in: web-resource-collection+-->+<!ELEMENT web-resource-name (#PCDATA)>++<!--+The welcome-file element contains file name to use as a default+welcome file, such as index.html++Used in: welcome-file-list+-->+<!ELEMENT welcome-file (#PCDATA)>++<!--+The welcome-file-list contains an ordered list of welcome files+elements.++Used in: web-app+-->+<!ELEMENT welcome-file-list (welcome-file+)>++<!--+The ID mechanism is to allow tools that produce additional deployment+information (i.e., information beyond the standard deployment+descriptor information) to store the non-standard information in a+separate file, and easily refer from these tool-specific files to the+information in the standard deployment descriptor.++Tools are not allowed to add the non-standard information into the+standard deployment descriptor.+-->++<!ATTLIST auth-constraint id ID #IMPLIED>+<!ATTLIST auth-method id ID #IMPLIED>+<!ATTLIST context-param id ID #IMPLIED>+<!ATTLIST description id ID #IMPLIED>+<!ATTLIST display-name id ID #IMPLIED>+<!ATTLIST distributable id ID #IMPLIED>+<!ATTLIST ejb-link id ID #IMPLIED>+<!ATTLIST ejb-local-ref id ID #IMPLIED>+<!ATTLIST ejb-ref id ID #IMPLIED>+<!ATTLIST ejb-ref-name id ID #IMPLIED>+<!ATTLIST ejb-ref-type id ID #IMPLIED>+<!ATTLIST env-entry id ID #IMPLIED>+<!ATTLIST env-entry-name id ID #IMPLIED>+<!ATTLIST env-entry-type id ID #IMPLIED>+<!ATTLIST env-entry-value id ID #IMPLIED>+<!ATTLIST error-code id ID #IMPLIED>+<!ATTLIST error-page id ID #IMPLIED>+<!ATTLIST exception-type id ID #IMPLIED>+<!ATTLIST extension id ID #IMPLIED>+<!ATTLIST filter id ID #IMPLIED>+<!ATTLIST filter-class id ID #IMPLIED>+<!ATTLIST filter-mapping id ID #IMPLIED>+<!ATTLIST filter-name id ID #IMPLIED>+<!ATTLIST form-error-page id ID #IMPLIED>+<!ATTLIST form-login-config id ID #IMPLIED>+<!ATTLIST form-login-page id ID #IMPLIED>+<!ATTLIST home id ID #IMPLIED>+<!ATTLIST http-method id ID #IMPLIED>+<!ATTLIST icon id ID #IMPLIED>+<!ATTLIST init-param id ID #IMPLIED>+<!ATTLIST jsp-file id ID #IMPLIED>+<!ATTLIST large-icon id ID #IMPLIED>+<!ATTLIST listener id ID #IMPLIED>+<!ATTLIST listener-class id ID #IMPLIED>+<!ATTLIST load-on-startup id ID #IMPLIED>+<!ATTLIST local id ID #IMPLIED>+<!ATTLIST local-home id ID #IMPLIED>+<!ATTLIST location id ID #IMPLIED>+<!ATTLIST login-config id ID #IMPLIED>+<!ATTLIST mime-mapping id ID #IMPLIED>+<!ATTLIST mime-type id ID #IMPLIED>+<!ATTLIST param-name id ID #IMPLIED>+<!ATTLIST param-value id ID #IMPLIED>+<!ATTLIST realm-name id ID #IMPLIED>+<!ATTLIST remote id ID #IMPLIED>+<!ATTLIST res-auth id ID #IMPLIED>+<!ATTLIST res-ref-name id ID #IMPLIED>+<!ATTLIST res-sharing-scope id ID #IMPLIED>+<!ATTLIST res-type id ID #IMPLIED>+<!ATTLIST resource-env-ref id ID #IMPLIED>+<!ATTLIST resource-env-ref-name id ID #IMPLIED>+<!ATTLIST resource-env-ref-type id ID #IMPLIED>+<!ATTLIST resource-ref id ID #IMPLIED>+<!ATTLIST role-link id ID #IMPLIED>+<!ATTLIST role-name id ID #IMPLIED>+<!ATTLIST run-as id ID #IMPLIED>+<!ATTLIST security-constraint id ID #IMPLIED>+<!ATTLIST security-role id ID #IMPLIED>+<!ATTLIST security-role-ref id ID #IMPLIED>+<!ATTLIST servlet id ID #IMPLIED>+<!ATTLIST servlet-class id ID #IMPLIED>+<!ATTLIST servlet-mapping id ID #IMPLIED>+<!ATTLIST servlet-name id ID #IMPLIED>+<!ATTLIST session-config id ID #IMPLIED>+<!ATTLIST session-timeout id ID #IMPLIED>+<!ATTLIST small-icon id ID #IMPLIED>+<!ATTLIST taglib id ID #IMPLIED>+<!ATTLIST taglib-location id ID #IMPLIED>+<!ATTLIST taglib-uri id ID #IMPLIED>+<!ATTLIST transport-guarantee id ID #IMPLIED>+<!ATTLIST url-pattern id ID #IMPLIED>+<!ATTLIST user-data-constraint id ID #IMPLIED>+<!ATTLIST web-app id ID #IMPLIED>+<!ATTLIST web-resource-collection id ID #IMPLIED>+<!ATTLIST web-resource-name id ID #IMPLIED>+<!ATTLIST welcome-file id ID #IMPLIED>+<!ATTLIST welcome-file-list id ID #IMPLIED>diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/anchors.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/anchors.jspnew file mode 100644index 000000000..67e0d2314--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/anchors.jsp@@ -0,0 +1,13 @@+<%@ include file="common.jsp"%>+<jsp:useBean id="nutchAnchors" scope="request"+ type="org.apache.nutch.webapp.controller.AnchorsController.AnchorsBean" />+<h3><bean:message key="anchors.page" arg0="<%=nutchAnchors.getUrl()%>" />+</h3>+<h3><bean:message key="anchors.anchors" /></h3>+<ul>+ <logic:iterate scope="request" id="anchor" name="nutchAnchors"+ property="anchors" type="String">+ <li><bean:write name="anchor" /></li>+ </logic:iterate>+</ul>+<br />diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/cached.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/cached.jspnew file mode 100644index 000000000..3aa453377--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/cached.jsp@@ -0,0 +1,67 @@+<%@ page+ session="false"+ contentType="text/html; charset=UTF-8"+ import="java.io.*"+ import="java.util.*"++ import="org.apache.nutch.searcher.*"+ import="org.apache.nutch.parse.ParseData"+ import="org.apache.nutch.metadata.Metadata"+ import="org.apache.hadoop.conf.Configuration"+ import="org.apache.nutch.util.NutchConfiguration"+%><%@ taglib prefix="bean" uri="/tags/struts-bean" %><%+ Configuration nutchConf = (Configuration) application.getAttribute(Configuration.class.getName());+ if (nutchConf == null) {+ nutchConf = NutchConfiguration.create();+ application.setAttribute(Configuration.class.getName(), nutchConf);+ }+ NutchBean bean = NutchBean.get(application, nutchConf);+ bean.LOG.info("cache request from " + request.getRemoteAddr());+ Hit hit = new Hit(Integer.parseInt(request.getParameter("idx")),+ Integer.parseInt(request.getParameter("id")));+ HitDetails details = bean.getDetails(hit);+ String id = "idx=" + hit.getIndexNo() + "&id=" + hit.getIndexDocNo();++ Metadata metaData = bean.getParseData(details).getContentMeta();++ String content = null;+ String contentType = (String) metaData.get(Metadata.CONTENT_TYPE);+ if (contentType.startsWith("text/html")) {+ // FIXME : it's better to emit the original 'byte' sequence+ // with 'charset' set to the value of 'CharEncoding',+ // but I don't know how to emit 'byte sequence' in JSP.+ // out.getOutputStream().write(bean.getContent(details)) may work,+ // but I'm not sure.+ String encoding = (String) metaData.get("CharEncodingForConversion");+ if (encoding != null) {+ try {+ content = new String(bean.getContent(details), encoding);+ }+ catch (UnsupportedEncodingException e) {+ // fallback to windows-1252+ content = new String(bean.getContent(details), "windows-1252");+ }+ }+ else+ content = new String(bean.getContent(details));+ }+%>+<base href="<%=details.getValue("url")%>">+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">+<h2 style="{color: rgb(255, 153, 0)}"><bean:message key="cached.title"/></h2>+<h3><bean:message key="cached.page" arg0="<%=details.getValue("url")%>" /></h3>+<hr>+<% if (contentType.startsWith("text/html")) {%>++<% if (content != null && !content.equals("")) {%>+<%= content %>+<% } else { %>+<bean:message key="cached.noContent"/>+<% } %>++<% } else { %>++The cached content has mime type "<%=contentType%>",+click this <a href="servlet/cached?<%=id%>">link</a> to download it directly.++<% } %>diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/common.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/common.jspnew file mode 100644index 000000000..e137d6899--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/common.jsp@@ -0,0 +1,4 @@+<%@ page session="false" %>+<%@ taglib prefix="tiles" uri="/tags/struts-tiles" %>+<%@ taglib prefix="bean" uri="/tags/struts-bean" %>+<%@ taglib prefix="logic" uri="/tags/struts-logic" %>diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/explain.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/explain.jspnew file mode 100644index 000000000..c127eadd0--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/explain.jsp@@ -0,0 +1,7 @@+<%@ include file="common.jsp" %>+<h3><bean:message key="explain.page"/></h3>+<bean:parameter id="query" name="query"/>+<bean:write name="hitDetails" filter="false"/>+<h3><bean:message arg0="<%=query%>" key="explain.scoreForQuery" />+</h3>+<bean:write name="explanation" filter="false"/>diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/footer.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/footer.jspnew file mode 100644index 000000000..15b760368--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/footer.jsp@@ -0,0 +1,10 @@+<%@ include file="common.jsp" %>+<div id="footer">+<table bgcolor="3333ff" align="right">+ <tr>+ <td bgcolor="ff9900"><a href="RSS"><font color="ffffff"><b>RSS</b> </font></a></td>+ </tr>+ </table>+ <a href="http://wiki.apache.org/nutch/FAQ"> <img border="0"+ src="img/poweredbynutch_01.gif"> </a>+ </div>diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/header.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/header.jspnew file mode 100644index 000000000..31bc0f55a--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/header.jsp@@ -0,0 +1,16 @@+<%@ include file="common.jsp"%>+<tiles:useAttribute name="title" ignore="true"+ classname="java.lang.String" />+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">+<title><bean:message key="<%=title%>" /></title>+<link rel="icon" href="img/favicon.ico" type="image/x-icon" />+<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />+<link rel="alternate" type="application/rss+xml" title="RSS"+ href="FIXME" />+<tiles:insert name="style" />+<!-- start empty javascript node for popup app fix -->+<script type="text/javascript">+ <!--+function queryfocus() { document.search.query.focus(); }+// -->+ </script>diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/i18ncontent.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/i18ncontent.jspnew file mode 100644index 000000000..6d3098423--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/i18ncontent.jsp@@ -0,0 +1,2 @@+<%@ include file="common.jsp" %>+<bean:write name="content" scope="request" filter="false"/>diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/more.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/more.jspnew file mode 100644index 000000000..3cfe2c055--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/more.jsp@@ -0,0 +1,54 @@+<%@ include file="common.jsp" %>+<jsp:useBean id="hit" scope="request" type="org.apache.nutch.webapp.SearchResultBean"/>+<%+ // @author John Xing+ // show meta info (currently type, size, date of last-modified)+ // for each hit. These info are indexed by ./src/plugin/index-more.++ // do not show unless we have something+ boolean showMore = false;++ // Content-Type+ String primaryType = hit.getDetails().getValue("primaryType");+ String subType = hit.getDetails().getValue("subType");++ String contentType = subType;+ if (contentType == null)+ contentType = primaryType;+ if (contentType != null) {+ contentType = "[<span class=\"contentType\">" + contentType + "</span>]";+ showMore = true;+ } else {+ contentType = "";+ }++ // Content-Length+ String contentLength = hit.getDetails().getValue("contentLength");+ if (contentLength != null) {+ contentLength = "(" + contentLength + " bytes)";+ showMore = true;+ } else {+ contentLength = "";+ }++ // Last-Modified+ String lastModified = hit.getDetails().getValue("lastModified");+ if (lastModified != null) {+ java.util.Calendar cal = new java.util.GregorianCalendar();+ cal.setTimeInMillis(new Long(lastModified).longValue());+ lastModified = cal.get(java.util.Calendar.YEAR)+ + "." + (1+cal.get(java.util.Calendar.MONTH)) // it is 0-based+ + "." + cal.get(java.util.Calendar.DAY_OF_MONTH);+ showMore = true;+ } else {+ lastModified = "";+ }+%>++<% if (showMore) {+ if ("text".equalsIgnoreCase(primaryType)) { %>+ <br><font size=-1><nobr><%=contentType%> <%=contentLength%> <%=lastModified%></nobr></font>+<% } else { %>+ <br><font size=-1><nobr><%=contentType%> <%=contentLength%> <%=lastModified%> - <a href="../text.jsp?<jsp:getProperty name="hit" property="id"/>"><i18n:message key="viewAsText"/></a></nobr></font>+<% }+ } %>diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/navigate.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/navigate.jspnew file mode 100644index 000000000..8ebefdd16--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/navigate.jsp@@ -0,0 +1,14 @@+<div id="navigation">+<%@ include file="common.jsp"%>+<logic:equal name="nutchSearch" property="hasNextPage" value="true">+ <form name="search" action="search.do" method="get"><input+ type="submit" value="<bean:message key="search.next"/>"> <logic:iterate+ scope="request" id="urlParameter" name="nutchSearch"+ property="formProperties"+ type="org.apache.nutch.webapp.common.SearchForm.KeyValue">+ <input type="hidden"+ name="<bean:write name="urlParameter" property="key"/>"+ value="<bean:write name="urlParameter" property="value"/>" />+ </logic:iterate></form>+</logic:equal>+</div>\ No newline at end of filediff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/noResults.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/noResults.jspnew file mode 100644index 000000000..3920db62c--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/noResults.jsp@@ -0,0 +1,5 @@+<div id="noResults"><%@ include file="common.jsp"%> <jsp:useBean+ id="nutchSearch" scope="request"+ type="org.apache.nutch.webapp.common.Search" /> <bean:message+ key="search.noResults" arg0="<%= nutchSearch.getHtmlQueryString()%>" />+</div>diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/results.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/results.jspnew file mode 100644index 000000000..82d7043fd--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/results.jsp@@ -0,0 +1,17 @@+<%@ include file="common.jsp" %>+<logic:iterate scope="request" id="hit" name="nutchSearch" property="results" type="org.apache.nutch.webapp.common.SearchResultBean">+ <b><a href="<bean:write name="hit" property="url"/>"><bean:write name="hit" property="title"/></a></b><br/>+ <tiles:insert name="more" flush="false" beanName="hit"/>+ <bean:write name="hit" property="summary" filter="false"/>+ <br>+ <span class="url"><bean:write name="hit" property="encodedUrl"/></span>+ (<a href="cached.do?<bean:write name="hit" property="id"/>"><bean:message key="search.cached"/></a>)+ (<a href="explain.do?<bean:write name="hit" property="id"/>&query=<bean:write name="hit" property="urlEncodedQuery"/>"><bean:message key="search.explain"/></a>)+ (<a href="anchors.do?<bean:write name="hit" property="id"/>"><bean:message key="search.anchors"/></a>)+<logic:equal name="hit" property="hasMore" value="true">+ (<a href="search.do?<bean:write name="hit" property="moreUrl"/>"><bean:message key="search.moreFrom"/>+ <bean:write name="hit" property="dedupValue"/></a>)+</logic:equal>+<br/><br/>+</logic:iterate>+</div>diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jspnew file mode 100644index 000000000..c422cf3ae--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp@@ -0,0 +1,28 @@+<%@ include file="common.jsp"%>+<logic:match name="nutchSearch" property="isSearch" value="false">+ <jsp:useBean id="resultInfo" scope="request" type="String[]" />+ <form name="search" action="search.do" method="get"><input name="query"+ size=44+ value="<bean:write name="nutchSearch" property="queryString"/>"> <input+ type="hidden" name="hitsPerPage"+ value="<bean:write name="nutchSearch" property="hitsPerPage"/>"> <input+ type="submit" value="<bean:message key="search.search" />"> <a+ href="help.do"><bean:message key="search.help" /></a></form>+ <logic:match name="nutchSearch" property="hasResults" value="true">+ <bean:message key="search.hits" arg0="<%=resultInfo[0]%>"+ arg1="<%=resultInfo[1]%>" arg2="<%=resultInfo[2]%>"+ arg3="<%=resultInfo[3]%>" />+ <br />+ <tiles:insert name="results" />+ <tiles:insert name="cluster" />+ <tiles:insert name="navigate" />+ </logic:match>+ <logic:notMatch name="nutchSearch" property="hasResults" value="true">+ <tiles:insert name="noResults" />+ </logic:notMatch>+</logic:match>+<logic:notMatch name="nutchSearch" property="isSearch" value="false">+ <tiles:insert name="i18nComponent">+ <tiles:put name="basePage" value="/search.html" />+ </tiles:insert>+</logic:notMatch>diff --git a/contrib/web2/src/main/webapp/WEB-INF/jsp/template.jsp b/contrib/web2/src/main/webapp/WEB-INF/jsp/template.jspnew file mode 100644index 000000000..d75c1df3c--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/jsp/template.jsp@@ -0,0 +1,17 @@+<%@page contentType="text/html; charset=utf-8" session="false"%>+<%@ include file="common.jsp"%>+<html lang="<bean:message key="lang"/>">+<head>+<tiles:insert name="header">+ <tiles:put name="title" beanName="title" />+ <tiles:put name="basePage" content="/include/header.html" />+ <tiles:put name="attrName" content="header" />+</tiles:insert>+</head>+ <body onLoad="queryfocus();">+ <bean:write name="header" scope="request" filter="false" ignore="true"/>+<tiles:insert name="pageBody" />+<tiles:insert name="footer" />+ </body>+</html>+diff --git a/contrib/web2/src/main/webapp/WEB-INF/res/style.css b/contrib/web2/src/main/webapp/WEB-INF/res/style.cssnew file mode 100644index 000000000..cb79fbe86--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/res/style.css@@ -0,0 +1,14 @@+.menuTd {background-color: #F9F7F4; height: 25; onMouseOver: this.style.backgroundColor='#ECE5DC';}+.menuTdhover {background-color: #ECE5DC; height: 25; onMouseOver: this.style.backgroundColor='#ECE5DC';}+.menuEntry { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; text-decoration: none}+.body {background-color: #F9F7F4;}+.bodytext { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; text-decoration: none}+.title { font-family: Arial, Helvetica, sans-serif; font-size: 26px; color: #FF9900; text-decoration: none}+.intro { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #FF9900; text-decoration: none}+.orangeTd {background-color: #FF9900}+ul {list-style-image: url(../img/reiter/ul.gif)}+h3 {font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000000;}+h4 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #000000;}+.url {color: #996600;}+.highlight {font-weight: bold;}+.ellipsis {font-weight: bold;}diff --git a/contrib/web2/src/main/webapp/WEB-INF/struts-config.xml b/contrib/web2/src/main/webapp/WEB-INF/struts-config.xmlnew file mode 100644index 000000000..e3bbaf699--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/struts-config.xml@@ -0,0 +1,26 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE struts-config PUBLIC+ "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"+ "dtd/struts-config_1_2.dtd">+<struts-config>+ <form-beans />+ <!-- =================================== Action Mapping Definitions -->+ <action-mappings>+ <action path="/*" type="org.apache.struts.actions.ForwardAction"+ parameter="{1}Page" />+ </action-mappings>+ <!-- ===================================== Controller Configuration -->+ <!-- Own request processor required because the default one creates a new+ session - a thing we really don't want -->+ <controller+ processorClass="org.apache.nutch.webapp.tiles.NutchRequestProcessor" />+ <!-- ================================ Message Resources Definitions -->+ <message-resources parameter="org.nutch.jsp.resources" null="false" />+ <plug-in className="org.apache.struts.tiles.TilesPlugin">+ <set-property property="definitions-config"+ value="/WEB-INF/tiles-defs.xml" />+ <set-property property="moduleAware" value="true" />+ <set-property property="definitions-parser-validate"+ value="false" />+ </plug-in>+</struts-config>diff --git a/contrib/web2/src/main/webapp/WEB-INF/tiles-defs.xml b/contrib/web2/src/main/webapp/WEB-INF/tiles-defs.xmlnew file mode 100644index 000000000..06f0b345c--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/tiles-defs.xml@@ -0,0 +1,69 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN" "dtd/tiles-config_1_1.dtd">+<tiles-definitions>+ <definition name=".configurable">+ <put name="style" value="/include/style.html" />+ </definition>+ <definition name=".layout" extends=".configurable"+ path="/WEB-INF/jsp/template.jsp">+ <put name="title" value="title" />+ <put name="header" value=".header" />+ <put name="footer" value="/WEB-INF/jsp/footer.jsp" />+ </definition>+ <!-- Search page -->+ <definition name="searchPage" extends=".layout"+ controllerClass="org.apache.nutch.webapp.controller.SearchController">+ <put name="title" value="search.title" />+ <put name="pageBody" value="/WEB-INF/jsp/search.jsp" />+ </definition>+ <!-- Cached -->+ <definition name="cachedPage" path="/WEB-INF/jsp/cached.jsp">+ <put name="title" value="cached.title" />+ </definition>+ <!-- Explain -->+ <definition name="explainPage" extends=".layout"+ controllerClass="org.apache.nutch.webapp.controller.ExplainController">+ <put name="pageBody" value="/WEB-INF/jsp/explain.jsp" />+ <put name="title" value="explain.title" />+ </definition>+ <!-- Anchors -->+ <definition name="anchorsPage" extends=".layout"+ controllerClass="org.apache.nutch.webapp.controller.AnchorsController">+ <put name="pageBody" value="/WEB-INF/jsp/anchors.jsp" />+ <put name="title" value="anchors.title" />+ </definition>+ <!-- Tile that displays the search results -->+ <definition name="results" path="/WEB-INF/jsp/results.jsp">+ </definition>+ <definition name="more" path="/WEB-INF/jsp/more.jsp" />+ <!-- Tile that displays the search result navigation -->+ <definition name="navigate" path="/WEB-INF/jsp/navigate.jsp" />+ <definition name=".header" extends=".configurable"+ path="/WEB-INF/jsp/header.jsp"+ controllerClass="org.apache.nutch.webapp.controller.I18NPageController" />+ <definition name="localizedPage" extends=".layout"+ controllerClass="org.apache.nutch.webapp.controller.I18NPageController">+ <put name="pageBody" value="/WEB-INF/jsp/i18ncontent.jsp" />+ </definition>+ <!-- Help -->+ <definition name="helpPage" extends="localizedPage">+ <put name="basePage" value="/help.html" />+ </definition>+ <!-- About -->+ <definition name="aboutPage" extends="localizedPage">+ <put name="basePage" value="/about.html" />+ </definition>+ <!-- Front page -->+ <definition name="frontPage" extends="localizedPage">+ <put name="basePage" value="/search.html" />+ </definition>++ <!-- No Results -->+ <definition name="noResults" path="/WEB-INF/jsp/noResults.jsp"/>++ <!-- i18n component -->+ <definition name="i18nComponent" path="/WEB-INF/jsp/i18ncontent.jsp"+ controllerClass="org.apache.nutch.webapp.controller.I18NPageController">+ </definition>++</tiles-definitions>\ No newline at end of filediff --git a/contrib/web2/src/main/webapp/WEB-INF/tld/struts-bean.tld b/contrib/web2/src/main/webapp/WEB-INF/tld/struts-bean.tldnew file mode 100644index 000000000..5fe94bd35--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/tld/struts-bean.tld@@ -0,0 +1,382 @@+<?xml version="1.0" encoding="UTF-8"?>++++++++<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">+<taglib>+<tlibversion>1.2</tlibversion>+<jspversion>1.1</jspversion>+<shortname>bean</shortname>+<uri>http://struts.apache.org/tags-bean</uri>+<tag>+<name>cookie</name>+<tagclass>org.apache.struts.taglib.bean.CookieTag</tagclass>+<teiclass>org.apache.struts.taglib.bean.CookieTei</teiclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>id</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>multiple</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>define</name>+<tagclass>org.apache.struts.taglib.bean.DefineTag</tagclass>+<teiclass>org.apache.struts.taglib.bean.DefineTei</teiclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>id</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>toScope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>type</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>header</name>+<tagclass>org.apache.struts.taglib.bean.HeaderTag</tagclass>+<teiclass>org.apache.struts.taglib.bean.HeaderTei</teiclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>id</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>multiple</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>include</name>+<tagclass>org.apache.struts.taglib.bean.IncludeTag</tagclass>+<teiclass>org.apache.struts.taglib.bean.IncludeTei</teiclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>anchor</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>forward</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>href</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>id</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>page</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>transaction</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>message</name>+<tagclass>org.apache.struts.taglib.bean.MessageTag</tagclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>arg0</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>arg1</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>arg2</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>arg3</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>arg4</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>bundle</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>key</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>locale</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>page</name>+<tagclass>org.apache.struts.taglib.bean.PageTag</tagclass>+<teiclass>org.apache.struts.taglib.bean.PageTei</teiclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>id</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>parameter</name>+<tagclass>org.apache.struts.taglib.bean.ParameterTag</tagclass>+<teiclass>org.apache.struts.taglib.bean.ParameterTei</teiclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>id</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>multiple</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>resource</name>+<tagclass>org.apache.struts.taglib.bean.ResourceTag</tagclass>+<teiclass>org.apache.struts.taglib.bean.ResourceTei</teiclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>id</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>input</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>size</name>+<tagclass>org.apache.struts.taglib.bean.SizeTag</tagclass>+<teiclass>org.apache.struts.taglib.bean.SizeTei</teiclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>collection</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>id</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>struts</name>+<tagclass>org.apache.struts.taglib.bean.StrutsTag</tagclass>+<teiclass>org.apache.struts.taglib.bean.StrutsTei</teiclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>id</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>formBean</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>forward</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>mapping</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>write</name>+<tagclass>org.apache.struts.taglib.bean.WriteTag</tagclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>bundle</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>filter</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>format</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>formatKey</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>ignore</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>locale</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+</taglib>+++diff --git a/contrib/web2/src/main/webapp/WEB-INF/tld/struts-logic.tld b/contrib/web2/src/main/webapp/WEB-INF/tld/struts-logic.tldnew file mode 100644index 000000000..f92086807--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/tld/struts-logic.tld@@ -0,0 +1,652 @@+<?xml version="1.0" encoding="UTF-8"?>+++++++<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">+<taglib>+<tlibversion>1.2</tlibversion>+<jspversion>1.1</jspversion>+<shortname>logic</shortname>+<uri>http://struts.apache.org/tags-logic</uri>+<tag>+<name>empty</name>+<tagclass>org.apache.struts.taglib.logic.EmptyTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>equal</name>+<tagclass>org.apache.struts.taglib.logic.EqualTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>cookie</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>header</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>parameter</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>forward</name>+<tagclass>org.apache.struts.taglib.logic.ForwardTag</tagclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>name</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>greaterEqual</name>+<tagclass>org.apache.struts.taglib.logic.GreaterEqualTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>cookie</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>header</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>parameter</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>greaterThan</name>+<tagclass>org.apache.struts.taglib.logic.GreaterThanTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>cookie</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>header</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>parameter</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>iterate</name>+<tagclass>org.apache.struts.taglib.logic.IterateTag</tagclass>+<teiclass>org.apache.struts.taglib.logic.IterateTei</teiclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>collection</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>id</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>indexId</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>length</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>offset</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>type</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>lessEqual</name>+<tagclass>org.apache.struts.taglib.logic.LessEqualTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>cookie</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>header</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>parameter</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>lessThan</name>+<tagclass>org.apache.struts.taglib.logic.LessThanTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>cookie</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>header</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>parameter</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>match</name>+<tagclass>org.apache.struts.taglib.logic.MatchTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>cookie</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>header</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>location</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>parameter</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>messagesNotPresent</name>+<tagclass>org.apache.struts.taglib.logic.MessagesNotPresentTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>message</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>messagesPresent</name>+<tagclass>org.apache.struts.taglib.logic.MessagesPresentTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>message</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>notEmpty</name>+<tagclass>org.apache.struts.taglib.logic.NotEmptyTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>notEqual</name>+<tagclass>org.apache.struts.taglib.logic.NotEqualTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>cookie</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>header</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>parameter</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>notMatch</name>+<tagclass>org.apache.struts.taglib.logic.NotMatchTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>cookie</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>header</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>location</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>parameter</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>notPresent</name>+<tagclass>org.apache.struts.taglib.logic.NotPresentTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>cookie</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>header</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>parameter</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>role</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>user</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>present</name>+<tagclass>org.apache.struts.taglib.logic.PresentTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>cookie</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>header</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>parameter</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>role</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>user</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>redirect</name>+<tagclass>org.apache.struts.taglib.logic.RedirectTag</tagclass>+<attribute>+<name>action</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>anchor</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>forward</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>href</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>page</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>paramId</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>paramName</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>paramProperty</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>paramScope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>property</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>transaction</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>useLocalEncoding</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+</taglib>+++diff --git a/contrib/web2/src/main/webapp/WEB-INF/tld/struts-tiles.tld b/contrib/web2/src/main/webapp/WEB-INF/tld/struts-tiles.tldnew file mode 100644index 000000000..657334ea9--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/tld/struts-tiles.tld@@ -0,0 +1,344 @@+<?xml version="1.0" encoding="UTF-8"?>++++++++<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">+<taglib>+<tlibversion>1.2</tlibversion>+<jspversion>1.1</jspversion>+<shortname>tiles</shortname>+<uri>http://struts.apache.org/tags-tiles</uri>+<tag>+<name>insert</name>+<tagclass>org.apache.struts.taglib.tiles.InsertTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>template</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>component</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>page</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>definition</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>attribute</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>beanName</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>beanProperty</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>beanScope</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>flush</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>ignore</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>role</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>controllerUrl</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>controllerClass</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>definition</name>+<tagclass>org.apache.struts.taglib.tiles.DefinitionTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>id</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>template</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>page</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>role</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>extends</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>put</name>+<tagclass>org.apache.struts.taglib.tiles.PutTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>value</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>content</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>direct</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>type</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>beanName</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>beanProperty</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>beanScope</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>role</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>putList</name>+<tagclass>org.apache.struts.taglib.tiles.PutListTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>name</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+</tag>+<tag>+<name>add</name>+<tagclass>org.apache.struts.taglib.tiles.AddTag</tagclass>+<bodycontent>JSP</bodycontent>+<attribute>+<name>value</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>content</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>direct</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>type</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>beanName</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>beanProperty</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>beanScope</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>role</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>get</name>+<tagclass>org.apache.struts.taglib.tiles.GetTag</tagclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>name</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>ignore</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>flush</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>role</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>getAsString</name>+<tagclass>org.apache.struts.taglib.tiles.GetAttributeTag</tagclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>name</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>ignore</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>role</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>useAttribute</name>+<tagclass>org.apache.struts.taglib.tiles.UseAttributeTag</tagclass>+<teiclass>org.apache.struts.taglib.tiles.UseAttributeTei</teiclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>id</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>classname</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>name</name>+<required>true</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>ignore</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>importAttribute</name>+<tagclass>org.apache.struts.taglib.tiles.ImportAttributeTag</tagclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>name</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+<attribute>+<name>scope</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>ignore</name>+<required>false</required>+<rtexprvalue>true</rtexprvalue>+</attribute>+</tag>+<tag>+<name>initComponentDefinitions</name>+<tagclass>org.apache.struts.taglib.tiles.InitDefinitionsTag</tagclass>+<bodycontent>empty</bodycontent>+<attribute>+<name>file</name>+<required>true</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+<attribute>+<name>classname</name>+<required>false</required>+<rtexprvalue>false</rtexprvalue>+</attribute>+</tag>+</taglib>+++diff --git a/contrib/web2/src/main/webapp/WEB-INF/web.xml b/contrib/web2/src/main/webapp/WEB-INF/web.xmlnew file mode 100755index 000000000..5aed524aa--- /dev/null+++ b/contrib/web2/src/main/webapp/WEB-INF/web.xml@@ -0,0 +1,68 @@+<?xml version="1.0" encoding="ISO-8859-1"?>+<!DOCTYPE web-app+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"+ "dtd/web-app_2_3.dtd">+<web-app>+ <context-param>+ <param-name>+ javax.servlet.jsp.jstl.fmt.localizationContext+ </param-name>+ <param-value>ApplicationResources</param-value>+ </context-param>+ <servlet>+ <servlet-name>action</servlet-name>+ <servlet-class>+ org.apache.struts.action.ActionServlet+ </servlet-class>+ <init-param>+ <param-name>config</param-name>+ <param-value>/WEB-INF/struts-config.xml</param-value>+ </init-param>+ <init-param>+ <param-name>factoryClassname</param-name>+ <param-value>+ org.apache.nutch.webapp.tiles.ExtendableDefinitionsFactory+ </param-value>+ </init-param>+ <load-on-startup>2</load-on-startup>+ </servlet>+ <servlet>+ <servlet-name>Cached</servlet-name>+ <servlet-class>+ org.apache.nutch.webapp.servlet.CachedServlet+ </servlet-class>+ </servlet>+ <servlet>+ <servlet-name>OpenSearch</servlet-name>+ <servlet-class>+ org.apache.nutch.webapp.servlet.OpenSearchServlet+ </servlet-class>+ </servlet>+ <servlet-mapping>+ <servlet-name>Cached</servlet-name>+ <url-pattern>/servlet/cached</url-pattern>+ </servlet-mapping>+ <servlet-mapping>+ <servlet-name>OpenSearch</servlet-name>+ <url-pattern>/opensearch</url-pattern>+ </servlet-mapping>+ <servlet-mapping>+ <servlet-name>action</servlet-name>+ <url-pattern>*.do</url-pattern>+ </servlet-mapping>+ <welcome-file-list>+ <welcome-file>index.jsp</welcome-file>+ </welcome-file-list>+ <taglib>+ <taglib-uri>/tags/struts-logic</taglib-uri>+ <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>+ </taglib>+ <taglib>+ <taglib-uri>/tags/struts-tiles</taglib-uri>+ <taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>+ </taglib>+ <taglib>+ <taglib-uri>/tags/struts-bean</taglib-uri>+ <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>+ </taglib>+</web-app>diff --git a/contrib/web2/src/main/webapp/index.jsp b/contrib/web2/src/main/webapp/index.jspnew file mode 100644index 000000000..db9ab25d6--- /dev/null+++ b/contrib/web2/src/main/webapp/index.jsp@@ -0,0 +1,5 @@+<%@ page+ session="false"+%><%+ response.sendRedirect("search.do");+%>