diff --git a/google-taglib/.cvsignore b/.gitignore
similarity index 51%
rename from google-taglib/.cvsignore
rename to .gitignore
index 7b3e786..ec05815 100644
--- a/google-taglib/.cvsignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
build
dist
javadoc
+tlddoc
*.bat
-key.txt
\ No newline at end of file
+key.txt
+ChangeLog
\ No newline at end of file
diff --git a/CHANGES.txt b/CHANGES.txt
new file mode 100644
index 0000000..34e1fab
--- /dev/null
+++ b/CHANGES.txt
@@ -0,0 +1,15 @@
+Version 1.0.1 (released 20-Oct-2003)
+ * Added a "type" attribute to the Search tag.
+ - It can be used to specify the type of documents (e.g.: pdf) to be
+ searched.
+ * Changed the behavior of the SearchQuery Tag.
+ - By default only the specified search keywords (or phrase) are
+ returned. To return the full query (including preset site and
+ file type options) the "type" attribute should be set to "full".
+
+Version 1.0 (released 10-Oct-2003)
+ * This is the first public release.
+ * Added support for various HTTP Proxy configuration context parameters.
+
+===========================================================================
+$Id$
\ No newline at end of file
diff --git a/CVSROOT/checkoutlist b/CVSROOT/checkoutlist
deleted file mode 100644
index b04b350..0000000
--- a/CVSROOT/checkoutlist
+++ /dev/null
@@ -1,13 +0,0 @@
-# The "checkoutlist" file is used to support additional version controlled
-# administrative files in $CVSROOT/CVSROOT, such as template files.
-#
-# The first entry on a line is a filename which will be checked out from
-# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
-# The remainder of the line is an error message to use if the file cannot
-# be checked out.
-#
-# File format:
-#
-# []
-#
-# comment lines begin with '#'
diff --git a/CVSROOT/commitinfo b/CVSROOT/commitinfo
deleted file mode 100644
index b19e7b7..0000000
--- a/CVSROOT/commitinfo
+++ /dev/null
@@ -1,15 +0,0 @@
-# The "commitinfo" file is used to control pre-commit checks.
-# The filter on the right is invoked with the repository and a list
-# of files to check. A non-zero exit of the filter program will
-# cause the commit to be aborted.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being committed to, relative
-# to the $CVSROOT. For the first match that is found, then the remainder
-# of the line is the name of the filter to run.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/config b/CVSROOT/config
deleted file mode 100644
index ff43ec0..0000000
--- a/CVSROOT/config
+++ /dev/null
@@ -1,14 +0,0 @@
-# Set this to "no" if pserver shouldn't check system users/passwords
-#SystemAuth=no
-
-# Put CVS lock files in this directory rather than directly in the repository.
-#LockDir=/var/lock/cvs
-
-# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
-# level of the new working directory when using the `cvs checkout'
-# command.
-#TopLevelAdmin=no
-
-# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the
-# history file, or a subset as needed (ie `TMAR' logs all write operations)
-#LogHistory=TOFEWGCMAR
diff --git a/CVSROOT/cvswrappers b/CVSROOT/cvswrappers
deleted file mode 100644
index 0accaf1..0000000
--- a/CVSROOT/cvswrappers
+++ /dev/null
@@ -1,23 +0,0 @@
-# This file affects handling of files based on their names.
-#
-# The -t/-f options allow one to treat directories of files
-# as a single file, or to transform a file in other ways on
-# its way in and out of CVS.
-#
-# The -m option specifies whether CVS attempts to merge files.
-#
-# The -k option specifies keyword expansion (e.g. -kb for binary).
-#
-# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
-#
-# wildcard [option value][option value]...
-#
-# where option is one of
-# -f from cvs filter value: path to filter
-# -t to cvs filter value: path to filter
-# -m update methodology value: MERGE or COPY
-# -k expansion mode value: b, o, kkv, &c
-#
-# and value is a single-quote delimited value.
-# For example:
-#*.gif -k 'b'
diff --git a/CVSROOT/editinfo b/CVSROOT/editinfo
deleted file mode 100644
index d78886c..0000000
--- a/CVSROOT/editinfo
+++ /dev/null
@@ -1,21 +0,0 @@
-# The "editinfo" file is used to allow verification of logging
-# information. It works best when a template (as specified in the
-# rcsinfo file) is provided for the logging procedure. Given a
-# template with locations for, a bug-id number, a list of people who
-# reviewed the code before it can be checked in, and an external
-# process to catalog the differences that were code reviewed, the
-# following test can be applied to the code:
-#
-# Making sure that the entered bug-id number is correct.
-# Validating that the code that was reviewed is indeed the code being
-# checked in (using the bug-id number or a seperate review
-# number to identify this particular code set.).
-#
-# If any of the above test failed, then the commit would be aborted.
-#
-# Actions such as mailing a copy of the report to each reviewer are
-# better handled by an entry in the loginfo file.
-#
-# One thing that should be noted is the the ALL keyword is not
-# supported. There can be only one entry that matches a given
-# repository.
diff --git a/CVSROOT/loginfo b/CVSROOT/loginfo
deleted file mode 100644
index 5a59f0a..0000000
--- a/CVSROOT/loginfo
+++ /dev/null
@@ -1,26 +0,0 @@
-# The "loginfo" file controls where "cvs commit" log information
-# is sent. The first entry on a line is a regular expression which must match
-# the directory that the change is being made to, relative to the
-# $CVSROOT. If a match is found, then the remainder of the line is a filter
-# program that should expect log information on its standard input.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name ALL appears as a regular expression it is always used
-# in addition to the first matching regex or DEFAULT.
-#
-# You may specify a format string as part of the
-# filter. The string is composed of a `%' followed
-# by a single format character, or followed by a set of format
-# characters surrounded by `{' and `}' as separators. The format
-# characters are:
-#
-# s = file name
-# V = old version number (pre-checkin)
-# v = new version number (post-checkin)
-#
-# For example:
-#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
-# or
-#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
diff --git a/CVSROOT/modules b/CVSROOT/modules
deleted file mode 100644
index cb9e9ef..0000000
--- a/CVSROOT/modules
+++ /dev/null
@@ -1,26 +0,0 @@
-# Three different line formats are valid:
-# key -a aliases...
-# key [options] directory
-# key [options] directory files...
-#
-# Where "options" are composed of:
-# -i prog Run "prog" on "cvs commit" from top-level of module.
-# -o prog Run "prog" on "cvs checkout" of module.
-# -e prog Run "prog" on "cvs export" of module.
-# -t prog Run "prog" on "cvs rtag" of module.
-# -u prog Run "prog" on "cvs update" of module.
-# -d dir Place module in directory "dir" instead of module name.
-# -l Top-level directory only -- do not recurse.
-#
-# NOTE: If you change any of the "Run" options above, you'll have to
-# release and re-checkout any working directories of these modules.
-#
-# And "directory" is a path to a directory relative to $CVSROOT.
-#
-# The "-a" option specifies an alias. An alias is interpreted as if
-# everything on the right of the "-a" had been typed on the command line.
-#
-# You can encode a module within a module by using the special '&'
-# character to interpose another module into the current module. This
-# can be useful for creating a module that consists of many directories
-# spread out over the entire source repository.
diff --git a/CVSROOT/notify b/CVSROOT/notify
deleted file mode 100644
index 34f0bc2..0000000
--- a/CVSROOT/notify
+++ /dev/null
@@ -1,12 +0,0 @@
-# The "notify" file controls where notifications from watches set by
-# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
-# a regular expression which is tested against the directory that the
-# change is being made to, relative to the $CVSROOT. If it matches,
-# then the remainder of the line is a filter program that should contain
-# one occurrence of %s for the user to notify, and information on its
-# standard input.
-#
-# "ALL" or "DEFAULT" can be used in place of the regular expression.
-#
-# For example:
-#ALL mail %s -s "CVS notification"
diff --git a/CVSROOT/rcsinfo b/CVSROOT/rcsinfo
deleted file mode 100644
index 49e59f4..0000000
--- a/CVSROOT/rcsinfo
+++ /dev/null
@@ -1,13 +0,0 @@
-# The "rcsinfo" file is used to control templates with which the editor
-# is invoked on commit and import.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being made to, relative to the
-# $CVSROOT. For the first match that is found, then the remainder of the
-# line is the name of the file that contains the template.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/taginfo b/CVSROOT/taginfo
deleted file mode 100644
index 274a46d..0000000
--- a/CVSROOT/taginfo
+++ /dev/null
@@ -1,20 +0,0 @@
-# The "taginfo" file is used to control pre-tag checks.
-# The filter on the right is invoked with the following arguments:
-#
-# $1 -- tagname
-# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
-# $3 -- repository
-# $4-> file revision [file revision ...]
-#
-# A non-zero exit of the filter program will cause the tag to be aborted.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being committed to, relative
-# to the $CVSROOT. For the first match that is found, then the remainder
-# of the line is the name of the filter to run.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/verifymsg b/CVSROOT/verifymsg
deleted file mode 100644
index 86f747c..0000000
--- a/CVSROOT/verifymsg
+++ /dev/null
@@ -1,21 +0,0 @@
-# The "verifymsg" file is used to allow verification of logging
-# information. It works best when a template (as specified in the
-# rcsinfo file) is provided for the logging procedure. Given a
-# template with locations for, a bug-id number, a list of people who
-# reviewed the code before it can be checked in, and an external
-# process to catalog the differences that were code reviewed, the
-# following test can be applied to the code:
-#
-# Making sure that the entered bug-id number is correct.
-# Validating that the code that was reviewed is indeed the code being
-# checked in (using the bug-id number or a seperate review
-# number to identify this particular code set.).
-#
-# If any of the above test failed, then the commit would be aborted.
-#
-# Actions such as mailing a copy of the report to each reviewer are
-# better handled by an entry in the loginfo file.
-#
-# One thing that should be noted is the the ALL keyword is not
-# supported. There can be only one entry that matches a given
-# repository.
diff --git a/google-taglib/GoogleTagLib.iml b/GoogleTagLib.iml
similarity index 95%
rename from google-taglib/GoogleTagLib.iml
rename to GoogleTagLib.iml
index c800be7..403273c 100644
--- a/google-taglib/GoogleTagLib.iml
+++ b/GoogleTagLib.iml
@@ -1,7 +1,7 @@
-
+
diff --git a/google-taglib/GoogleTagLib.ipr b/GoogleTagLib.ipr
similarity index 94%
rename from google-taglib/GoogleTagLib.ipr
rename to GoogleTagLib.ipr
index 33924de..ae1813a 100644
--- a/google-taglib/GoogleTagLib.ipr
+++ b/GoogleTagLib.ipr
@@ -7,7 +7,7 @@
-
+
@@ -80,15 +80,15 @@
+
+
+
-
-
-
diff --git a/google-taglib/GoogleTagLib.iws b/GoogleTagLib.iws
similarity index 84%
rename from google-taglib/GoogleTagLib.iws
rename to GoogleTagLib.iws
index a985d52..9123839 100644
--- a/google-taglib/GoogleTagLib.iws
+++ b/GoogleTagLib.iws
@@ -16,6 +16,7 @@
+
@@ -24,19 +25,20 @@
-
-
+
+
-
-
+
+
+
-
+
@@ -62,18 +64,11 @@
-
+
-
-
-
-
-
-
-
-
+
@@ -99,19 +94,115 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -125,93 +216,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -329,6 +334,9 @@
5050false
+
+
+
@@ -403,6 +411,13 @@
+
+
+
+
+
+
+
@@ -443,13 +458,8 @@
-
-
-
-
-
-
-
+
+
diff --git a/README-BUILD.txt b/README-BUILD.txt
new file mode 100644
index 0000000..024d337
--- /dev/null
+++ b/README-BUILD.txt
@@ -0,0 +1,64 @@
+Google Tag Library README (BUILD)
+=================================
+
+
+Overview
+========
+
+This README file describes the Google Tag Library source distribution.
+
+With the Google JSP Tag Library, developers and designers can easily
+incorporate Google queries, search results, cached pages and spelling
+suggestions into any web site or application.
+
+For more information about using the custom tag library in your own web
+applications, point your browser to:
+
+ http://google-taglib.sourceforge.net/
+
+See the "LICENSE.txt" file for licensing details.
+
+The Google Tag Library uses the Google Web APIs, but is not associated with
+or sponsored by Google, Inc.
+
+Google Web APIs
+===============
+
+The Google Web APIs Java library is required in order to build the Google
+Tag Library. The library's JAR file (googleapi.jar) should be placed into
+the lib directory.
+
+ http://www.google.com/apis/download.html
+
+
+Building the Source
+===================
+
+The Google Tag Library is built using Ant.
+
+ http://ant.apache.org/
+
+
+To build the JAR, to do the following:
+
+ ant
+
+To build the TLDs, do the following:
+
+ ant tlds
+
+To build the release archives, do the following:
+
+ ant release
+
+To build the Examples WAR, do the following:
+
+ ant examples
+
+To list all available build targets, do the following:
+
+ ant -projecthelp
+
+
+===========================================================================
+$Id$
\ No newline at end of file
diff --git a/google-taglib/README.txt b/README.txt
similarity index 100%
rename from google-taglib/README.txt
rename to README.txt
diff --git a/google-taglib/build.properties b/build.properties
similarity index 53%
rename from google-taglib/build.properties
rename to build.properties
index ae81e9c..42ebc67 100644
--- a/google-taglib/build.properties
+++ b/build.properties
@@ -1,5 +1,5 @@
# Version
-version=1.0
+version=1.0.1
# Project
project.name=google
@@ -12,13 +12,28 @@ dist.dir=dist
lib.dir=lib
tlds.dir=tlds
licenses.dir=licenses
-war.dir=${project.name}-examples
+
+# Examples
+ex.dir=${project.name}-examples
+
+# Source
+src.excludes=${lib.dir}/googleapi.jar
+
+# TagUnit
+unit.lib=tagunit.jar
+unit.dir=${project.name}-tagunit
# Javadoc
javadoc.dir=javadoc
javadoc.title=Google Tag Library
javadoc.packages=net.thauvin.google.*
+# TLDDoc
+tlddoc.dir=tlddoc
+
# Docs
+doc.dir=htdocs
doc.license=LICENSE.txt
-doc.readme=README.txt
\ No newline at end of file
+doc.readme=README.txt
+doc.src=README-BUILD.txt
+doc.changes=CHANGES.txt
\ No newline at end of file
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..dca0cc0
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,181 @@
+
+
+ Google Tag Library
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/google-taglib/google-examples/README.txt b/google-examples/README.txt
similarity index 100%
rename from google-taglib/google-examples/README.txt
rename to google-examples/README.txt
diff --git a/google-examples/WEB-INF/web.xml b/google-examples/WEB-INF/web.xml
new file mode 100644
index 0000000..7f3906a
--- /dev/null
+++ b/google-examples/WEB-INF/web.xml
@@ -0,0 +1,38 @@
+
+
+
+ google-examples
+ Google Examples Web Application
+
+ google_key
+
+ The Google Web APIs client authorization key.
+
+
+ google_proxy_host
+
+ The host to use as an HTTP proxy.
+
+
+ google_proxy_port
+
+ The port to use as an HTTP proxy.
+
+
+ google_proxy_username
+
+ The username required for the HTTP proxy.
+
+
+ google_proxy_password
+
+ The password required for the HTTP proxy.
+
+
+ index.html
+
+
+ /google-taglib
+ /WEB-INF/google.tld
+
+
diff --git a/google-taglib/google-examples/advanced.html b/google-examples/advanced.html
similarity index 100%
rename from google-taglib/google-examples/advanced.html
rename to google-examples/advanced.html
diff --git a/google-taglib/google-examples/advanced.jsp b/google-examples/advanced.jsp
similarity index 100%
rename from google-taglib/google-examples/advanced.jsp
rename to google-examples/advanced.jsp
diff --git a/google-taglib/google-examples/cache.html b/google-examples/cache.html
similarity index 100%
rename from google-taglib/google-examples/cache.html
rename to google-examples/cache.html
diff --git a/google-taglib/google-examples/cache.jsp b/google-examples/cache.jsp
similarity index 100%
rename from google-taglib/google-examples/cache.jsp
rename to google-examples/cache.jsp
diff --git a/google-taglib/google-examples/index.html b/google-examples/index.html
similarity index 100%
rename from google-taglib/google-examples/index.html
rename to google-examples/index.html
diff --git a/google-taglib/google-examples/key.html b/google-examples/key.html
similarity index 100%
rename from google-taglib/google-examples/key.html
rename to google-examples/key.html
diff --git a/google-taglib/google-examples/key.jsp b/google-examples/key.jsp
similarity index 100%
rename from google-taglib/google-examples/key.jsp
rename to google-examples/key.jsp
diff --git a/google-taglib/google-examples/search.html b/google-examples/search.html
similarity index 100%
rename from google-taglib/google-examples/search.html
rename to google-examples/search.html
diff --git a/google-taglib/google-examples/search.jsp b/google-examples/search.jsp
similarity index 100%
rename from google-taglib/google-examples/search.jsp
rename to google-examples/search.jsp
diff --git a/google-taglib/google-examples/spelling.html b/google-examples/spelling.html
similarity index 100%
rename from google-taglib/google-examples/spelling.html
rename to google-examples/spelling.html
diff --git a/google-taglib/google-examples/spelling.jsp b/google-examples/spelling.jsp
similarity index 100%
rename from google-taglib/google-examples/spelling.jsp
rename to google-examples/spelling.jsp
diff --git a/google-taglib/google-examples/WEB-INF/web.xml b/google-taglib/google-examples/WEB-INF/web.xml
deleted file mode 100644
index 7458f6f..0000000
--- a/google-taglib/google-examples/WEB-INF/web.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- google-examples
- Google Examples Web Application
-
- google_key
-
- The Google Web APIs client authorization key.
-
-
- index.html
-
-
- /google-taglib
- /WEB-INF/google.tld
-
-
diff --git a/google-taglib/htdocs/images/duktumbl.gif b/google-taglib/htdocs/images/duktumbl.gif
deleted file mode 100644
index 95dd2bb..0000000
Binary files a/google-taglib/htdocs/images/duktumbl.gif and /dev/null differ
diff --git a/google-tagunit/WEB-INF/web.xml b/google-tagunit/WEB-INF/web.xml
new file mode 100644
index 0000000..377552c
--- /dev/null
+++ b/google-tagunit/WEB-INF/web.xml
@@ -0,0 +1,18 @@
+
+
+
+ google-tagunit
+ This webapp is a starting point for testing the Google Tag Library.
+
+ TagUnitTestController
+ org.tagunit.controller.FrontController
+
+
+ TagUnitTestController
+ /test/servlet/*
+
+
+ index.html
+
+
diff --git a/google-tagunit/index.html b/google-tagunit/index.html
new file mode 100644
index 0000000..32b2591
--- /dev/null
+++ b/google-tagunit/index.html
@@ -0,0 +1,16 @@
+
+
+
+Set Google Key
+
+
+
+
+
+
+
diff --git a/google-tagunit/index.jsp b/google-tagunit/index.jsp
new file mode 100644
index 0000000..78cd9e7
--- /dev/null
+++ b/google-tagunit/index.jsp
@@ -0,0 +1,20 @@
+<%
+ // Copyright (c) 2002-2003, Erik C. Thauvin
+ // All rights reserved.
+
+ String key = request.getParameter("key");
+
+ if ((key != null)&& (key.trim().length() > 0))
+ {
+ pageContext.setAttribute("google_key", key, PageContext.APPLICATION_SCOPE);
+%>
+
+<%
+ }
+ else
+ {
+%>
+ <%@include file="index.html"%>
+<%
+ }
+%>
diff --git a/google-tagunit/test/error.jsp b/google-tagunit/test/error.jsp
new file mode 100644
index 0000000..e010225
--- /dev/null
+++ b/google-tagunit/test/error.jsp
@@ -0,0 +1,19 @@
+<%@ page isErrorPage="true" %>
+
+<%@ taglib uri="http://www.tagunit.org/tagunit/display" prefix="tagunit" %>
+
+
+
+
+ TagUnit - Error
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/cachedPage/testSpecification.jsp b/google-tagunit/test/google/cachedPage/testSpecification.jsp
new file mode 100644
index 0000000..876b262
--- /dev/null
+++ b/google-tagunit/test/google/cachedPage/testSpecification.jsp
@@ -0,0 +1,5 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/element/testSpecification.jsp b/google-tagunit/test/google/element/testSpecification.jsp
new file mode 100644
index 0000000..43dd2ad
--- /dev/null
+++ b/google-tagunit/test/google/element/testSpecification.jsp
@@ -0,0 +1,6 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
+
+
+
diff --git a/google-tagunit/test/google/endIndex/testSpecification.jsp b/google-tagunit/test/google/endIndex/testSpecification.jsp
new file mode 100644
index 0000000..630a4e5
--- /dev/null
+++ b/google-tagunit/test/google/endIndex/testSpecification.jsp
@@ -0,0 +1,3 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/estimatedTotal/testSpecification.jsp b/google-tagunit/test/google/estimatedTotal/testSpecification.jsp
new file mode 100644
index 0000000..630a4e5
--- /dev/null
+++ b/google-tagunit/test/google/estimatedTotal/testSpecification.jsp
@@ -0,0 +1,3 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/index.jsp b/google-tagunit/test/google/index.jsp
new file mode 100644
index 0000000..76f3426
--- /dev/null
+++ b/google-tagunit/test/google/index.jsp
@@ -0,0 +1,7 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/next/testSpecification.jsp b/google-tagunit/test/google/next/testSpecification.jsp
new file mode 100644
index 0000000..f8fa598
--- /dev/null
+++ b/google-tagunit/test/google/next/testSpecification.jsp
@@ -0,0 +1,7 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/previous/testSpecification.jsp b/google-tagunit/test/google/previous/testSpecification.jsp
new file mode 100644
index 0000000..f8fa598
--- /dev/null
+++ b/google-tagunit/test/google/previous/testSpecification.jsp
@@ -0,0 +1,7 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/search/testSpecification.jsp b/google-tagunit/test/google/search/testSpecification.jsp
new file mode 100644
index 0000000..22e1ce2
--- /dev/null
+++ b/google-tagunit/test/google/search/testSpecification.jsp
@@ -0,0 +1,14 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/searchComments/testSpecification.jsp b/google-tagunit/test/google/searchComments/testSpecification.jsp
new file mode 100644
index 0000000..630a4e5
--- /dev/null
+++ b/google-tagunit/test/google/searchComments/testSpecification.jsp
@@ -0,0 +1,3 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/searchQuery/testSpecification.jsp b/google-tagunit/test/google/searchQuery/testSpecification.jsp
new file mode 100644
index 0000000..ca7e9c2
--- /dev/null
+++ b/google-tagunit/test/google/searchQuery/testSpecification.jsp
@@ -0,0 +1,5 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/searchResult/testSpecification.jsp b/google-tagunit/test/google/searchResult/testSpecification.jsp
new file mode 100644
index 0000000..58460a5
--- /dev/null
+++ b/google-tagunit/test/google/searchResult/testSpecification.jsp
@@ -0,0 +1,5 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/searchTime/testSpecification.jsp b/google-tagunit/test/google/searchTime/testSpecification.jsp
new file mode 100644
index 0000000..630a4e5
--- /dev/null
+++ b/google-tagunit/test/google/searchTime/testSpecification.jsp
@@ -0,0 +1,3 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/searchTips/testSpecification.jsp b/google-tagunit/test/google/searchTips/testSpecification.jsp
new file mode 100644
index 0000000..630a4e5
--- /dev/null
+++ b/google-tagunit/test/google/searchTips/testSpecification.jsp
@@ -0,0 +1,3 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/spelling/testSpecification.jsp b/google-tagunit/test/google/spelling/testSpecification.jsp
new file mode 100644
index 0000000..876b262
--- /dev/null
+++ b/google-tagunit/test/google/spelling/testSpecification.jsp
@@ -0,0 +1,5 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/google/startIndex/testSpecification.jsp b/google-tagunit/test/google/startIndex/testSpecification.jsp
new file mode 100644
index 0000000..630a4e5
--- /dev/null
+++ b/google-tagunit/test/google/startIndex/testSpecification.jsp
@@ -0,0 +1,3 @@
+<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/images/spacer.gif b/google-tagunit/test/images/spacer.gif
new file mode 100644
index 0000000..e44f8f0
Binary files /dev/null and b/google-tagunit/test/images/spacer.gif differ
diff --git a/google-tagunit/test/images/tagunit.gif b/google-tagunit/test/images/tagunit.gif
new file mode 100644
index 0000000..825917f
Binary files /dev/null and b/google-tagunit/test/images/tagunit.gif differ
diff --git a/google-tagunit/test/images/white-separator.gif b/google-tagunit/test/images/white-separator.gif
new file mode 100644
index 0000000..38b95b0
Binary files /dev/null and b/google-tagunit/test/images/white-separator.gif differ
diff --git a/google-tagunit/test/index.jsp b/google-tagunit/test/index.jsp
new file mode 100644
index 0000000..b2b2245
--- /dev/null
+++ b/google-tagunit/test/index.jsp
@@ -0,0 +1,17 @@
+ <%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
+
+<%--
+ Tests for TagUnit tag libraries
+ -------------------------------
+ This page contains the tests required to automatically test the basics of
+ the tag libraries that are a part of the TagUnit framework
+
+--%>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/google-tagunit/test/license.html b/google-tagunit/test/license.html
new file mode 100644
index 0000000..9729cd0
--- /dev/null
+++ b/google-tagunit/test/license.html
@@ -0,0 +1,45 @@
+
+
+
+ TagUnit
+
+
+
+
+
+
+
TagUnit license information
+
+
+
Copyright (c) 2002, Simon Brown
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of TagUnit nor the names of its contributors may
+ be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
Specifies the file type to be searched. (e.g.: pdf)
+
+
For detailed information on the above Google search options,
@@ -640,12 +678,9 @@ code {font-size:10pt}
The <google:next/> tag is used to
-
-
used to display a link to more search results.
The <google:previous/> tag is used to used to display a link
to previous search results.
-
Tag Syntax
@@ -704,11 +739,8 @@ code {font-size:10pt}
- The <google:searchComments/>
- tag is used to
-
-
- display the comments (if any) included with the current result set.
+ The <google:searchComments/>
+ tag is used to display the comments (if any) included with the current result set.
@@ -720,14 +752,15 @@ code {font-size:10pt}
- The <google:searchQuery/>
- tag is used to
-
-
- display the text of the current query.
-
+ The <google:searchQuery/> tag is used to display
+ the text of the current query.
+ The specified search keywords (or phrase) are returned by default.
+ To display the full query (including preset site and
+ file type options), set the type attribute
+ to full.
+
@@ -738,12 +771,9 @@ code {font-size:10pt}
- The <google:searchTime/>
- tag is used to
-
-
- display the total server time used to return the search results, measured in
- seconds.
+ The <google:searchTime/>
+ tag is used to display the total server time used to return the search results,
+ measured in seconds.
@@ -755,11 +785,9 @@ code {font-size:10pt}
- The <google:searchTips/>
- tag is used to
-
-
- display the tips (if any) included with the current result set.
+ The <google:searchTips/>
+ tag is used to display the tips (if any) included with the current result
+ set.
diff --git a/google-taglib/htdocs/howto.html b/htdocs/howto.html
similarity index 92%
rename from google-taglib/htdocs/howto.html
rename to htdocs/howto.html
index 589e238..3b37d62 100644
--- a/google-taglib/htdocs/howto.html
+++ b/htdocs/howto.html
@@ -10,7 +10,7 @@ body,td,font,.p,a{font-family:arial,sans-serif}
The taglib directive is used to specify the Google Tag
library reference and prefix.
- The <google:search/> tag is used to perform the query.
+ The <google:search/> tag is used to perform the query.
The Google Web APIs authentication key can be
specified as a tag attribute:
@@ -207,9 +210,9 @@ body,td,font,.p,a{font-family:arial,sans-serif}
- The <google:searchResult/> tag is used to loop
+ The <google:searchResult/> tag is used to loop
through the results.
- The <google:element/> tag is used to display the attributes of
+ The <google:element/> tag is used to display the attributes of
the current result set element.
@@ -307,7 +310,7 @@ body,td,font,.p,a{font-family:arial,sans-serif}
- The <google:cachedPage> tag is used to display
+ The <google:cachedPage> tag is used to display
the content of the cached page.
The Google Web APIs authentication key can be
@@ -420,7 +423,7 @@ body,td,font,.p,a{font-family:arial,sans-serif}
- The <google:spelling> tag is used to display the
+ The <google:spelling> tag is used to display the
suggested spelling for the given query.
The Google Web APIs authentication key can be
diff --git a/google-taglib/htdocs/images/arrow.gif b/htdocs/images/arrow.gif
similarity index 100%
rename from google-taglib/htdocs/images/arrow.gif
rename to htdocs/images/arrow.gif
diff --git a/google-taglib/htdocs/images/arrow.jpg b/htdocs/images/arrow.jpg
similarity index 100%
rename from google-taglib/htdocs/images/arrow.jpg
rename to htdocs/images/arrow.jpg
diff --git a/google-taglib/htdocs/images/cached.jpg b/htdocs/images/cached.jpg
similarity index 100%
rename from google-taglib/htdocs/images/cached.jpg
rename to htdocs/images/cached.jpg
diff --git a/google-taglib/htdocs/images/cachedresults.jpg b/htdocs/images/cachedresults.jpg
similarity index 100%
rename from google-taglib/htdocs/images/cachedresults.jpg
rename to htdocs/images/cachedresults.jpg
diff --git a/htdocs/images/duktumbl.gif b/htdocs/images/duktumbl.gif
new file mode 100644
index 0000000..c20590e
Binary files /dev/null and b/htdocs/images/duktumbl.gif differ
diff --git a/htdocs/images/duktumbl.png b/htdocs/images/duktumbl.png
new file mode 100644
index 0000000..c4d4b63
Binary files /dev/null and b/htdocs/images/duktumbl.png differ
diff --git a/google-taglib/htdocs/images/google_sm.gif b/htdocs/images/google_sm.gif
similarity index 100%
rename from google-taglib/htdocs/images/google_sm.gif
rename to htdocs/images/google_sm.gif
diff --git a/google-taglib/htdocs/images/google_sm.png b/htdocs/images/google_sm.png
similarity index 100%
rename from google-taglib/htdocs/images/google_sm.png
rename to htdocs/images/google_sm.png
diff --git a/htdocs/images/jars25.gif b/htdocs/images/jars25.gif
new file mode 100644
index 0000000..04c1fe8
Binary files /dev/null and b/htdocs/images/jars25.gif differ
diff --git a/google-taglib/htdocs/images/search.jpg b/htdocs/images/search.jpg
similarity index 100%
rename from google-taglib/htdocs/images/search.jpg
rename to htdocs/images/search.jpg
diff --git a/google-taglib/htdocs/images/searchresults.jpg b/htdocs/images/searchresults.jpg
similarity index 100%
rename from google-taglib/htdocs/images/searchresults.jpg
rename to htdocs/images/searchresults.jpg
diff --git a/google-taglib/htdocs/images/spelling.jpg b/htdocs/images/spelling.jpg
similarity index 100%
rename from google-taglib/htdocs/images/spelling.jpg
rename to htdocs/images/spelling.jpg
diff --git a/htdocs/images/uml.jpg b/htdocs/images/uml.jpg
new file mode 100644
index 0000000..cb6b432
Binary files /dev/null and b/htdocs/images/uml.jpg differ
diff --git a/google-taglib/htdocs/images/yellowarrow.gif b/htdocs/images/yellowarrow.gif
similarity index 100%
rename from google-taglib/htdocs/images/yellowarrow.gif
rename to htdocs/images/yellowarrow.gif
diff --git a/google-taglib/htdocs/includes/google.css b/htdocs/includes/google.css
similarity index 100%
rename from google-taglib/htdocs/includes/google.css
rename to htdocs/includes/google.css
diff --git a/google-taglib/htdocs/index.html b/htdocs/index.html
similarity index 87%
rename from google-taglib/htdocs/index.html
rename to htdocs/index.html
index b653c3b..80ce6d9 100644
--- a/google-taglib/htdocs/index.html
+++ b/htdocs/index.html
@@ -9,7 +9,7 @@ body,td,font,p,a{font-family:arial,sans-serif}
diff --git a/htdocs/uml.html b/htdocs/uml.html
new file mode 100644
index 0000000..f783a91
--- /dev/null
+++ b/htdocs/uml.html
@@ -0,0 +1,12 @@
+
+
+
+Google Tag Library: UML
+
+
+
+
+
+
diff --git a/google-taglib/lib/doccheck.jar b/lib/doccheck.jar
similarity index 100%
rename from google-taglib/lib/doccheck.jar
rename to lib/doccheck.jar
diff --git a/google-taglib/lib/googleapi.jar b/lib/googleapi.jar
similarity index 100%
rename from google-taglib/lib/googleapi.jar
rename to lib/googleapi.jar
diff --git a/google-taglib/lib/servlet.jar b/lib/servlet.jar
similarity index 100%
rename from google-taglib/lib/servlet.jar
rename to lib/servlet.jar
diff --git a/lib/tagunit.jar b/lib/tagunit.jar
new file mode 100644
index 0000000..fe22da6
Binary files /dev/null and b/lib/tagunit.jar differ
diff --git a/lib/tlddoc.jar b/lib/tlddoc.jar
new file mode 100644
index 0000000..b82f56d
Binary files /dev/null and b/lib/tlddoc.jar differ
diff --git a/google-taglib/licenses/LICENSE-activation.txt b/licenses/LICENSE-activation.txt
similarity index 100%
rename from google-taglib/licenses/LICENSE-activation.txt
rename to licenses/LICENSE-activation.txt
diff --git a/google-taglib/licenses/LICENSE-apache-soap.txt b/licenses/LICENSE-apache-soap.txt
similarity index 100%
rename from google-taglib/licenses/LICENSE-apache-soap.txt
rename to licenses/LICENSE-apache-soap.txt
diff --git a/google-taglib/licenses/LICENSE-crimson.txt b/licenses/LICENSE-crimson.txt
similarity index 100%
rename from google-taglib/licenses/LICENSE-crimson.txt
rename to licenses/LICENSE-crimson.txt
diff --git a/google-taglib/licenses/LICENSE-doccheck.html b/licenses/LICENSE-doccheck.html
similarity index 100%
rename from google-taglib/licenses/LICENSE-doccheck.html
rename to licenses/LICENSE-doccheck.html
diff --git a/google-taglib/licenses/LICENSE-google.txt b/licenses/LICENSE-google.txt
similarity index 100%
rename from google-taglib/licenses/LICENSE-google.txt
rename to licenses/LICENSE-google.txt
diff --git a/google-taglib/licenses/LICENSE-javamail.txt b/licenses/LICENSE-javamail.txt
similarity index 100%
rename from google-taglib/licenses/LICENSE-javamail.txt
rename to licenses/LICENSE-javamail.txt
diff --git a/licenses/LICENSE-tagunit.txt b/licenses/LICENSE-tagunit.txt
new file mode 100644
index 0000000..9324147
--- /dev/null
+++ b/licenses/LICENSE-tagunit.txt
@@ -0,0 +1,29 @@
+Copyright (c) 2002/2003, Simon Brown
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of TagUnit nor the names of its contributors may
+ be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/google-taglib/licenses/LICENSE.txt b/licenses/LICENSE.txt
similarity index 100%
rename from google-taglib/licenses/LICENSE.txt
rename to licenses/LICENSE.txt
diff --git a/rss/.cvsignore b/rss/.cvsignore
new file mode 100644
index 0000000..3586368
--- /dev/null
+++ b/rss/.cvsignore
@@ -0,0 +1,3 @@
+build
+dist
+*.bat
\ No newline at end of file
diff --git a/rss/GoogleRSS.iml b/rss/GoogleRSS.iml
new file mode 100644
index 0000000..36999e8
--- /dev/null
+++ b/rss/GoogleRSS.iml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rss/GoogleRSS.ipr b/rss/GoogleRSS.ipr
new file mode 100644
index 0000000..f2bee3d
--- /dev/null
+++ b/rss/GoogleRSS.ipr
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rss/GoogleRSS.iws b/rss/GoogleRSS.iws
new file mode 100644
index 0000000..a22af7d
--- /dev/null
+++ b/rss/GoogleRSS.iws
@@ -0,0 +1,740 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rss/LICENSE.txt b/rss/LICENSE.txt
new file mode 100644
index 0000000..001be53
--- /dev/null
+++ b/rss/LICENSE.txt
@@ -0,0 +1,30 @@
+Google RSS Tag Library License
+
+Copyright (c) 2003-2004, clevercactus ltd.
+Copyright (c) 2003-2004, Erik C. Thauvin (erik@thauvin.net)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list
+of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+Neither the name of the author nor the names of its contributors may be used to
+endorse or promote products derived from this software without specific prior
+written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/rss/README-BUILD.txt b/rss/README-BUILD.txt
new file mode 100644
index 0000000..e8cafe9
--- /dev/null
+++ b/rss/README-BUILD.txt
@@ -0,0 +1,67 @@
+Google RSS Tag Library README (BUILD)
+=====================================
+
+
+Overview
+========
+
+This README file describes the Google RSS Tag Library source distribution.
+
+The Google RSS Tag Library is an extension to, and thus requires, the
+Google Tag Library, which can be found at:
+
+
+
+
+See the "LICENSE.txt" file for licensing details.
+
+The Google RSS Tag Library uses the Google Web APIs, but is not associated
+with or sponsored by Google, Inc.
+
+Google Web APIs
+===============
+
+The Google Web APIs Java library is required in order to build the Google
+RSS Tag Library. The library's JAR file (googleapi.jar) should be placed
+into the lib directory.
+
+ http://www.google.com/apis/download.html
+
+
+Building the Source
+===================
+
+The Google RSS Tag Library is intended to be build directly within the
+Google Tag Library source tree:
+
+ /google-taglib/rss/
+
+
+The Google RSS Tag Library is built using Ant.
+
+ http://ant.apache.org/
+
+
+To build the JAR, to do the following:
+
+ ant
+
+To build the TLD, do the following:
+
+ ant tld
+
+To build the release archive, do the following:
+
+ ant release
+
+To build the Examples WAR, do the following:
+
+ ant examples
+
+To list all available build targets, do the following:
+
+ ant -projecthelp
+
+
+===========================================================================
+$Id$
\ No newline at end of file
diff --git a/rss/README.txt b/rss/README.txt
new file mode 100644
index 0000000..b90b5ad
--- /dev/null
+++ b/rss/README.txt
@@ -0,0 +1,71 @@
+Google RSS Tag Library README
+=============================
+
+
+Overview
+========
+
+This README file describes the Google RSS Tag Library distribution.
+
+The Google RSS Tag Library is an extension to, and thus requires, the
+Google Tag Library, which can be found at:
+
+
+
+
+See the "LICENSE.txt" file for licensing details.
+
+The Google RSS Tag Library uses the Google Web APIs, but is not associated
+with or sponsored by Google, Inc.
+
+
+Installation
+============
+
+The Google RSS Tag Library requires a JSP (1.1 or higher) container, such
+as Tomcat.
+
+To use the Google RSS Tag Library, simply copy the library's JAR file
+(google-rss.jar) to your application's WEB-INF/lib directory. The Tag Library
+Descriptor (google-rss.tld) should be placed in your application's WEB-INF
+directory.
+
+You should also modify your web application deployment descriptor (web.xml)
+file to map the Google RSS Tag Library TLD URI to its location:
+
+
+ /google-rss-taglib
+ /WEB-INF/google-rss.tld
+
+
+
+TagLib Directive
+================
+
+Using the Google RSS Tag Library is easy; you simply need to import it into
+your JSP pages using the taglib directive. For instance, you would include
+the following line at the top of your JSP page:
+
+ <%@taglib uri="/google-rss-taglib" prefix="rss"%>
+
+
+SearchResults Tag
+=================
+
+The tag is used to display the search results returned
+by a Google search (performed using the Google Tag Library) in RSS format.
+
+For example:
+
+ <%@ page contentType="text/xml" %>
+ <%@ taglib uri="/google-taglib" prefix="google" %>
+ <%@ taglib uri="/google-rss-taglib" prefix="rss" %>
+ my search query
+
+
+Please refer to the Google Tag Library documentation for detailed information
+on performing searches.
+
+
+===========================================================================
+$Id$
\ No newline at end of file
diff --git a/rss/build.properties b/rss/build.properties
new file mode 100644
index 0000000..0171c3d
--- /dev/null
+++ b/rss/build.properties
@@ -0,0 +1,30 @@
+# Version
+version=1.0
+
+# Project
+project.name=google-rss
+release.name=${project.name}-taglib-${version}
+
+# Google Tag Library
+google.dir=..
+google.target=jar
+google.jar=../dist/google.jar
+google.tld=../dist/google.tld
+
+# Locations
+src.dir=src
+build.dir=build
+dist.dir=dist
+lib.dir=${google.dir}/lib
+tlds.dir=tlds
+
+# Examples
+ex.dir=${project.name}-examples
+
+# Source
+src.excludes=${lib.dir}/googleapi.jar
+
+# Docs
+doc.license=LICENSE.txt
+doc.readme=README.txt
+doc.src=README-BUILD.txt
\ No newline at end of file
diff --git a/google-taglib/build.xml b/rss/build.xml
similarity index 53%
rename from google-taglib/build.xml
rename to rss/build.xml
index a8dc42d..d51e9e0 100644
--- a/google-taglib/build.xml
+++ b/rss/build.xml
@@ -1,11 +1,11 @@
-
- Google Tag Library
+
+ Google RSS Tag Library
-
+
@@ -17,6 +17,7 @@
+
@@ -24,14 +25,14 @@
+
-
-
+
@@ -44,60 +45,79 @@
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
+
-
+
-
-
+
+
+
+
+
+
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rss/google-rss-examples/README.txt b/rss/google-rss-examples/README.txt
new file mode 100644
index 0000000..9bdbd8b
--- /dev/null
+++ b/rss/google-rss-examples/README.txt
@@ -0,0 +1,66 @@
+Google RSS Tag Library Examples README
+======================================
+
+
+Overview
+========
+
+This README file describes the Google RSS Tag Library Examples web
+application.
+
+This web application contains a collection of examples demonstrating the
+usage of the Google JSP RSS Tag Library. For more information about using
+the custom tag library in your own web applications, please refer to the
+Google RSS Tag Library documentation.
+
+The Google RSS Tag Library is an extension to the Google Tag Library, which
+can be found at:
+
+
+
+See the "LICENSE.txt" file for licensing details.
+
+The Google RSS Tag Library uses the Google Web APIs, but is not associated
+with or sponsored by Google, Inc.
+
+
+Google Web APIs
+===============
+
+The Google Web APIs Java library is required in order to use the Examples web
+application. The library's JAR file (googleapi.jar) should be placed into the
+application's WEB-INF/lib directory.
+
+ http://www.google.com/apis/download.html
+
+You must also register with Google (free) in order to obtain a license key.
+The license key is required to access Google's Web Services.
+
+ https://www.google.com/accounts/NewAccount
+
+
+Google License Key
+==================
+
+The license key can be specified as a context parameter in the web
+application deployment descriptor (web.xml) as follows:
+
+
+ google_key
+ 000000000000000000000000
+
+
+The license key can also be temporarily specified from the index page of
+the web application.
+
+
+Examples
+========
+
+The following example is included:
+
+ - Perform a simple Google RSS search
+
+
+===========================================================================
+$Id$
\ No newline at end of file
diff --git a/rss/google-rss-examples/WEB-INF/web.xml b/rss/google-rss-examples/WEB-INF/web.xml
new file mode 100644
index 0000000..2d63d72
--- /dev/null
+++ b/rss/google-rss-examples/WEB-INF/web.xml
@@ -0,0 +1,42 @@
+
+
+
+ google-rss-examples
+ Google RSS Examples Web Application
+
+ google_key
+
+ The Google Web APIs client authorization key.
+
+
+ google_proxy_host
+
+ The host to use as an HTTP proxy.
+
+
+ google_proxy_port
+
+ The port to use as an HTTP proxy.
+
+
+ google_proxy_username
+
+ The username required for the HTTP proxy.
+
+
+ google_proxy_password
+
+ The password required for the HTTP proxy.
+
+
+ index.html
+
+
+ /google-taglib
+ /WEB-INF/google.tld
+
+
+ /google-rss-taglib
+ /WEB-INF/google-rss.tld
+
+
diff --git a/rss/google-rss-examples/index.html b/rss/google-rss-examples/index.html
new file mode 100644
index 0000000..9639482
--- /dev/null
+++ b/rss/google-rss-examples/index.html
@@ -0,0 +1,71 @@
+
+
+
+Google RSS Tag Library Examples
+
+
+
+
+
+Google RSS Tag Library Examples
+
+The Google RSS Tag Library is an extension to the Google Tag Library.
+
+
+The Google Web APIs Java library is required in order to use the Google RSS Tag
+Library. The library's JAR file (googleapi.jar) should be placed
+into the application's WEB-INF/lib directory.
+
+The Google RSS Tag Library uses the Google Web APIs, but is not associated with or sponsored by Google, Inc.
+Click here for licensing information.
+
+
+
diff --git a/rss/google-rss-examples/key.html b/rss/google-rss-examples/key.html
new file mode 100644
index 0000000..4fa97a3
--- /dev/null
+++ b/rss/google-rss-examples/key.html
@@ -0,0 +1,16 @@
+
+
+
+Set Google Key
+
+
+
+
+
+
+
diff --git a/rss/google-rss-examples/key.jsp b/rss/google-rss-examples/key.jsp
new file mode 100644
index 0000000..cf30658
--- /dev/null
+++ b/rss/google-rss-examples/key.jsp
@@ -0,0 +1,21 @@
+<%
+ // Copyright (c) 2002-2004, Erik C. Thauvin
+ // All rights reserved.
+
+ String key = request.getParameter("key");
+
+ if ((key != null)&& (key.trim().length() > 0))
+ {
+ pageContext.setAttribute("google_key", key, PageContext.APPLICATION_SCOPE);
+%>
+ <%@include file="search.html"%>
+<%
+ }
+ else
+ {
+%>
+ <%@include file="key.html"%>
+<%
+ }
+%>
+
diff --git a/rss/google-rss-examples/rss.jsp b/rss/google-rss-examples/rss.jsp
new file mode 100644
index 0000000..0c7d8b5
--- /dev/null
+++ b/rss/google-rss-examples/rss.jsp
@@ -0,0 +1 @@
+<%@ page contentType="text/xml" %><%@ taglib uri="/google-taglib" prefix="google" %><%@ taglib uri="/google-rss-taglib" prefix="rss" %>
diff --git a/rss/google-rss-examples/search.html b/rss/google-rss-examples/search.html
new file mode 100644
index 0000000..9367268
--- /dev/null
+++ b/rss/google-rss-examples/search.html
@@ -0,0 +1,16 @@
+
+
+
+Search Google
+
+
+
+
+
+
+
diff --git a/rss/src/com/clevercactus/google/AtomGenerator.java b/rss/src/com/clevercactus/google/AtomGenerator.java
new file mode 100644
index 0000000..292111c
--- /dev/null
+++ b/rss/src/com/clevercactus/google/AtomGenerator.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2003-2004 clevercactus ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.clevercactus.google;
+
+import org.xml.sax.SAXException;
+
+import java.io.PrintWriter;
+import java.util.Date;
+
+/**
+ * A class that uses JAXP and SAX to print an SearchResults 2.0 feed to a PrintWriter.
+ * Output of the SearchResults happens as data is added. See the main() method for a
+ * simple usage example.
+ *
+ * @version 1.0, 29/08/2003
+ * @author Diego Doval
+ */
+public
+class AtomGenerator
+ extends FeedGenerator
+{
+ /**
+ * The one and only constructor.
+ */
+ public
+ AtomGenerator()
+ {
+ }
+
+ /**
+ * Prints a valid SearchResults 2.0 header based on the information passed.
+ *
+ * @param title feed title
+ * @param link feed link
+ * @param description feed description
+ * @param author feed author (must be an email address)
+ * @param lastBuildDate the date the feed was built
+ * @throws FeedGenerationException
+ */
+ public
+ void
+ printHeader(String title, String link, String description, String author, Date lastBuildDate)
+ throws FeedGenerationException
+ {
+ try {
+ String language = "en-us";
+ String generatorName = "clevercactus atom generator 1.0";
+ String generatorURL = "http://www.clevercactus.com/google/";
+ String copyright = "Copyright (c) 2003-2004 clevercactus ltd.";
+ String authorName = "Diego Doval";
+
+ feedAttributes_d.clear();
+ feedAttributes_d.addAttribute("", "", "version", "", "0.2");
+ feedAttributes_d.addAttribute("", "", "xmlns", "", "http://purl.org/atom/ns#");
+ feedAttributes_d.addAttribute("", "", "xml:lang", "", "en");
+ transformerHandler_d.startElement("","","feed",feedAttributes_d);
+
+ feedAttributes_d.clear();
+ transformerHandler_d.startElement("","","author",feedAttributes_d);
+ transformerHandler_d.startElement("","","name",feedAttributes_d);
+ transformerHandler_d.characters(authorName.toCharArray(),0,authorName.length());
+ transformerHandler_d.endElement("","","name");
+ transformerHandler_d.endElement("","","author");
+
+ feedAttributes_d.clear();
+ transformerHandler_d.startElement("","","title",feedAttributes_d);
+ transformerHandler_d.characters(title.toCharArray(),0,title.length());
+ transformerHandler_d.endElement("","","title");
+ transformerHandler_d.startElement("","","link",feedAttributes_d);
+ transformerHandler_d.characters(link.toCharArray(),0,link.length());
+ transformerHandler_d.endElement("","","link");
+ transformerHandler_d.startElement("","","tagline", feedAttributes_d);
+ transformerHandler_d.characters(description.toCharArray(),0,description.length());
+ transformerHandler_d.endElement("","","tagline");
+ transformerHandler_d.startElement("","","modified",elementAttributes_d);
+ String dtString = getAsISO8601String(lastBuildDate);
+ transformerHandler_d.characters(dtString.toCharArray(),0,dtString.length());
+ transformerHandler_d.endElement("","","modified");
+ feedAttributes_d.addAttribute("", "", "name", "", generatorName);
+ transformerHandler_d.startElement("","","generator", feedAttributes_d);
+ transformerHandler_d.characters(generatorURL.toCharArray(),0, generatorURL.length());
+ transformerHandler_d.endElement("","","generator");
+ feedAttributes_d.clear();
+ transformerHandler_d.startElement("","","copyright", feedAttributes_d);
+ transformerHandler_d.characters(copyright.toCharArray(),0,copyright.length());
+ transformerHandler_d.endElement("","","copyright");
+ }
+ catch (SAXException e) {
+ throw new FeedGenerationException(e);
+ }
+ }
+
+ /**
+ * Prints a valid SearchResults 2.0 item based on the information passed.
+ *
+ * @param title the entry title
+ * @param description the entry body/description
+ * @param link the entry's GUID
+ * @param date the entry publication date
+ * @throws FeedGenerationException
+ */
+ public
+ void
+ printItem(String title, String description, String link, Date date)
+ throws FeedGenerationException
+ {
+ try {
+ elementAttributes_d.clear();
+
+ transformerHandler_d.startElement("","","entry",elementAttributes_d);
+ transformerHandler_d.startElement("","","title",elementAttributes_d);
+ transformerHandler_d.characters(title.toCharArray(),0,title.length());
+ transformerHandler_d.endElement("","","title");
+
+ transformerHandler_d.startElement("","","issued",elementAttributes_d);
+ String dtString = getAsISO8601String(date);
+ transformerHandler_d.characters(dtString.toCharArray(),0,dtString.length());
+ transformerHandler_d.endElement("","","issued");
+
+ transformerHandler_d.startElement("","","modified",elementAttributes_d);
+ transformerHandler_d.characters(dtString.toCharArray(),0,dtString.length());
+ transformerHandler_d.endElement("","","modified");
+
+ transformerHandler_d.startElement("","","created",elementAttributes_d);
+ transformerHandler_d.characters(dtString.toCharArray(),0,dtString.length());
+ transformerHandler_d.endElement("","","created");
+
+ transformerHandler_d.startElement("","","link",elementAttributes_d);
+ transformerHandler_d.characters(link.toCharArray(),0,link.length());
+ transformerHandler_d.endElement("","","link");
+
+ transformerHandler_d.startElement("","","id",elementAttributes_d);
+ transformerHandler_d.characters(link.toCharArray(),0,link.length());
+ transformerHandler_d.endElement("","","id");
+
+ elementAttributes_d.clear();
+ elementAttributes_d.addAttribute("", "", "type", "", "text/html");
+ elementAttributes_d.addAttribute("", "", "mode", "", "escaped");
+ elementAttributes_d.addAttribute("", "", "xml:lang", "", "en");
+
+ transformerHandler_d.startElement("","","content",elementAttributes_d);
+ transformerHandler_d.startCDATA();
+ transformerHandler_d.characters(description.toCharArray(),0,description.length());
+ transformerHandler_d.endCDATA();
+ transformerHandler_d.endElement("","","content");
+
+ transformerHandler_d.endElement("","","entry");
+ }
+ catch (SAXException e) {
+ throw new FeedGenerationException(e);
+ }
+
+ }
+
+ /**
+ * Closes the feed's main elements (i.e., "rss" and "channel").
+ * @throws FeedGenerationException
+ */
+ public
+ void
+ close()
+ throws FeedGenerationException
+ {
+ try {
+ transformerHandler_d.endElement("","","feed");
+ transformerHandler_d.endDocument();
+ }
+ catch (SAXException e) {
+ throw new FeedGenerationException(e);
+ }
+ }
+
+ /**
+ * Simple test to generate a 2.0 feed.
+ */
+ public static
+ void
+ main(String[] args)
+ {
+ try {
+ AtomGenerator gen = new AtomGenerator();
+ gen.init(new PrintWriter(System.out));
+ gen.printHeader("Test feed", "http://something/", "test feed desc", "test@test.com", new Date());
+ gen.printItem("Item title 1", "Item desc 1", "http://guid/1234", new Date());
+ gen.printItem("Item title 2", "Item desc 2", "http://guid/12342", new Date());
+ gen.close();
+ }
+ catch (FeedGenerationException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/rss/src/com/clevercactus/google/FeedGenerationException.java b/rss/src/com/clevercactus/google/FeedGenerationException.java
new file mode 100644
index 0000000..fb33e0f
--- /dev/null
+++ b/rss/src/com/clevercactus/google/FeedGenerationException.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2003-2004 clevercactus ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.clevercactus.google;
+
+/**
+ * Used to simplify exception handling in the RSSGenerator class. Internal
+ * Exceptions in that class will be wrapped in an FeedGenerationException.
+ *
+ * @version 1.0, 29/08/2003
+ * @author Diego Doval
+ */
+public
+class FeedGenerationException
+ extends Exception
+{
+ public
+ FeedGenerationException()
+ {
+ }
+
+ public
+ FeedGenerationException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public
+ FeedGenerationException(String message)
+ {
+ super(message);
+ }
+
+ public
+ FeedGenerationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
diff --git a/rss/src/com/clevercactus/google/FeedGenerator.java b/rss/src/com/clevercactus/google/FeedGenerator.java
new file mode 100644
index 0000000..5879e6e
--- /dev/null
+++ b/rss/src/com/clevercactus/google/FeedGenerator.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2003-2004 clevercactus ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.clevercactus.google;
+
+import org.xml.sax.helpers.AttributesImpl;
+import org.xml.sax.SAXException;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.OutputKeys;
+import java.io.Writer;
+import java.util.Date;
+import java.util.Locale;
+import java.text.SimpleDateFormat;
+
+/**
+ * A class that uses JAXP and SAX to print an feed to a PrintWriter.
+ * Output of the actual happens as data is added on the subclass. See the main() method for a
+ * simple usage example.
+ *
+ * @version 1.0, 29/08/2003
+ * @author Diego Doval
+ */
+public abstract
+class FeedGenerator
+{
+ protected Writer output_d;
+ protected StreamResult streamResult_d;
+ protected TransformerHandler transformerHandler_d;
+ protected SAXTransformerFactory saxTransformerFactory_d;
+ protected AttributesImpl elementAttributes_d;
+ protected AttributesImpl feedAttributes_d;
+
+ public static SimpleDateFormat iso8601DateFormat_sd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
+ public static SimpleDateFormat rfc822DateFormat_sd = new SimpleDateFormat("EEE', 'dd' 'MMM' 'yy' 'HH:mm:ss' 'z", Locale.US);
+
+ /**
+ * The one and only constructor.
+ */
+ public
+ FeedGenerator()
+ {
+ }
+
+ /**
+ * @param output writer to use for outputting the SearchResults
+ * @throws FeedGenerationException
+ */
+ public
+ void
+ init(Writer output)
+ throws FeedGenerationException
+ {
+ output_d = output;
+ streamResult_d = new StreamResult(output_d);
+ feedAttributes_d = new AttributesImpl();
+ elementAttributes_d = new AttributesImpl();
+ try {
+ saxTransformerFactory_d = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
+ transformerHandler_d = saxTransformerFactory_d.newTransformerHandler();
+ Transformer trans = transformerHandler_d.getTransformer();
+ trans.setOutputProperty(OutputKeys.ENCODING,"ISO-8859-1");
+ trans.setOutputProperty(OutputKeys.INDENT,"yes");
+ transformerHandler_d.setResult(streamResult_d);
+ transformerHandler_d.startDocument();
+ }
+ catch (Exception e) {
+ throw new FeedGenerationException(e);
+ }
+ }
+
+ /**
+ * Prints a valid header based on the information passed.
+ *
+ * @param title feed title
+ * @param link feed link
+ * @param description feed description
+ * @param author feed author (must be an email address)
+ * @param lastBuildDate the date the feed was built
+ * @throws FeedGenerationException
+ */
+ public abstract
+ void
+ printHeader(String title, String link, String description, String author, Date lastBuildDate)
+ throws FeedGenerationException;
+
+ /**
+ * Prints a valid SearchResults 2.0 item based on the information passed.
+ *
+ * @param title the entry title
+ * @param description the entry body/description
+ * @param link the entry's GUID
+ * @param date the entry publication date
+ * @throws FeedGenerationException
+ */
+ public abstract
+ void
+ printItem(String title, String description, String link, Date date)
+ throws FeedGenerationException;
+
+ /**
+ * Closes the feed's main elements
+ * @throws FeedGenerationException
+ */
+ public abstract
+ void
+ close()
+ throws FeedGenerationException;
+
+ /**
+ * Utility method to obtain a date in a string in RFC 822 date format
+ *
+ * @param date the date to
+ * @return a string with the date in RFC 822 format
+ */
+ public final
+ String
+ getAsISO8601String(Date date)
+ {
+ String result = iso8601DateFormat_sd.format(date);
+ //convert 20030509T00:32:35+0100 returned by Java into 20030509T00:32:35+01:00
+ //from the spec date/time 19980717T14:08:55
+ result = result.substring(0, result.length()-2) + ":" + result.substring(result.length()-2);
+ return result;
+ }
+
+
+ /**
+ * Utility method to obtain a date in a string in RFC 822 date format
+ *
+ * @param date the date to
+ * @return a string with the date in RFC 822 format
+ */
+ public final
+ String
+ getAsRFC822String(Date date)
+ {
+ return rfc822DateFormat_sd.format(date);
+ }
+}
diff --git a/rss/src/com/clevercactus/google/FeedGeneratorFactory.java b/rss/src/com/clevercactus/google/FeedGeneratorFactory.java
new file mode 100644
index 0000000..a07fe81
--- /dev/null
+++ b/rss/src/com/clevercactus/google/FeedGeneratorFactory.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2003-2004 clevercactus ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.clevercactus.google;
+
+import java.util.HashMap;
+
+/**
+ * Date: 05-Sep-2003
+ * Time: 20:41:19
+ */
+public
+class FeedGeneratorFactory
+{
+ public static HashMap feedTypes_sd = new HashMap();
+
+ public static final String FEED_TYPE_RSS = "rss";
+ public static final String FEED_TYPE_ATOM = "atom";
+
+ static {
+ addGenerator(FEED_TYPE_RSS, RSSGenerator.class);
+ addGenerator(FEED_TYPE_ATOM, AtomGenerator.class);
+ }
+
+ public static
+ boolean
+ supportsFormat(String type)
+ {
+ return type != null && (type.equals(FEED_TYPE_RSS) || type.equals(FEED_TYPE_ATOM));
+ }
+
+ public static
+ void
+ addGenerator(String type, Class cls)
+ {
+ feedTypes_sd.put(type, cls);
+ }
+
+ public static
+ FeedGenerator
+ getGeneratorForType(String type)
+ {
+ Class cls = (Class) feedTypes_sd.get(type);
+ try {
+ return (FeedGenerator) cls.newInstance();
+ }
+ catch (InstantiationException e) {
+ e.printStackTrace();
+ }
+ catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+}
diff --git a/rss/src/com/clevercactus/google/GoogleResultsWrapper.java b/rss/src/com/clevercactus/google/GoogleResultsWrapper.java
new file mode 100644
index 0000000..128ad70
--- /dev/null
+++ b/rss/src/com/clevercactus/google/GoogleResultsWrapper.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2003-2004 clevercactus ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.clevercactus.google;
+
+import com.google.soap.search.GoogleSearchResultElement;
+
+import java.io.Writer;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Date;
+import java.util.ArrayList;
+
+/**
+ * Date: 30-Oct-2003
+ * Time: 13:41:41
+ * @author Diego Doval
+ * @author Erik C. Thauvin
+ */
+public
+class GoogleResultsWrapper
+{
+ ArrayList items_d = new ArrayList();
+
+
+ private
+ GoogleResultsWrapper()
+ {
+ }
+
+ private
+ Iterator
+ iterator()
+ {
+ return items_d.iterator();
+ }
+
+ private
+ void
+ addItem(GoogleResultsWrapperItem it)
+ {
+ items_d.add(it);
+ }
+
+ private static
+ GoogleResultsWrapper
+ createWrapper(GoogleSearchResultElement[] elements)
+ {
+ if (elements == null || elements.length == 0) {
+ return null;
+ }
+ GoogleResultsWrapper wrapper = new GoogleResultsWrapper();
+ for (int i = 0; i < elements.length; i++) {
+ GoogleSearchResultElement element = elements[i];
+ wrapper.addItem(new GoogleResultsWrapperItem(element.getTitle(), element.getURL(), element.getSnippet()));
+ }
+ return wrapper;
+ }
+
+ /**
+ * Output the results to a writer.
+ *
+ * @param out the writer to use
+ * @param elements the search result elements
+ * @param query the search query
+ * @param feedType the type of feed to use (options are "rss" and "atom")
+ */
+ public static
+ void
+ outputResults(Writer out, GoogleSearchResultElement[] elements, String query, String feedType)
+ {
+ outputResults(out, createWrapper(elements), query, feedType);
+ }
+
+ /**
+ * Output the results to a writer.
+ *
+ * @param out the writer to use
+ * @param wrapper the results object obtained from the parsing of results
+ * @param query the search query
+ * @param feedType the type of feed to use (options are "rss" and "atom")
+ */
+ private static
+ void
+ outputResults(Writer out, GoogleResultsWrapper wrapper, String query, String feedType)
+ {
+ try {
+ if (out == null || feedType == null) {
+ try {
+ out.write("Null parameter in output results.\n");
+ }
+ catch (IOException e1) {
+ }
+ return;
+ }
+ if (!feedType.equals(FeedGeneratorFactory.FEED_TYPE_RSS)
+ && !feedType.equals(FeedGeneratorFactory.FEED_TYPE_ATOM)) {
+ try {
+ out.write("Invalid feed type ("+feedType+"). Supported types are 'rss' and 'atom'.\n");
+ }
+ catch (IOException e1) {
+ }
+ return;
+ }
+ try {
+ FeedGenerator gen = FeedGeneratorFactory.getGeneratorForType(feedType);
+ gen.init(out);
+ Date date = new Date();
+
+ String description;
+ if ((query == null) || (query.trim().length() == 0)) {
+ description = "Google Tag Library";
+ } else {
+ description = "Search results for: \"" + query + '"';
+ }
+
+ gen.printHeader("Google Search Feed Output", "http://google-taglib.sourceforge.net/", description, "check@page.for.info", date);
+ if (wrapper != null) {
+ Iterator items = wrapper.iterator();
+ while (items.hasNext()) {
+ GoogleResultsWrapperItem item = (GoogleResultsWrapperItem) items.next();
+ gen.printItem(item.getTitle(), item.getSnippet(), item.getURL(), date);
+ }
+ }
+ gen.close();
+ }
+ catch (FeedGenerationException e) {
+ try {
+ out.write("Error.\n");
+ out.write(e.getMessage());
+ }
+ catch (IOException e1) {
+ }
+ }
+ }
+ finally {
+ try {
+ out.close();
+ }
+ catch (IOException e) {
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/rss/src/com/clevercactus/google/GoogleResultsWrapperItem.java b/rss/src/com/clevercactus/google/GoogleResultsWrapperItem.java
new file mode 100644
index 0000000..848c216
--- /dev/null
+++ b/rss/src/com/clevercactus/google/GoogleResultsWrapperItem.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2003-2004 clevercactus ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.clevercactus.google;
+
+/**
+ * Date: 30-Oct-2003
+ * Time: 13:51:43
+ * @author Diego Doval
+ */
+public
+class GoogleResultsWrapperItem
+{
+ String title_d;
+ String text_d;
+ String url_d;
+
+ public
+ GoogleResultsWrapperItem(String title, String url, String text)
+ {
+ title_d = title;
+ url_d = url;
+ text_d = text;
+ }
+
+ public
+ String
+ getTitle()
+ {
+ return title_d;
+ }
+
+ public
+ String
+ getSnippet()
+ {
+ return text_d;
+ }
+
+ public
+ String
+ getURL()
+ {
+ return url_d;
+ }
+
+ public
+ String
+ toString()
+ {
+ return "Title: "+title_d+"\nURL:"+url_d+"\nText:"+text_d+"\n";
+ }
+}
diff --git a/rss/src/com/clevercactus/google/RSSGenerator.java b/rss/src/com/clevercactus/google/RSSGenerator.java
new file mode 100644
index 0000000..e6a4b25
--- /dev/null
+++ b/rss/src/com/clevercactus/google/RSSGenerator.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2003-2004 clevercactus ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.clevercactus.google;
+
+import org.xml.sax.SAXException;
+
+import java.io.PrintWriter;
+import java.util.Date;
+
+/**
+ * A class that uses JAXP and SAX to print an SearchResults 2.0 feed to a PrintWriter.
+ * Output of the SearchResults happens as data is added. See the main() method for a
+ * simple usage example.
+ *
+ * @version 1.0, 29/08/2003
+ * @author Diego Doval
+ */
+public
+class RSSGenerator
+ extends FeedGenerator
+{
+
+ /**
+ * The one and only constructor.
+ */
+ public
+ RSSGenerator()
+ {
+ }
+
+ /**
+ * Prints a valid SearchResults 2.0 header based on the information passed.
+ *
+ * @param title feed title
+ * @param link feed link
+ * @param description feed description
+ * @param author feed author (must be an email address)
+ * @param lastBuildDate the date the feed was built
+ * @throws FeedGenerationException
+ */
+ public
+ void
+ printHeader(String title, String link, String description, String author, Date lastBuildDate)
+ throws FeedGenerationException
+ {
+ try {
+ String language = "en-us";
+ String generator = "clevercactus rss generator 1.0";
+
+ feedAttributes_d.clear();
+ feedAttributes_d.addAttribute("", "", "version", "", "2.0");
+ transformerHandler_d.startElement("","","rss",feedAttributes_d);
+ feedAttributes_d.clear();
+ transformerHandler_d.startElement("","","channel",feedAttributes_d);
+ transformerHandler_d.startElement("","","title",feedAttributes_d);
+ transformerHandler_d.characters(title.toCharArray(),0,title.length());
+ transformerHandler_d.endElement("","","title");
+ transformerHandler_d.startElement("","","link",feedAttributes_d);
+ transformerHandler_d.characters(link.toCharArray(),0,link.length());
+ transformerHandler_d.endElement("","","link");
+ transformerHandler_d.startElement("","","description", feedAttributes_d);
+ transformerHandler_d.characters(description.toCharArray(),0,description.length());
+ transformerHandler_d.endElement("","","description");
+ transformerHandler_d.startElement("","","language", feedAttributes_d);
+ transformerHandler_d.characters(language.toCharArray(),0,language.length());
+ transformerHandler_d.endElement("","","language");
+ transformerHandler_d.startElement("","","lastBuildDate",elementAttributes_d);
+ String dtString = getAsRFC822String(lastBuildDate);
+ transformerHandler_d.characters(dtString.toCharArray(),0,dtString.length());
+ transformerHandler_d.endElement("","","lastBuildDate");
+ transformerHandler_d.startElement("","","generator", feedAttributes_d);
+ transformerHandler_d.characters(generator.toCharArray(),0,generator.length());
+ transformerHandler_d.endElement("","","generator");
+ transformerHandler_d.startElement("","","managingEditor", feedAttributes_d);
+ transformerHandler_d.characters(author.toCharArray(),0,author.length());
+ transformerHandler_d.endElement("","","managingEditor");
+ transformerHandler_d.startElement("","","webMaster", feedAttributes_d);
+ transformerHandler_d.characters(author.toCharArray(),0,author.length());
+ transformerHandler_d.endElement("","","webMaster");
+ }
+ catch (SAXException e) {
+ throw new FeedGenerationException(e);
+ }
+ }
+
+ /**
+ * Prints a valid SearchResults 2.0 item based on the information passed.
+ *
+ * @param title the entry title
+ * @param description the entry body/description
+ * @param link the entry's GUID
+ * @param date the entry publication date
+ * @throws FeedGenerationException
+ */
+ public
+ void
+ printItem(String title, String description, String link, Date date)
+ throws FeedGenerationException
+ {
+ try {
+ elementAttributes_d.clear();
+ transformerHandler_d.startElement("","","item",elementAttributes_d);
+ elementAttributes_d.clear();
+ transformerHandler_d.startElement("","","title",elementAttributes_d);
+ transformerHandler_d.characters(title.toCharArray(),0,title.length());
+ transformerHandler_d.endElement("","","title");
+ elementAttributes_d.clear();
+ transformerHandler_d.startElement("","","description",elementAttributes_d);
+ transformerHandler_d.characters(description.toCharArray(),0,description.length());
+ transformerHandler_d.endElement("","","description");
+ elementAttributes_d.clear();
+ transformerHandler_d.startElement("","","pubDate",elementAttributes_d);
+ String dtString = getAsRFC822String(date);
+ transformerHandler_d.characters(dtString.toCharArray(),0,dtString.length());
+ transformerHandler_d.endElement("","","pubDate");
+ elementAttributes_d.clear();
+ transformerHandler_d.startElement("","","link",elementAttributes_d);
+ transformerHandler_d.characters(link.toCharArray(),0,link.length());
+ transformerHandler_d.endElement("","","link");
+
+ transformerHandler_d.endElement("","","item");
+ }
+ catch (SAXException e) {
+ throw new FeedGenerationException(e);
+ }
+
+ }
+
+ /**
+ * Closes the feed's main elements (i.e., "rss" and "channel").
+ * @throws FeedGenerationException
+ */
+ public
+ void
+ close()
+ throws FeedGenerationException
+ {
+ try {
+ transformerHandler_d.endElement("","","channel");
+ transformerHandler_d.endElement("","","rss");
+ transformerHandler_d.endDocument();
+ }
+ catch (SAXException e) {
+ throw new FeedGenerationException(e);
+ }
+ }
+
+
+ /**
+ * Simple test to generate a 2.0 feed.
+ */
+ public static
+ void
+ main(String[] args)
+ {
+ try {
+ RSSGenerator gen = new RSSGenerator();
+ gen.init(new PrintWriter(System.out));
+ gen.printHeader("Test feed", "http://something/", "test feed desc", "test@test.com", new Date());
+ gen.printItem("Item title 1", "Item desc 1", "guid", new Date());
+ gen.printItem("Item title 2", "Item desc 2", "guid", new Date());
+ gen.close();
+ }
+ catch (FeedGenerationException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/rss/src/com/clevercactus/google/taglibs/SearchResults.java b/rss/src/com/clevercactus/google/taglibs/SearchResults.java
new file mode 100644
index 0000000..61f44f0
--- /dev/null
+++ b/rss/src/com/clevercactus/google/taglibs/SearchResults.java
@@ -0,0 +1,132 @@
+/*
+ * @(#)SearchResults.java
+ *
+ * Copyright (c) 2003-2004, Erik C. Thauvin (erik@thauvin.net)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $Id$
+ *
+ */
+package com.clevercactus.google.taglibs;
+
+import com.clevercactus.google.GoogleResultsWrapper;
+
+import net.thauvin.google.GoogleSearchBean;
+import net.thauvin.google.TagUtility;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+
+
+/**
+ * A custom tag used to display Google search results in RSS format.
+ *
+ * @author Erik C. Thauvin
+ * @version $Revision$, $Date$
+ *
+ * @created Oct 30, 2003
+ * @since 1.0
+ */
+public class SearchResults extends BodyTagSupport
+{
+ /**
+ * The Google search bean.
+ */
+ protected GoogleSearchBean bean = null;
+
+ /**
+ * doEndTag method.
+ *
+ * @return EVAL_PAGE
+ *
+ * @throws JspException
+ */
+ public int doEndTag() throws JspException
+ {
+ try
+ {
+ // Is the result valid?
+ if (bean != null)
+ {
+ // Output the feed
+ GoogleResultsWrapper.outputResults(pageContext.getOut(),
+ bean.getResultElements(),
+ bean.getResultProperty("searchKeywords"),
+ "rss");
+ }
+ }
+ catch (Exception e)
+ {
+ throw TagUtility.outputError("rss", e);
+ }
+
+ // Reset the values
+ reset();
+
+ return EVAL_PAGE;
+ }
+
+ /**
+ * doStartTag method.
+ *
+ * @return SKIP_BODY.
+ *
+ * @throws JspException
+ */
+ public int doStartTag() throws JspException
+ {
+ // Get the Google bean
+ bean = TagUtility.getGoogleSearchBean(pageContext);
+
+ return SKIP_BODY;
+ }
+
+ /**
+ * Release method.
+ */
+ public void release()
+ {
+ super.release();
+
+ // Reset the bean
+ bean = null;
+
+ // Reset the values
+ reset();
+ }
+
+ /**
+ * Reset the values.
+ */
+ protected void reset()
+ {
+ // super.reset();
+ }
+}
diff --git a/rss/tlds/google-rss.tld b/rss/tlds/google-rss.tld
new file mode 100644
index 0000000..06ee349
--- /dev/null
+++ b/rss/tlds/google-rss.tld
@@ -0,0 +1,22 @@
+
+
+
+
+
+ @version@
+
+ 1.1
+
+ google-rss
+
+ http://www.thauvin.net/taglibs/google-rss-taglib-@version@
+
+ The Google RSS Tag Library.
+
+
+ searchResults
+ com.clevercactus.google.taglibs.SearchResults
+ empty
+ Displays Google search results in RSS format.
+
+
diff --git a/google-taglib/src/net/thauvin/google/GoogleSearchBean.java b/src/net/thauvin/google/GoogleSearchBean.java
similarity index 87%
rename from google-taglib/src/net/thauvin/google/GoogleSearchBean.java
rename to src/net/thauvin/google/GoogleSearchBean.java
index a08785d..9178600 100644
--- a/google-taglib/src/net/thauvin/google/GoogleSearchBean.java
+++ b/src/net/thauvin/google/GoogleSearchBean.java
@@ -50,11 +50,16 @@ import java.net.URLEncoder;
*
* @author Erik C. Thauvin
* @created April 25, 2002
- * @version $Revision$
+ * @version $Revision$, $Date$
* @since 1.0
*/
public class GoogleSearchBean
{
+ /**
+ * The default cache flag.
+ */
+ public static final boolean DEFAULT_CACHE = true;
+
/**
* The default related-queries filter.
*/
@@ -90,6 +95,13 @@ public class GoogleSearchBean
*/
public static final int DEFAULT_START = 0;
+ /**
+ * The default filetype.
+ *
+ * @since 1.0.1
+ */
+ public static final String DEFAULT_TYPE = "";
+
/**
* The next keyword.
*/
@@ -105,6 +117,7 @@ public class GoogleSearchBean
"The authorization key has not been specified.";
private GoogleSearch service = null;
private GoogleSearchResult result = null;
+ private String keywords = null;
private GoogleSearchResultElement elements[] = null;
private boolean keySet = false;
private int maxResults = 10;
@@ -138,7 +151,7 @@ public class GoogleSearchBean
{
service.setKey(key);
- if ((key != null) && (key.trim().length() > 0))
+ if (isValidString(key))
{
keySet = true;
}
@@ -158,6 +171,58 @@ public class GoogleSearchBean
return keySet;
}
+ /**
+ * Sets the search keywords.
+ *
+ * @param keywords The keywords
+ * @see #getKeywords()
+ * @since 1.0.1
+ */
+ public final void setKeywords(String keywords)
+ {
+ this.keywords = keywords;
+ }
+
+ /**
+ * Returns the keywords.
+ *
+ * @return The keywords value.
+ * @see #setKeywords(String)
+ * @since 1.0.1
+ */
+ public final String getKeywords()
+ {
+ return this.keywords;
+ }
+
+ /**
+ * Sets the HTTP proxy host, port, user name and password.
+ *
+ * @param proxyHost The host to use for the HTTP proxy.
+ * @param proxyPort The port to use for the HTTP proxy.
+ * @param proxyUserName The user name to use for the HTTP proxy.
+ * @param proxyPassword The password to use for the HTTP proxy.
+ */
+ public void setProxyServer(String proxyHost, String proxyPort,
+ String proxyUserName, String proxyPassword)
+ {
+ int port = -1;
+
+ if (isValidString(proxyPort))
+ {
+ try
+ {
+ port = Integer.valueOf(proxyPort).intValue();
+ }
+ catch (NumberFormatException e)
+ {
+ ; // Do nothing.
+ }
+ }
+
+ setProxyServer(proxyHost, port, proxyUserName, proxyPassword);
+ }
+
/**
* Sets the HTTP proxy host, port, user name and password.
*
@@ -169,10 +234,25 @@ public class GoogleSearchBean
public void setProxyServer(String proxyHost, int proxyPort,
String proxyUserName, String proxyPassword)
{
- service.setProxyHost(proxyHost);
- service.setProxyPort(proxyPort);
- service.setProxyUserName(proxyUserName);
- service.setProxyPassword(proxyPassword);
+ if (isValidString(proxyHost))
+ {
+ service.setProxyHost(proxyHost);
+
+ if (proxyPort > 0)
+ {
+ service.setProxyPort(proxyPort);
+ }
+
+ if (isValidString(proxyUserName))
+ {
+ service.setProxyUserName(proxyUserName);
+ }
+
+ if (isValidString(proxyPassword))
+ {
+ service.setProxyPassword(proxyPassword);
+ }
+ }
}
/**
@@ -365,10 +445,15 @@ public class GoogleSearchBean
* encoding scheme of the current ODP category.
*
"relatedQuery"
Returns the related query
* string, suitable for use as a {@link #getGoogleSearch(String) search}
- * query string.
+ * query string. For example:
+ * related:www.example.com/search?q=vacation%20hawaii
*
"cachedQuery"
Returns the cached query
* string, suitable for use as a {@link #getCachedPage(String) cached} query
- * string.
+ * string. For example: www.example.com/search?q=vacation%20hawaii
+ *
+ *
"staticQuery"
The static query, suitable for
+ * display. For example: www.example.com/search?q=vacation hawaii
+ *
*
*
* @param index The element index.
@@ -520,6 +605,10 @@ public class GoogleSearchBean
{
return String.valueOf(result.getDocumentFiltering());
}
+ else if (property.equalsIgnoreCase("searchKeywords"))
+ {
+ return getKeywords();
+ }
else if (property.equalsIgnoreCase("searchQuery"))
{
return result.getSearchQuery();
@@ -636,6 +725,22 @@ public class GoogleSearchBean
elements = null;
}
+ /**
+ * Validates a string value by insuring it is not null or empty.
+ *
+ * @param stringValue The String value.
+ * @return true if valid, false if not.
+ */
+ private boolean isValidString(String stringValue)
+ {
+ if ((stringValue != null) && (stringValue.trim().length() > 0))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
/**
* Prints the usage and exits.
*/
diff --git a/google-taglib/src/net/thauvin/google/TagUtility.java b/src/net/thauvin/google/TagUtility.java
similarity index 94%
rename from google-taglib/src/net/thauvin/google/TagUtility.java
rename to src/net/thauvin/google/TagUtility.java
index 2203e35..8feadd2 100644
--- a/google-taglib/src/net/thauvin/google/TagUtility.java
+++ b/src/net/thauvin/google/TagUtility.java
@@ -67,6 +67,26 @@ public class TagUtility
*/
public static final String FILTER_PARAM = "filter";
+ /**
+ * The HTTP proxy host.
+ */
+ public static final String GOOGLE_PROXY_HOST = "google_proxy_host";
+
+ /**
+ * The HTTP proxy password.
+ */
+ public static final String GOOGLE_PROXY_PASSWORD = "google_proxy_password";
+
+ /**
+ * The HTTP proxy port.
+ */
+ public static final String GOOGLE_PROXY_PORT = "google_proxy_port";
+
+ /**
+ * The HTTP proxy username.
+ */
+ public static final String GOOGLE_PROXY_USERNAME = "google_proxy_username";
+
/**
* The name of the Google Search bean attribute.
*/
@@ -127,6 +147,11 @@ public class TagUtility
*/
public static final String START_PARAM = "start";
+ /**
+ * The name of the (file) type request parameter.
+ */
+ public static final String TYPE_PARAM = "type";
+
/**
* Protected constructor to disable instantiation.
*/
@@ -267,13 +292,13 @@ public class TagUtility
/**
* Builds a HTML reference link:
*
- * For example: body.
+ * For example: <a href="url" class="css" style="style" target="target">body</a>.
*
* @param url The reference URL.
* @param body The link body text.
* @param target The link target.
* @param style The link CSS style.
- * @param css The link CSS class
+ * @param css The link CSS class.
* @return A HTML reference link.
*/
public static final String buildRefLink(String url, String body,
diff --git a/google-taglib/src/net/thauvin/google/package.html b/src/net/thauvin/google/package.html
similarity index 100%
rename from google-taglib/src/net/thauvin/google/package.html
rename to src/net/thauvin/google/package.html
diff --git a/google-taglib/src/net/thauvin/google/taglibs/CachedPage.java b/src/net/thauvin/google/taglibs/CachedPage.java
similarity index 85%
rename from google-taglib/src/net/thauvin/google/taglibs/CachedPage.java
rename to src/net/thauvin/google/taglibs/CachedPage.java
index 831c71b..5f95617 100644
--- a/google-taglib/src/net/thauvin/google/taglibs/CachedPage.java
+++ b/src/net/thauvin/google/taglibs/CachedPage.java
@@ -4,14 +4,14 @@
* Copyright (c) 2002-2003, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
+ * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
- * Redistributions in binary form must reproduce the above copyright notice,
+ * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
@@ -20,7 +20,7 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
@@ -69,6 +69,15 @@ public class CachedPage extends QuerySupport
{
final GoogleSearchBean bean = new GoogleSearchBean(getKey());
+ bean.setProxyServer(pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_HOST),
+ pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_PORT),
+ pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_USERNAME),
+ pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_PASSWORD));
+
// Output the body
pageContext.getOut().write(bean.getCachedPage(query));
}
diff --git a/google-taglib/src/net/thauvin/google/taglibs/Element.java b/src/net/thauvin/google/taglibs/Element.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/Element.java
rename to src/net/thauvin/google/taglibs/Element.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/EndIndex.java b/src/net/thauvin/google/taglibs/EndIndex.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/EndIndex.java
rename to src/net/thauvin/google/taglibs/EndIndex.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/EstimatedTotal.java b/src/net/thauvin/google/taglibs/EstimatedTotal.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/EstimatedTotal.java
rename to src/net/thauvin/google/taglibs/EstimatedTotal.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/KeySupport.java b/src/net/thauvin/google/taglibs/KeySupport.java
similarity index 99%
rename from google-taglib/src/net/thauvin/google/taglibs/KeySupport.java
rename to src/net/thauvin/google/taglibs/KeySupport.java
index 9fee9fe..af62a6a 100644
--- a/google-taglib/src/net/thauvin/google/taglibs/KeySupport.java
+++ b/src/net/thauvin/google/taglibs/KeySupport.java
@@ -79,13 +79,27 @@ public abstract class KeySupport extends BodyTagSupport
this.key = key;
}
+ /**
+ * Release method.
+ */
+ public void release()
+ {
+ super.release();
+
+ // Reset the key value
+ key = null;
+
+ // Reset the values
+ reset();
+ }
+
/**
* Returns the key attribute.
*
* @return The attribute value.
* @see #setKey(String)
*/
- public String getKey()
+ protected String getKey()
{
if (TagUtility.isValidString(key, true))
{
@@ -130,20 +144,6 @@ public abstract class KeySupport extends BodyTagSupport
return "";
}
- /**
- * Release method.
- */
- public void release()
- {
- super.release();
-
- // Reset the key value
- key = null;
-
- // Reset the values
- reset();
- }
-
/**
* Reset the values.
*/
diff --git a/google-taglib/src/net/thauvin/google/taglibs/Next.java b/src/net/thauvin/google/taglibs/Next.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/Next.java
rename to src/net/thauvin/google/taglibs/Next.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/Previous.java b/src/net/thauvin/google/taglibs/Previous.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/Previous.java
rename to src/net/thauvin/google/taglibs/Previous.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/QuerySupport.java b/src/net/thauvin/google/taglibs/QuerySupport.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/QuerySupport.java
rename to src/net/thauvin/google/taglibs/QuerySupport.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/Search.java b/src/net/thauvin/google/taglibs/Search.java
similarity index 81%
rename from google-taglib/src/net/thauvin/google/taglibs/Search.java
rename to src/net/thauvin/google/taglibs/Search.java
index ddf1e7f..9a3f9ba 100644
--- a/google-taglib/src/net/thauvin/google/taglibs/Search.java
+++ b/src/net/thauvin/google/taglibs/Search.java
@@ -42,98 +42,61 @@ import net.thauvin.google.TagUtility;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
-
/**
* A custom tag used to perform Google searches.
*
* @author Erik C. Thauvin
* @created April 25, 2002
- * @version $Revision$
+ * @version $Revision$, $Date$
* @since 1.0
*/
public class Search extends QuerySupport
{
private GoogleSearchBean bean = null;
- private String lr = GoogleSearchBean.DEFAULT_LR;
- private String restrict = GoogleSearchBean.DEFAULT_RESTRICT;
- private String site = GoogleSearchBean.DEFAULT_SITE;
- private boolean cache = true;
+ private boolean cache = GoogleSearchBean.DEFAULT_CACHE;
private boolean filter = GoogleSearchBean.DEFAULT_FILTER;
- private boolean safeSearch = GoogleSearchBean.DEFAULT_SAFE_SEARCH;
+ private String lr = GoogleSearchBean.DEFAULT_LR;
private int maxResults = GoogleSearchBean.DEFAULT_MAX_RESULTS;
+ private String restrict = GoogleSearchBean.DEFAULT_RESTRICT;
+ private boolean safeSearch = GoogleSearchBean.DEFAULT_SAFE_SEARCH;
+ private String site = GoogleSearchBean.DEFAULT_SITE;
private int start = GoogleSearchBean.DEFAULT_START;
+ private String type = GoogleSearchBean.DEFAULT_TYPE;
/**
* Sets the cache attribute.
*
* @param cache The new attribute value.
- * @see #getCache()
*/
public final void setCache(String cache)
{
this.cache = Boolean.valueOf(cache).booleanValue();
}
- /**
- * Returns the cache attribute.
- *
- * @return The attribute value.
- * @see #setCache(String)
- */
- public final boolean getCache()
- {
- return getBoolParam(TagUtility.CACHE_PARAM, cache);
- }
-
/**
* Sets the (related-query) filter attribute.
*
* @param filter The new attribute value.
- * @see #getFilter()
*/
public final void setFilter(String filter)
{
this.filter = Boolean.valueOf(filter).booleanValue();
}
- /**
- * Returns the (related-query) filter attribute.
- *
- * @return The attribute value.
- * @see #setFilter(String)
- */
- public final boolean getFilter()
- {
- return getBoolParam(TagUtility.FILTER_PARAM, filter);
- }
-
/**
* Sets the lr (language restrict) attribute.
*
* @param lr The new attribute value.
- * @see #getLr()
*/
public final void setLr(String lr)
{
this.lr = lr;
}
- /**
- * Returns the lr (language restrict) attribute.
- *
- * @return The attribute value.
- * @see #setLr(String)
- */
- public final String getLr()
- {
- return getStringParam(TagUtility.LR_PARAM, lr);
- }
-
/**
* Sets the maximum number of results to be returned.
*
* @param maxResults The new attribute value.
- * @see #getMaxResults()
*/
public final void setMaxResults(String maxResults)
{
@@ -143,70 +106,34 @@ public class Search extends QuerySupport
}
catch (NumberFormatException e)
{
- ; // Do nothing
+ ;// Do nothing
}
}
- /**
- * Returns the maximum number of results to be returned.
- *
- * @return The attribute value.
- * @see #setMaxResults(String)
- */
- public final int getMaxResults()
- {
- return getIntParam(TagUtility.MAX_RESULTS_PARAM, maxResults);
- }
-
/**
* Sets the restrict attribute.
*
* @param restrict The new restrict attribute.
- * @see #getRestrict()
*/
public final void setRestrict(String restrict)
{
this.restrict = restrict;
}
- /**
- * Returns the restrict attribute.
- *
- * @return The attribute value.
- * @see #setRestrict(String)
- */
- public final String getRestrict()
- {
- return getStringParam(TagUtility.RESTRICT_PARAM, restrict);
- }
-
/**
* Sets the safeSearch attribute.
*
* @param safeSearch The new attribute value.
- * @see #getSafeSearch()
*/
public final void setSafeSearch(String safeSearch)
{
this.safeSearch = Boolean.valueOf(safeSearch).booleanValue();
}
- /**
- * Returns the safeSearch attribute.
- *
- * @return The attribute value.
- * @see #setSafeSearch(String)
- */
- public final boolean getSafeSearch()
- {
- return getBoolParam(TagUtility.SAFE_SEARCH_PARAM, safeSearch);
- }
-
/**
* Sets the site attribute.
*
* @param site The new attribute value.
- * @see #getSite()
*/
public final void setSite(String site)
{
@@ -214,12 +141,99 @@ public class Search extends QuerySupport
}
/**
- * Returns the stie attribute.
+ * Sets the start attribute.
+ *
+ * @param start The new attribute value.
+ */
+ public final void setStart(String start)
+ {
+ try
+ {
+ this.start = Integer.valueOf(start).intValue();
+ }
+ catch (NumberFormatException e)
+ {
+ ;// Do nothing
+ }
+ }
+
+ /**
+ * Sets the (file) type attribute.
+ *
+ * @param type The new attribute value.
+ * @since 1.0.1
+ */
+ public final void setType(String type)
+ {
+ this.type = type;
+ }
+
+ /**
+ * Returns the cache attribute.
*
* @return The attribute value.
- * @see #setSite(String)
*/
- public final String getSite()
+ private final boolean getCache()
+ {
+ return getBoolParam(TagUtility.CACHE_PARAM, cache);
+ }
+
+ /**
+ * Returns the (related-query) filter attribute.
+ *
+ * @return The attribute value.
+ */
+ private final boolean getFilter()
+ {
+ return getBoolParam(TagUtility.FILTER_PARAM, filter);
+ }
+
+ /**
+ * Returns the lr (language restrict) attribute.
+ *
+ * @return The attribute value.
+ */
+ private final String getLr()
+ {
+ return getStringParam(TagUtility.LR_PARAM, lr);
+ }
+
+ /**
+ * Returns the maximum number of results to be returned.
+ *
+ * @return The attribute value.
+ */
+ private final int getMaxResults()
+ {
+ return getIntParam(TagUtility.MAX_RESULTS_PARAM, maxResults);
+ }
+
+ /**
+ * Returns the restrict attribute.
+ *
+ * @return The attribute value.
+ */
+ private final String getRestrict()
+ {
+ return getStringParam(TagUtility.RESTRICT_PARAM, restrict);
+ }
+
+ /**
+ * Returns the safeSearch attribute.
+ *
+ * @return The attribute value.
+ */
+ private final boolean getSafeSearch()
+ {
+ return getBoolParam(TagUtility.SAFE_SEARCH_PARAM, safeSearch);
+ }
+
+ /**
+ * Returns the site attribute.
+ *
+ * @return The attribute value.
+ */
+ private final String getSite()
{
String site = getStringParam(TagUtility.SITE_PARAM, this.site);
@@ -231,35 +245,100 @@ public class Search extends QuerySupport
return "";
}
- /**
- * Sets the start attribute.
- *
- * @param start The new attribute value.
- * @see #getStart()
- */
- public final void setStart(String start)
- {
- try
- {
- this.start = Integer.valueOf(start).intValue();
- }
- catch (NumberFormatException e)
- {
- ; // Do nothing
- }
- }
-
/**
* Returns the start attribute.
*
* @return The attribute value.
- * @see #setStart(String)
*/
- public final int getStart()
+ private final int getStart()
{
return getIntParam(TagUtility.START_PARAM, start);
}
+ /**
+ * Returns the (file) type attribute.
+ *
+ * @return The attribute value
+ */
+ private final String getType()
+ {
+ String type = getStringParam(TagUtility.TYPE_PARAM, this.type);
+
+ if (type.length() > 0)
+ {
+ return (" filetype:" + type);
+ }
+
+ return "";
+ }
+
+ /**
+ * Converts a request parameter to a boolean.
+ *
+ * @param paramName The parameter name.
+ * @param defaultValue The default value to use if the parameter is empty.
+ * @return The boolean value.
+ */
+ private boolean getBoolParam(String paramName, boolean defaultValue)
+ {
+ String param =
+ TagUtility.getParameter(pageContext.getRequest(), paramName);
+
+ if (TagUtility.isValidString(param, true))
+ {
+ return Boolean.valueOf(param).booleanValue();
+ }
+
+ return defaultValue;
+ }
+
+ /**
+ * Converts a request parameter to an int.
+ *
+ * @param paramName The parameter name.
+ * @param defaultValue The default value to use if the parameter is empty.
+ * @return The int value.
+ */
+ private int getIntParam(String paramName, int defaultValue)
+ {
+ String param =
+ TagUtility.getParameter(pageContext.getRequest(), paramName);
+
+ if (TagUtility.isValidString(param, true))
+ {
+ try
+ {
+ return Integer.valueOf(param).intValue();
+ }
+ catch (NumberFormatException e)
+ {
+ ;// Do nothing
+ }
+ }
+
+ return defaultValue;
+ }
+
+ /**
+ * Converts a request parameter to a string.
+ *
+ * @param paramName The parameter name.
+ * @param defaultValue The default value to use if the parameter is empty.
+ * @return The string value.
+ */
+ private String getStringParam(String paramName, String defaultValue)
+ {
+ String param =
+ TagUtility.getParameter(pageContext.getRequest(), paramName);
+
+ if (TagUtility.isValidString(param, true))
+ {
+ return param;
+ }
+
+ return defaultValue;
+ }
+
/**
* doEndTag method.
*
@@ -267,7 +346,7 @@ public class Search extends QuerySupport
* @exception JspException
*/
public int doEndTag()
- throws JspException
+ throws JspException
{
final String query = getQuery();
@@ -275,9 +354,20 @@ public class Search extends QuerySupport
{
try
{
- bean.getGoogleSearch(getKey(), getSite() + getQuery(),
- getStart(), getMaxResults(), getFilter(),
- getRestrict(), getSafeSearch(), getLr());
+ bean.setProxyServer(pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_HOST),
+ pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_PORT),
+ pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_USERNAME),
+ pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_PASSWORD));
+
+ bean.setKeywords(getQuery());
+
+ bean.getGoogleSearch(getKey(), getSite() + getQuery() + getType(),
+ getStart(), getMaxResults(), getFilter(),
+ getRestrict(), getSafeSearch(), getLr());
}
catch (Exception e)
{
@@ -302,7 +392,7 @@ public class Search extends QuerySupport
* @exception JspException
*/
public int doStartTag()
- throws JspException
+ throws JspException
{
// Get the Google bean
bean = TagUtility.getGoogleSearchBean(pageContext);
@@ -316,7 +406,7 @@ public class Search extends QuerySupport
// Set the bean as named session attribute
pageContext.setAttribute(TagUtility.GOOGLE_SEARCH_BEAN, bean,
- PageContext.SESSION_SCOPE);
+ PageContext.SESSION_SCOPE);
}
catch (Exception e)
{
@@ -342,7 +432,8 @@ public class Search extends QuerySupport
restrict = GoogleSearchBean.DEFAULT_RESTRICT;
lr = GoogleSearchBean.DEFAULT_LR;
site = GoogleSearchBean.DEFAULT_SITE;
- cache = true;
+ cache = GoogleSearchBean.DEFAULT_CACHE;
+ type = GoogleSearchBean.DEFAULT_TYPE;
// Reset the bean
bean = null;
@@ -358,71 +449,4 @@ public class Search extends QuerySupport
{
super.reset();
}
-
- /**
- * Converts a request parameter to a boolean.
- *
- * @param paramName The parameter name.
- * @param defaultValue The default value to use if the parameter is empty.
- * @return The boolean value.
- */
- private boolean getBoolParam(String paramName, boolean defaultValue)
- {
- String param =
- TagUtility.getParameter(pageContext.getRequest(), paramName);
-
- if (TagUtility.isValidString(param, true))
- {
- return Boolean.valueOf(param).booleanValue();
- }
-
- return defaultValue;
- }
-
- /**
- * Converts a request parameter to an int.
- *
- * @param paramName The parameter name.
- * @param defaultValue The default value to use if the parameter is empty.
- * @return The int value.
- */
- private int getIntParam(String paramName, int defaultValue)
- {
- String param =
- TagUtility.getParameter(pageContext.getRequest(), paramName);
-
- if (TagUtility.isValidString(param, true))
- {
- try
- {
- return Integer.valueOf(param).intValue();
- }
- catch (NumberFormatException e)
- {
- ; // Do nothing
- }
- }
-
- return defaultValue;
- }
-
- /**
- * Converts a request parameter to a string.
- *
- * @param paramName The parameter name.
- * @param defaultValue The default value to use if the parameter is empty.
- * @return The string value.
- */
- private String getStringParam(String paramName, String defaultValue)
- {
- String param =
- TagUtility.getParameter(pageContext.getRequest(), paramName);
-
- if (TagUtility.isValidString(param, true))
- {
- return param;
- }
-
- return defaultValue;
- }
}
diff --git a/google-taglib/src/net/thauvin/google/taglibs/SearchComments.java b/src/net/thauvin/google/taglibs/SearchComments.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/SearchComments.java
rename to src/net/thauvin/google/taglibs/SearchComments.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/SearchQuery.java b/src/net/thauvin/google/taglibs/SearchQuery.java
similarity index 80%
rename from google-taglib/src/net/thauvin/google/taglibs/SearchQuery.java
rename to src/net/thauvin/google/taglibs/SearchQuery.java
index de530a7..01c7137 100644
--- a/google-taglib/src/net/thauvin/google/taglibs/SearchQuery.java
+++ b/src/net/thauvin/google/taglibs/SearchQuery.java
@@ -4,14 +4,14 @@
* Copyright (c) 2002-2003, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
+ * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
- * Redistributions in binary form must reproduce the above copyright notice,
+ * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
@@ -20,7 +20,7 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
@@ -36,17 +36,42 @@
*/
package net.thauvin.google.taglibs;
+import net.thauvin.google.TagUtility;
+
/**
* A custom tag used to retrieve the query string of a Google search.
*
* @author Erik C. Thauvin
* @created April 29, 2002
- * @version $Revision$
+ * @version $Revision$, $Date$
* @since 1.0
*/
public class SearchQuery extends SearchResultSupport
{
+ private String type = null;
+
+ /**
+ * Sets the type attribute.
+ *
+ * @param type The new attribute value.
+ * @since 1.0.1
+ */
+ public final void setType(String type)
+ {
+ this.type = type;
+ }
+
+ /**
+ * Release method.
+ */
+ public void release()
+ {
+ super.release();
+
+ type = null;
+ }
+
/**
* Returns the property provided by this tag.
*
@@ -54,7 +79,12 @@ public class SearchQuery extends SearchResultSupport
*/
protected String getPropertyName()
{
- return "searchQuery";
+ if (TagUtility.isValidString(type) && type.equalsIgnoreCase("full"))
+ {
+ return "searchQuery";
+ }
+
+ return "searchKeywords";
}
/**
diff --git a/google-taglib/src/net/thauvin/google/taglibs/SearchResult.java b/src/net/thauvin/google/taglibs/SearchResult.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/SearchResult.java
rename to src/net/thauvin/google/taglibs/SearchResult.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/SearchResultSupport.java b/src/net/thauvin/google/taglibs/SearchResultSupport.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/SearchResultSupport.java
rename to src/net/thauvin/google/taglibs/SearchResultSupport.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/SearchTime.java b/src/net/thauvin/google/taglibs/SearchTime.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/SearchTime.java
rename to src/net/thauvin/google/taglibs/SearchTime.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/SearchTips.java b/src/net/thauvin/google/taglibs/SearchTips.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/SearchTips.java
rename to src/net/thauvin/google/taglibs/SearchTips.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/Spelling.java b/src/net/thauvin/google/taglibs/Spelling.java
similarity index 85%
rename from google-taglib/src/net/thauvin/google/taglibs/Spelling.java
rename to src/net/thauvin/google/taglibs/Spelling.java
index 63f06d8..7814207 100644
--- a/google-taglib/src/net/thauvin/google/taglibs/Spelling.java
+++ b/src/net/thauvin/google/taglibs/Spelling.java
@@ -4,14 +4,14 @@
* Copyright (c) 2002-2003, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
+ * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
- * Redistributions in binary form must reproduce the above copyright notice,
+ * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
@@ -20,7 +20,7 @@
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
@@ -69,6 +69,15 @@ public class Spelling extends QuerySupport
{
final GoogleSearchBean bean = new GoogleSearchBean(getKey());
+ bean.setProxyServer(pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_HOST),
+ pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_PORT),
+ pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_USERNAME),
+ pageContext.getServletContext()
+ .getInitParameter(TagUtility.GOOGLE_PROXY_PASSWORD));
+
String result = bean.getSpellingSuggestion(query);
if (!TagUtility.isValidString(result, true))
diff --git a/google-taglib/src/net/thauvin/google/taglibs/StartIndex.java b/src/net/thauvin/google/taglibs/StartIndex.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/StartIndex.java
rename to src/net/thauvin/google/taglibs/StartIndex.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/StyleSupport.java b/src/net/thauvin/google/taglibs/StyleSupport.java
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/StyleSupport.java
rename to src/net/thauvin/google/taglibs/StyleSupport.java
diff --git a/google-taglib/src/net/thauvin/google/taglibs/package.html b/src/net/thauvin/google/taglibs/package.html
similarity index 100%
rename from google-taglib/src/net/thauvin/google/taglibs/package.html
rename to src/net/thauvin/google/taglibs/package.html
diff --git a/tlds/google-1.2.tld b/tlds/google-1.2.tld
new file mode 100644
index 0000000..2310b72
--- /dev/null
+++ b/tlds/google-1.2.tld
@@ -0,0 +1,251 @@
+
+
+
+
+
+ @version@
+
+ 1.2
+
+ google
+
+ http://www.thauvin.net/taglibs/google-taglib-@version@
+
+ The Google Tag Library.
+
+
+ cachedPage
+ net.thauvin.google.taglibs.CachedPage
+ JSP
+ Displays a page cached by Google.
+
+ key
+ false
+ true
+ Specifies the authentication key.
+
+
+
+
+ element
+ net.thauvin.google.taglibs.Element
+ empty
+ Displays the given property of the current search result element.
+
+ css
+ false
+ true
+ Specifies the HTML link's class attribute.
+
+
+ name
+ true
+ true
+ Specifies the desired property of the current result set item.
+
+
+ style
+ false
+ true
+ Specifies the HTML link's style attribute.
+
+
+ target
+ false
+ true
+ Specifies the HTML link's target attribute.
+
+
+
+
+ endIndex
+ net.thauvin.google.taglibs.EndIndex
+ empty
+ Displays the current search result end index.
+
+
+
+ estimatedTotal
+ net.thauvin.google.taglibs.EstimatedTotal
+ empty
+ Displays the estimated total results count of the current search.
+
+
+
+ next
+ net.thauvin.google.taglibs.Next
+ JSP
+ Displays a link to the next search result set.
+
+ css
+ false
+ true
+ Specifies the HTML link's class attribute.
+
+
+ style
+ false
+ true
+ Specifies the HTML link's style attribute.
+
+
+ target
+ false
+ true
+ Specifies the HTML link's target attribute.
+
+
+
+
+ previous
+ net.thauvin.google.taglibs.Previous
+ JSP
+ Displays a link to the previous search result set.
+
+ css
+ false
+ true
+ Specifies the HTML link's class attribute.
+
+
+ style
+ false
+ true
+ Specifies the HTML link's style attribute.
+
+
+ target
+ false
+ true
+ Specifies the HTML link's target attribute.
+
+
+
+
+ search
+ net.thauvin.google.taglibs.Search
+ JSP
+ Performs a Google search.
+
+ cache
+ false
+ true
+ Specifies whether results are cached between search requests.
+
+
+ filter
+ false
+ true
+ Activates or deactivates automatic results filtering.
+
+
+ key
+ false
+ true
+ Specifies the authentication key.
+
+
+ lr
+ false
+ true
+ Restricts the search to documents within one or more languages.
+
+
+ maxResults
+ false
+ true
+ Specifies the number of results desired per query.
+
+
+ restrict
+ false
+ true
+ Restricts the search to a subset of the Google web index.
+
+
+ safeSearch
+ false
+ true
+ Enables filtering of adult content in the search results.
+
+
+ site
+ false
+ true
+ Restricts the search to documents within the specified site.
+
+
+ start
+ false
+ true
+ Specifies the index of the first desired result.
+
+
+ type
+ false
+ true
+ Specifies the file type to be searched.
+
+
+
+
+ searchComments
+ net.thauvin.google.taglibs.SearchComments
+ empty
+ Displays the current search comments.
+
+
+
+ searchQuery
+ net.thauvin.google.taglibs.SearchQuery
+ empty
+ Displays the current search query.
+
+ type
+ false
+ true
+ Specifies whether the search keywords or full query should be returned.
+
+
+
+
+ searchResult
+ net.thauvin.google.taglibs.SearchResult
+ JSP
+ Loops through the current search results
+
+
+
+ searchTime
+ net.thauvin.google.taglibs.SearchTime
+ empty
+ Displays the elapsed time of the current search.
+
+
+
+ searchTips
+ net.thauvin.google.taglibs.SearchTips
+ empty
+ Displays the search tips of the current search.
+
+
+
+ spelling
+ net.thauvin.google.taglibs.Spelling
+ JSP
+ Performs a Google spelling suggestion.
+
+ key
+ false
+ true
+ Specifies the authentication key.
+
+
+
+
+ startIndex
+ net.thauvin.google.taglibs.StartIndex
+ empty
+ Displays the current search result start index.
+
+
diff --git a/google-taglib/tlds/google.tld b/tlds/google.tld
similarity index 94%
rename from google-taglib/tlds/google.tld
rename to tlds/google.tld
index af98b4f..b2a7496 100644
--- a/google-taglib/tlds/google.tld
+++ b/tlds/google.tld
@@ -11,9 +11,7 @@
http://www.thauvin.net/taglibs/google-taglib-@version@
-
- The Google Tag Library.
-
+ The Google Tag Library.cachedPage
@@ -142,6 +140,11 @@
falsetrue
+
+ restrict
+ false
+ true
+ safeSearchfalse
@@ -157,6 +160,11 @@
falsetrue
+
+ type
+ false
+ true
+
@@ -171,6 +179,11 @@
net.thauvin.google.taglibs.SearchQueryemptyDisplays the current search query.
+
+ type
+ false
+ true
+