Initial import.

This commit is contained in:
Erik C. Thauvin 2003-09-24 14:59:04 +00:00
parent 21d71b07ed
commit 553295f72d
70 changed files with 7349 additions and 0 deletions

5
google-taglib/.cvsignore Normal file
View file

@ -0,0 +1,5 @@
build
dist
javadoc
*.bat
key.txt

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="false">
<component name="LvcsConfiguration">
<option name="LOCAL_VCS_ENABLED" value="true" />
<option name="LOCAL_VCS_PURGING_PERIOD" value="259200000" />
</component>
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/google" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="1.3.x" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/googleapi.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/servlet.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
<component name="ModuleRootManager" />
</module>

View file

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4" relativePaths="true">
<component name="ProjectRootManager" version="2" assert-keyword="false" />
<component name="CodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS" />
<option name="USE_PER_PROJECT_SETTINGS" value="false" />
</component>
<component name="ProjectModuleManager">
<modules>
<module filepath="$PROJECT_DIR$/GoogleTagLib.iml" />
</modules>
</component>
<component name="libraryTable" />
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" />
<option name="OPEN_IN_BROWSER" value="false" />
<option name="OUTPUT_DIRECTORY" />
</component>
<component name="EntryPointsManager">
<entry_points />
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" value="$PROJECT_DIR$/javadoc" />
<option name="OPTION_SCOPE" value="protected" />
<option name="OPTION_HIERARCHY" value="false" />
<option name="OPTION_NAVIGATOR" value="false" />
<option name="OPTION_INDEX" value="false" />
<option name="OPTION_SEPARATE_INDEX" value="false" />
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="false" />
<option name="OPTION_DEPRECATED_LIST" value="false" />
<option name="OTHER_OPTIONS" />
<option name="HEAP_SIZE" />
<option name="OPEN_IN_BROWSER" value="false" />
</component>
<component name="AntConfiguration">
<buildFile url="file://$PROJECT_DIR$/build.xml">
<useEmacsModeOutput value="true" />
<useCustomJdk value="false" />
<treeView value="true" />
<useJavaw value="false" />
<verbose value="true" />
<includeProjectClasspath value="false" />
<includeParser value="true" />
<maximumHeapSize value="128" />
<viewClosedWhenNoErrors value="false" />
</buildFile>
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<option name="CLEAR_OUTPUT_DIRECTORY" value="false" />
<resourceExtensions />
</component>
<component name="JavacSettings">
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="DEPRECATION" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
<option name="MAXIMUM_HEAP_SIZE" value="128" />
<option name="USE_GENERICS_COMPILER" value="false" />
</component>
<component name="JikesSettings">
<option name="JIKES_PATH" value="" />
<option name="DEBUGGING_INFO" value="true" />
<option name="DEPRECATION" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false" />
<option name="DO_FULL_DEPENDENCE_CHECK" value="false" />
<option name="IS_EMACS_ERRORS_MODE" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
<component name="WebManager">
<option enabled="true" />
</component>
<component name="WebRootContainer">
<root url="file://$PROJECT_DIR$/google-examples" name="google-examples" validate="false" />
</component>
<component name="DataSourceManager" />
<component name="ImportConfiguration">
<option name="VENDOR" value="erik" />
<option name="RELEASE_TAG" value="start" />
<option name="LOG_MESSAGE" value="Initial import" />
<option name="CHECKOUT_AFTER_IMPORT" value="false" />
</component>
<component name="Timestamp">
<Timestamp type="block" place="atCaret" userText="Edited by ${user.name}:" timeFormat="dd-MMM-yyyy hh:mm:ss aa zz" />
</component>
<component name="uidesigner-configuration">
<option name="INSTRUMENT_CLASSES" value="true" />
</component>
</project>

View file

@ -0,0 +1,476 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4" relativePaths="true">
<component name="LvcsProjectConfiguration">
<option name="ADD_LABEL_ON_PROJECT_OPEN" value="true" />
<option name="ADD_LABEL_ON_PROJECT_COMPILATION" value="true" />
<option name="ADD_LABEL_ON_FILE_PACKAGE_COMPILATION" value="true" />
<option name="ADD_LABEL_ON_PROJECT_MAKE" value="true" />
<option name="ADD_LABEL_ON_RUNNING" value="true" />
<option name="ADD_LABEL_ON_DEBUGGING" value="true" />
<option name="ADD_LABEL_ON_UNIT_TEST_PASSED" value="true" />
<option name="ADD_LABEL_ON_UNIT_TEST_FAILED" value="true" />
</component>
<component name="PropertiesComponent">
<property name="MemberChooser.copyJavadoc" value="false" />
<property name="GoToClass.includeLibraries" value="false" />
<property name="MemberChooser.showClasses" value="true" />
<property name="MemberChooser.sorted" value="false" />
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
</component>
<component name="ToolWindowManager">
<frame x="-4" y="-4" width="1032" height="776" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="BeanShell" active="false" anchor="bottom" auto_hide="true" internal_type="sliding" type="sliding" visible="false" weight="0.32972136" order="8" />
<window_info id="JavaSig" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="11" />
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.32972136" order="11" />
<window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.24948665" order="2" />
<window_info id="Javadoc" active="false" anchor="right" auto_hide="true" internal_type="sliding" type="sliding" visible="false" weight="0.33028457" order="3" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33126935" order="6" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.3059548" order="0" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.32972136" order="1" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.28131416" order="1" />
<window_info id="Aspects" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="4" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="true" internal_type="sliding" type="sliding" visible="false" weight="0.33490565" order="9" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.3993808" order="5" x="20" y="255" width="984" height="258" />
<window_info id="DocBrowser" active="false" anchor="left" auto_hide="true" internal_type="sliding" type="sliding" visible="false" weight="1.0" order="3" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.20225872" order="1" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.52167183" order="2" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2" />
<window_info id="CVS File View" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="4" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="sliding" type="sliding" visible="false" weight="0.4004065" order="0" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4" order="3" />
<window_info id="Scratchpad" active="false" anchor="bottom" auto_hide="true" internal_type="sliding" type="sliding" visible="false" weight="0.32972136" order="10" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="0" />
<window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="7" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.249226" order="4" />
</layout>
</component>
<component name="ErrorTreeViewConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="HIDE_WARNINGS" value="false" />
</component>
<component name="StructureViewFactory">
<option name="SORT_MODE" value="0" />
<option name="GROUP_INHERITED" value="true" />
<option name="AUTOSCROLL_MODE" value="true" />
<option name="SHOW_FIELDS" value="true" />
<option name="AUTOSCROLL_FROM_SOURCE" value="false" />
<option name="GROUP_GETTERS_AND_SETTERS" value="true" />
<option name="SHOW_INHERITED" value="false" />
<option name="HIDE_NOT_PUBLIC" value="false" />
</component>
<component name="ProjectViewSettings">
<navigator currentView="SourcepathPane" flattenPackages="false" showMembers="false" showStructure="false" autoscrollToSource="false" splitterProportion="0.5" />
<view id="ProjectPane">
<expanded_node type="directory" url="file://$PROJECT_DIR$" />
</view>
<view id="SourcepathPane">
<expanded_node type="directory" url="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs" />
<expanded_node type="directory" url="file://$PROJECT_DIR$/src/net/thauvin/google" />
<expanded_node type="directory" url="file://$PROJECT_DIR$/src/net" />
<expanded_node type="directory" url="file://$PROJECT_DIR$/src" />
<expanded_node type="directory" url="file://$PROJECT_DIR$/src/net/thauvin" />
</view>
<view id="ClasspathPane" />
</component>
<component name="Commander">
<leftPanel view="Project" />
<rightPanel view="Project" />
<splitter proportion="0.5" />
</component>
<component name="AspectsView" />
<component name="SelectInManager" />
<component name="HierarchyBrowserManager">
<option name="SHOW_PACKAGES" value="false" />
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="SORT_ALPHABETICALLY" value="false" />
</component>
<component name="TodoView" selected-index="0">
<todo-panel id="selected-file">
<are-packages-shown value="false" />
<flatten-packages value="false" />
<is-autoscroll-to-source value="true" />
</todo-panel>
<todo-panel id="all">
<are-packages-shown value="true" />
<flatten-packages value="false" />
<is-autoscroll-to-source value="true" />
</todo-panel>
</component>
<component name="FileEditorManager" selected-file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/Search.java">
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/Search.java">
<provider selected="true" editor-type-id="text-editor">
<state line="53" column="13" selection-start="2004" selection-end="2004" vertical-scroll-proportion="0.40202704">
<folding />
</state>
</provider>
</entry>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/SearchQuery.java">
<provider selected="true" editor-type-id="text-editor">
<state line="47" column="13" selection-start="1930" selection-end="1930" vertical-scroll-proportion="0.2394636">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.properties">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="31" column="73" selection-start="982" selection-end="982" vertical-scroll-proportion="0.7162162">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/EndIndex.java">
<provider selected="true" editor-type-id="text-editor">
<state line="47" column="13" selection-start="1868" selection-end="1868" vertical-scroll-proportion="0.3445946">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tlds/google.tld">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="43" selection-start="43" selection-end="43" vertical-scroll-proportion="-0.8006757">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/CachedPage.java">
<provider selected="true" editor-type-id="text-editor">
<state line="100" column="19" selection-start="2710" selection-end="2710" vertical-scroll-proportion="0.6612319">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/QuerySupport.java">
<provider selected="true" editor-type-id="text-editor">
<state line="60" column="16" selection-start="2207" selection-end="2207" vertical-scroll-proportion="-0.38586956">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/SearchResultSupport.java">
<provider selected="true" editor-type-id="text-editor">
<state line="183" column="19" selection-start="4595" selection-end="4595" vertical-scroll-proportion="0.6612319">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/Spelling.java">
<provider selected="true" editor-type-id="text-editor">
<state line="107" column="19" selection-start="2855" selection-end="2855" vertical-scroll-proportion="0.6612319">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/Element.java">
<provider selected="true" editor-type-id="text-editor">
<state line="61" column="22" selection-start="2144" selection-end="2144" vertical-scroll-proportion="0.17391305">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/KeySupport.java">
<provider selected="true" editor-type-id="text-editor">
<state line="76" column="22" selection-start="2632" selection-end="2632" vertical-scroll-proportion="0.17391305">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/StyleSupport.java">
<provider selected="true" editor-type-id="text-editor">
<state line="91" column="22" selection-start="2572" selection-end="2572" vertical-scroll-proportion="0.17391305">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/TagUtility.java">
<provider selected="true" editor-type-id="text-editor">
<state line="62" column="31" selection-start="2215" selection-end="2215" vertical-scroll-proportion="-10.371622">
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/GoogleSearchBean.java">
<provider selected="true" editor-type-id="text-editor">
<state line="634" column="22" selection-start="17548" selection-end="17548" vertical-scroll-proportion="17.028717">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/google/taglibs/Search.java">
<provider selected="true" editor-type-id="text-editor">
<state line="53" column="13" selection-start="2004" selection-end="2004" vertical-scroll-proportion="0.40202704">
<folding />
</state>
</provider>
</entry>
</component>
<component name="DaemonCodeAnalyzer">
<disable_hints />
</component>
<component name="InspectionManager">
<option name="AUTOSCROLL_TO_SOURCE" value="false" />
<option name="SPLITTER_PROPORTION" value="0.5" />
<profile name="Default" />
</component>
<component name="BookmarkManager" />
<component name="DebuggerManager">
<line_breakpoints />
<exception_breakpoints>
<breakpoint_any>
<option name="NOTIFY_CAUGHT" value="true" />
<option name="NOTIFY_UNCAUGHT" value="true" />
<option name="ENABLED" value="false" />
<option name="SUSPEND_VM" value="true" />
<option name="LOG_ENABLED" value="false" />
<option name="LOG_EXPRESSION_ENABLED" value="false" />
<option name="LOG_MESSAGE" />
<option name="COUNT_FILTER_ENABLED" value="false" />
<option name="COUNT_FILTER" value="0" />
<option name="CONDITION_ENABLED" value="false" />
<option name="CONDITION" />
<option name="CLASS_FILTERS_ENABLED" value="false" />
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
</breakpoint_any>
</exception_breakpoints>
<field_breakpoints />
<method_breakpoints />
</component>
<component name="DebuggerSettings">
<option name="TRACING_FILTERS_ENABLED" value="true" />
<option name="TOSTRING_CLASSES_ENABLED" value="false" />
<option name="VALUE_LOOKUP_DELAY" value="700" />
<option name="DEBUGGER_TRANSPORT" value="0" />
<option name="FORCE_CLASSIC_VM" value="true" />
<option name="HIDE_DEBUGGER_ON_PROCESS_TERMINATION" value="false" />
<option name="SKIP_SYNTHETIC_METHODS" value="true" />
<option name="SKIP_CONSTRUCTORS" value="false" />
<option name="STEP_THREAD_SUSPEND_POLICY" value="SuspendThread" />
<filter>
<option name="PATTERN" value="com.sun.*" />
<option name="ENABLED" value="true" />
</filter>
<filter>
<option name="PATTERN" value="java.*" />
<option name="ENABLED" value="true" />
</filter>
<filter>
<option name="PATTERN" value="javax.*" />
<option name="ENABLED" value="true" />
</filter>
<filter>
<option name="PATTERN" value="org.omg.*" />
<option name="ENABLED" value="true" />
</filter>
<filter>
<option name="PATTERN" value="sun.*" />
<option name="ENABLED" value="true" />
</filter>
<filter>
<option name="PATTERN" value="junit.*" />
<option name="ENABLED" value="true" />
</filter>
</component>
<component name="CompilerWorkspaceConfiguration">
<option name="COMPILE_IN_BACKGROUND" value="false" />
<option name="AUTO_SHOW_ERRORS_IN_EDITOR" value="true" />
</component>
<component name="RunManager">
<option name="SHOW_SETTINGS_BEFORE_RUNNING" value="true" />
<option name="COMPILE_BEFORE_RUNNING" value="true" />
<activeType name="Application" />
<configuration name="&lt;template&gt;" type="Application" default="true" selected="false">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
</configuration>
<configuration name="&lt;template&gt;" type="Applet" default="true" selected="false">
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$PROJECT_DIR$/../../../../IntelliJ_IDEA/config/appletviewer.policy" />
<option name="VM_PARAMETERS" />
</configuration>
<configuration name="&lt;template&gt;" type="JUnit" default="true" selected="false">
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ADDITIONAL_CLASS_PATH" />
</configuration>
<configuration name="&lt;template&gt;" type="Remote" default="true" selected="false">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5000" />
</configuration>
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<WebServerIntegration name="" />
<Host>localhost</Host>
<Port>5050</Port>
<LaunchServer>false</LaunchServer>
</configuration>
<configuration name="Main" type="Application" default="false" selected="true">
<option name="MAIN_CLASS_NAME" value="net.thauvin.google.GoogleSearchBean" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
</configuration>
</component>
<component name="VcsManagerConfiguration">
<option name="ACTIVE_VCS_NAME" value="CVS" />
</component>
<component name="VssConfiguration">
<CheckoutOptions>
<option name="COMMENT" value="" />
<option name="DO_NOT_GET_LATEST_VERSION" value="false" />
<option name="REPLACE_WRITABLE" value="false" />
<option name="RECURSIVE" value="false" />
</CheckoutOptions>
<CheckinOptions>
<option name="COMMENT" value="" />
<option name="KEEP_CHECKED_OUT" value="false" />
<option name="RECURSIVE" value="false" />
</CheckinOptions>
<AddOptions>
<option name="COMMENT" value="" />
<option name="STORE_ONLY_LATEST_VERSION" value="false" />
<option name="CHECK_OUT_IMMEDIATELY" value="false" />
<option name="FILE_TYPE" value="0" />
</AddOptions>
<UndocheckoutOptions>
<option name="MAKE_WRITABLE" value="false" />
<option name="REPLACE_LOCAL_COPY" value="0" />
<option name="RECURSIVE" value="false" />
</UndocheckoutOptions>
<DiffOptions>
<option name="IGNORE_WHITE_SPACE" value="false" />
<option name="IGNORE_CASE" value="false" />
</DiffOptions>
<GetOptions>
<option name="REPLACE_WRITABLE" value="0" />
<option name="MAKE_WRITABLE" value="false" />
<option name="RECURSIVE" value="false" />
</GetOptions>
<option name="CLIENT_PATH" value="" />
<option name="SRCSAFEINI_PATH" value="" />
<option name="USER_NAME" value="" />
<option name="PWD" value="" />
<option name="SHOW_CHECKOUT_OPTIONS" value="true" />
<option name="SHOW_ADD_OPTIONS" value="true" />
<option name="SHOW_UNDOCHECKOUT_OPTIONS" value="true" />
<option name="SHOW_DIFF_OPTIONS" value="true" />
<option name="SHOW_GET_OPTIONS" value="true" />
<option name="USE_EXTERNAL_DIFF" value="false" />
<option name="EXTERNAL_DIFF_PATH" value="" />
<option name="REUSE_LAST_COMMENT" value="false" />
<option name="PUT_FOCUS_INTO_COMMENT" value="false" />
<option name="SHOW_CHECKIN_OPTIONS" value="true" />
<option name="LAST_COMMIT_MESSAGE" value="" />
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
<option name="OPTIMIZE_IMPORTS_BEFORE_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_COMMIT" value="false" />
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
</component>
<component name="CheckinPanelState" />
<component name="VCS.FileViewConfiguration">
<option name="SELECTED_STATUSES" value="DEFAULT" />
<option name="SELECTED_COLUMNS" value="DEFAULT" />
<option name="SHOW_FILTERS" value="true" />
<option name="CUSTOMIZE_VIEW" value="true" />
<option name="SHOW_FILE_HISTORY_AS_TREE" value="true" />
</component>
<component name="WebViewSettings">
<webview flattenPackages="false" showMembers="false" autoscrollToSource="false" />
</component>
<component name="AppServerRunManager" />
<component name="Cvs2Configuration">
<option name="REQUEST_FOR_COMMENTS" value="true" />
<option name="PRUNE_EMPTY_DIRECTORIES" value="true" />
<option name="SHOW_UPDATE_OPTIONS" value="true" />
<option name="SHOW_ADD_OPTIONS" value="true" />
<option name="SHOW_REMOVE_OPTIONS" value="false" />
<option name="MERGE_WITH_BRANCH1" value="false" />
<option name="MERGE_WITH_BRANCH1_NAME" value="HEAD" />
<option name="RESET_STICKY" value="false" />
<option name="CREATE_NEW_DIRECTORIES" value="true" />
<option name="DEFAULT_TEXT_FILE_SUBSTITUTION" value="v" />
<option name="PROCESS_UNKNOWN_FILES" value="false" />
<option name="PROCESS_DELETED_FILES" value="false" />
<option name="SHOW_EDIT_DIALOG" value="false" />
<option name="RESERVED_EDIT" value="false" />
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
<option name="OFFLINE_MODE" value="false" />
<option name="SHOW_CHECKOUT_OPTIONS" value="true" />
<option name="CHECKOUT_BY_BRANCH" value="false" />
<option name="CHECKOUT_BY_DATE" value="false" />
<option name="CHECKOUT_BRANCH" value="" />
<option name="CHECKOUT_DATE" value="" />
<option name="SHOW_OUTPUT" value="true" />
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
<option name="USE_EXTERNAL_DIFF_TOOL" value="false" />
<option name="PATH_TO_THE_EXTERNAL_DIFF_TOOL" value="" />
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
<option name="PUT_FOCUS_INTO_COMMENT" value="false" />
<option name="SHOW_CHECKIN_OPTIONS" value="true" />
<option name="LAST_COMMIT_MESSAGE" value="" />
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
<option name="OPTIMIZE_IMPORTS_BEFORE_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_COMMIT" value="false" />
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
</component>
<component name="JavadocPlugin.JavadocProjectComponent">
<JavadocEntries>
<JavadocEntry>
<option name="path" value="$PROJECT_DIR$/../../../../jdk1.3.1_08/docs/api/" />
<option name="name" value="C/jdk1.3.1_08/docs/api/" />
<option name="indexed" value="false" />
</JavadocEntry>
<JavadocEntry>
<option name="path" value="$PROJECT_DIR$/../../../jdk1.3.1_08/docs/api/" />
<option name="name" value="C/jdk1.3.1_08/docs/api/" />
<option name="indexed" value="false" />
</JavadocEntry>
</JavadocEntries>
</component>
<component name="JavaSig" />
<component name="StarteamConfiguration">
<option name="SERVER" value="" />
<option name="PORT" value="49201" />
<option name="USER" value="" />
<option name="PASSWORD" value="" />
<option name="PROJECT" value="" />
<option name="VIEW" value="" />
<option name="ALTERNATIVE_WORKING_PATH" value="" />
<option name="PUT_FOCUS_INTO_COMMENT" value="false" />
<option name="SHOW_CHECKIN_OPTIONS" value="true" />
<option name="LAST_COMMIT_MESSAGE" value="" />
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
<option name="OPTIMIZE_IMPORTS_BEFORE_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_COMMIT" value="false" />
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
</component>
</project>

85
google-taglib/README.txt Normal file
View file

@ -0,0 +1,85 @@
Google Tag Library README
=========================
Overview
========
This README file describes the Google Tag Library 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.
Installation
============
The Google Tag Library requires a JSP (1.1 or higher) container, such as
Tomcat.
To use the Google Tag Library, simply copy the library's JAR file
(google.jar) to your application's WEB-INF/lib directory. The Tag Library
Descriptor (google.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 Tag Library TLD URI to its location:
<taglib>
<taglib-uri>/google-taglib</taglib-uri>
<taglib-location>/WEB-INF/google.tld</taglib-location>
</taglib>
Google Web APIs
===============
The Google Web APIs Java library is required in order to use the Google Tag
Library. 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:
<context-param>
<param-name>google_key</param-name>
<param-value>000000000000000000000000</param-value>
</context-param>
The license key can also be specified using the key search form parameter,
key tag attribute or the google_key application scope attribute.
TagLib Directive
================
Using the Google 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-taglib" prefix="google"%>
===========================================================================
$Id$

View file

@ -0,0 +1,24 @@
# Version
version=1.0
# Project
project.name=google
release.name=${project.name}-taglib-${version}
# Locations
src.dir=src
build.dir=build
dist.dir=dist
lib.dir=lib
tlds.dir=tlds
licenses.dir=licenses
war.dir=${project.name}-examples
# Javadoc
javadoc.dir=javadoc
javadoc.title=Google Tag Library
javadoc.packages=net.thauvin.google.*
# Docs
doc.license=LICENSE.txt
doc.readme=README.txt

108
google-taglib/build.xml Normal file
View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="google" default="jar" basedir=".">
<description>Google Tag Library</description>
<!-- Load the properties -->
<property file="build.properties"/>
<!-- Build Locations -->
<property name="build.library" value="${build.dir}/${project.name}"/>
<property name="build.war" value="${build.dir}/${war.dir}"/>
<property name="build.release" value="${build.dir}/${release.name}"/>
<!-- Jar excludes directories and files -->
<patternset id="jar.excludes">
<exclude name="**/*.java"/>
<exclude name="**/*.xml"/>
<exclude name="**/*.html"/>
<exclude name="**/.dependency-info/**"/>
</patternset>
<!-- Classpath -->
<path id="classpath">
<pathelement location="."/>
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
</path>
<!-- Prepare target -->
<target name="prepare">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${javadoc.dir}"/>
</target>
<!-- Compile target -->
<target name="compile" depends="prepare" description="Compiles sources">
<mkdir dir="${build.library}"/>
<javac srcdir="${src.dir}" destdir="${build.library}" target="1.1">
<classpath refid="classpath"/>
</javac>
</target>
<!-- JAR target -->
<target name="jar" depends="compile" description="Builds the JAR">
<!-- Create the JAR -->
<jar jarfile="${dist.dir}/${project.name}.jar">
<fileset dir="${build.library}">
<patternset refid="jar.excludes"/>
</fileset>
</jar>
</target>
<!-- WAR target -->
<target name="war" depends="jar" description="Builds the WAR">
<!-- Copy the WAR dir -->
<copy todir="${build.war}">
<fileset dir="${war.dir}"/>
</copy>
<!-- Copy the TLD -->
<filter token="version" value="${version}"/>
<copy file="${tlds.dir}/${project.name}.tld" todir="${build.war}/WEB-INF" filtering="true"/>
<!-- Copy the license -->
<copy file="${licenses.dir}/${doc.license}" todir="${build.war}"/>
<!-- Copy the JAR -->
<copy file="${dist.dir}/${project.name}.jar" todir="${build.war}/WEB-INF/lib/"/>
<!-- Create the web archive -->
<jar jarfile="${dist.dir}/${war.dir}-${version}.war" basedir="${build.war}"/>
</target>
<!-- Release target -->
<target name="release" depends="jar" description="Builds the release distribution">
<mkdir dir="${build.release}"/>
<!-- Copy the TLD -->
<filter token="version" value="${version}"/>
<copy file="${tlds.dir}/${project.name}.tld" todir="${build.release}" filtering="true"/>
<!-- Copy the license -->
<copy file="${licenses.dir}/${doc.license}" todir="${build.release}"/>
<!-- Copy the readme -->
<copy file="${doc.readme}" todir="${build.release}"/>
<!-- Copy the JAR -->
<copy file="${dist.dir}/${project.name}.jar" todir="${build.release}"/>
<!-- Create the ZIP archive -->
<zip destfile="${dist.dir}/${release.name}.zip" basedir="${build.release}"/>
</target>
<!-- Javadoc target -->
<target name="javadoc" depends="prepare" description="Builds the Javadoc">
<delete quiet="true" includeEmptyDirs="true">
<fileset dir="${javadoc.dir}" includes="*,*/**"/>
</delete>
<javadoc sourcepath="${src.dir}" destdir="${javadoc.dir}" packagenames="${javadoc.packages}" windowtitle="${javadoc.title}" verbose="false" failonerror="true" additionalparam="-breakiterator -tag created:Xt:&quot;Created:&quot;">
<classpath refid="classpath"/>
</javadoc>
</target>
<!-- DocCheck target -->
<target name="doccheck" depends="prepare" description="Checks the Javadoc">
<delete quiet="true" includeEmptyDirs="true">
<fileset dir="${javadoc.dir}" includes="*,*/**"/>
</delete>
<javadoc sourcepath="${src.dir}" packagenames="${javadoc.packages}" destdir="${javadoc.dir}" verbose="false" failonerror="true" doclet="com.sun.tools.doclets.doccheck.DocCheck" docletpath="${lib.dir}\doccheck.jar">
<classpath refid="classpath"/>
</javadoc>
</target>
<!-- Clean Build target -->
<target name="clean-build" description="Cleans the build directory">
<delete quiet="true" includeEmptyDirs="true">
<fileset dir="${build.dir}" includes="*,*/**"/>
</delete>
</target>
<!-- Clean target -->
<target name="clean" depends="clean-build" description="Cleans the build and dist directories">
<delete quiet="true" includeEmptyDirs="true">
<fileset dir="${dist.dir}" includes="*,*/**"/>
</delete>
</target>
</project>

View file

@ -0,0 +1,64 @@
Google Tag Library Examples README
==================================
Overview
========
This README file describes the Google Tag Library Examples web application.
This web application contains a collection of examples demonstrating the
usage of the Google JSP Tag Library. 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 use the Google Tag
Library. 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:
<context-param>
<param-name>google_key</param-name>
<param-value>000000000000000000000000</param-value>
</context-param>
The license key can also be temporarily specified from the index page of
the web application.
Examples
========
The following examples are included:
- Perform a simple Google search
- Perform an advanced Google search
- View a page cached by Google
- Perform a Google spelling suggestion
===========================================================================
$Id$

View file

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<display-name>google-examples</display-name>
<description>Google Examples Web Application</description>
<context-param>
<param-name>google_key</param-name>
<param-value/>
<description>The Google Web APIs client authorization key.</description>
</context-param>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/google-taglib</taglib-uri>
<taglib-location>/WEB-INF/google.tld</taglib-location>
</taglib>
</web-app>

View file

@ -0,0 +1,113 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Search Google</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<!--
Copyright (c) 2002-2003, Erik C. Thauvin
All rights reserved.
-->
<body bgcolor="#FFFFFF" text="#000000">
<form action="advanced.jsp" method="get">
<table cellspacing="0" cellpadding="3" border="0" width="99%">
<tr bgcolor="#cbdced">
<td>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr bgcolor="#cbdced">
<td>
<table width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="15%"><font size="-1"><b>Find results</b></font> </td>
<td width="85%">
<table width="100%" cellpadding="2" cellspacing="0">
<tr>
<td><font size="-1">with <b>all</b> of the words</font></td>
<td><input type="text" value="" name="q" size="25"></td>
<td valign="top" rowspan="4"><font size="-1">
<select name="maxResults">
<option value="1">1 result</option>
<option value="2">2 results</option>
<option value="5">5 results</option>
<option value="8">8 results</option>
<option value="10" selected>10 results</option>
</select>
<input type="submit" name="btnG" value="Google Search"></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#ffffff">
<td>
<table width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="15%"><font size="-1"><b>Language</b></font></td>
<td width="40%"><font size="-1">Return pages written in</font></td>
<td><font size="-1">
<select name="lr">
<option value="">any language</option>
<option value="lang_ar">Arabic</option>
<option value="lang_bg">Bulgarian</option>
<option value="lang_ca">Catalan</option>
<option value="lang_zh-CN">Chinese&nbsp;(Simplified)</option>
<option value="lang_zh-TW">Chinese&nbsp;(Traditional)</option>
<option value="lang_hr">Croatian</option>
<option value="lang_cs">Czech</option>
<option value="lang_da">Danish</option>
<option value="lang_nl">Dutch</option>
<option value="lang_en">English</option>
<option value="lang_et">Estonian</option>
<option value="lang_fi">Finnish</option>
<option value="lang_fr">French</option>
<option value="lang_de">German</option>
<option value="lang_el">Greek</option>
<option value="lang_iw">Hebrew</option>
<option value="lang_hu">Hungarian</option>
<option value="lang_is">Icelandic</option>
<option value="lang_id">Indonesian</option>
<option value="lang_it">Italian</option>
<option value="lang_ja">Japanese</option>
<option value="lang_ko">Korean</option>
<option value="lang_lv">Latvian</option>
<option value="lang_lt">Lithuanian</option>
<option value="lang_no">Norwegian</option>
<option value="lang_pl">Polish</option>
<option value="lang_pt">Portuguese</option>
<option value="lang_ro">Romanian</option>
<option value="lang_ru">Russian</option>
<option value="lang_sr">Serbian</option>
<option value="lang_sk">Slovak</option>
<option value="lang_sl">Slovenian</option>
<option value="lang_es">Spanish</option>
<option value="lang_sv">Swedish</option>
<option value="lang_tr">Turkish</option>
</select>
</font>
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#ffffff">
<td>
<table width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="15%"><font size="-1"><b>SafeSearch</b></font></td>
<td colspan="2" nowrap><font size="-1"><input type="radio" checked name="safeSearch" value="">No filtering&nbsp;&nbsp;<input type="radio" value="true" name="safeSearch">Filter using SafeSearch</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>

View file

@ -0,0 +1,52 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/google-taglib" prefix="google" %>
<google:search/>
<html>
<head>
<title>Google Search: <google:searchQuery/></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,div,.p,a{font-family:arial,sans-serif}
div,td{color:#000}
.f,.fl:link{color:#6f6f6f}
a:link,.w,a.w:link,.w a:link{color:#00c}
a:visited,.fl:visited{color:#551a8b}
a:active,.fl:active{color:#f00}
.b{font-size: 12pt; color:#00c; font-weight:bold}
//-->
</style>
</head>
<!--
Copyright (c) 2002-2003, Erik C. Thauvin
All rights reserved.
-->
<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0" cellpadding="2" cellspacing="0">
<tr>
<td bgcolor="#3366cc"><font size="-1" color="#ffffff">Searched the web for <b><google:searchQuery/></b>. &nbsp; </font></td>
<td bgcolor="#3366cc" align="right"><font size="-1" color="#ffffff">Results <b><google:startIndex/></b> - <b><google:endIndex/></b> of about <b><google:estimatedTotal/></b>. Search took <b><google:searchTime/></b> seconds.</font>
</table>
<google:searchResult>
<p><google:element name="title-url" target="_blank"/><br>
<font size="-1"><google:element name="snippet"/></font>
<br>
<span class="f"><font size="-1">Description:</font></span> <font size="-1"><google:element name="summary"/></font><br>
<span class="f"><font size="-1">Category:</font></span> <font size="-1"><a class="fl" href="http://directory.google.com/<google:element name="directoryCategoryName"/>" target="_blank"><google:element name="directoryCategoryName"/></a></font><br>
<font size="-1" color="#008000"><google:element name="staticQuery"/> - <a class="fl" href="cache.jsp?q=<google:element name="cachedQuery"/>" target="_blank">Cached</a> - <google:element name="cachedSize"/> - <a class="fl" href="advanced.jsp?q=<google:element name="relatedQuery"/>">Similar Pages</a></font>
</google:searchResult>
<p>
<table width="100%">
<tr>
<td align="left">
<google:previous css="b">Previous</google:previous>
&nbsp;
</td>
<td align="right">
&nbsp;
<google:next css="b">Next</google:next>
</td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Google Cached Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<!--
Copyright (c) 2002-2003, Erik C. Thauvin
All rights reserved.
-->
<body bgcolor="#FFFFFF" text="#000000">
<form action="cache.jsp" method="get">
<input maxLength="256" size="35" name="q" value="">&nbsp;
<input type="submit" value="Cached Page" name="btnG">
</form>
</body>
</html>

View file

@ -0,0 +1,2 @@
<%@ taglib uri="/google-taglib" prefix="google" %>
<google:cachedPage/>

View file

@ -0,0 +1,83 @@
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Google Tag Library Examples</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {font-family:arial,sans-serif}
-->
</style>
</head>
<!--
Copyright (c) 2002-2003, Erik C. Thauvin
All rights reserved.
-->
<body bgcolor="#FFFFFF" text="#000000">
<b><font size="+2">Google Tag Library Examples</font></b>
<p>
This is a collection of examples demonstrating the usage of the <a href="http://google-taglib.sourceforge.net">Google
JSP Tag Library</a>.
</p>
<p>
The Google Web APIs Java library is required in order to use the Google Tag
Library. The library's JAR file (<code>googleapi.jar</code>) should be placed
into the application's <code>WEB-INF/lib</code> directory.
</p>
<ul>
<li>
<a href="http://www.google.com/apis/download.html"><b>Download the Google Web
APIs developer's kit</b></a>
</li>
</ul>
<p>
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.
</p>
<ul>
<li>
<a href="https://www.google.com/accounts/NewAccount"><b>Sign up for a Google
account</b></a>
</ul>
<p>
The license key can be specified as a context parameter in the web application
deployment descriptor (<code>web.xml</code>) as follows:
</p>
<blockquote>
<pre>&lt;context-param&gt;<br> &lt;param-name&gt;google_key&lt;/param-name&gt;<br> &lt;param-value&gt;000000000000000000000000&lt;/param-value&gt;<br>&lt;/context-param&gt;</pre>
</blockquote>
<p>
The license key can also be temporarily specified using the following:
</p>
<ul>
<li>
<a href="key.html"><b>Set the Google Web APIs license key</b></a>
</li>
</ul>
<p>
The included examples will allow you to:
</p>
<ul>
<li>
<a href="search.html"><b>Perform a simple Google search</b></a>
</li>
<li>
<a href="advanced.html"><b>Perform an advanced Google search</b></a>
</li>
<li>
<a href="cache.html"><b>View a page cached by Google</b></a>
</li>
<li>
<a href="spelling.html"><b>Perform a Google spelling suggestion</b></a>
</li>
</ul>
<p>&nbsp;</p>
<p>
<small>The Google Tag Library uses the Google Web APIs, but is not associated with
or sponsored by Google, Inc.
<br>
Click <a href="LICENSE.txt">here</a> for licensing information.
</small>
</p>
</body>
</html>

View file

@ -0,0 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Set Google Key</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<!--
Copyright (c) 2002-2003, Erik C. Thauvin
All rights reserved.
-->
<body bgcolor="#FFFFFF" text="#000000">
<form action="key.jsp" method="post">
<input size="35" name="key" value="">&nbsp;<input type="submit" value="Set Google Key" name="btnG">
</form>
</body>
</html>

View file

@ -0,0 +1,21 @@
<%
// 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);
%>
<%@include file="advanced.html"%>
<%
}
else
{
%>
<%@include file="key.html"%>
<%
}
%>

View file

@ -0,0 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Search Google</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<!--
Copyright (c) 2002-2003, Erik C. Thauvin
All rights reserved.
-->
<body bgcolor="#FFFFFF" text="#000000">
<form action="search.jsp" method="get">
<input type="hidden" name="maxResults" value="5"><input maxLength="255" size="35" name="q" value="">&nbsp;<input type="submit" value="Google Search" name="btnG">
</form>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/google-taglib" prefix="google" %>
<google:search/>
<html>
<head>
<title>Google Search: <google:searchQuery/></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<!--
Copyright (c) 2002-2003, Erik C. Thauvin
All rights reserved.
-->
<body bgcolor="#FFFFFF" text="#000000">
<ol>
<google:searchResult>
<li><google:element name="title-url" target="_blank"/></li>
</google:searchResult>
</ol>
</body>
</html>

View file

@ -0,0 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Google Spelling Suggestion</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<!--
Copyright (c) 2002-2003, Erik C. Thauvin
All rights reserved.
-->
<body bgcolor="#FFFFFF" text="#000000">
<form action="spelling.jsp" method="get">
<input maxLength="255" size="35" name="q" value="">&nbsp;<input type="submit" value="Spelling Suggestion" name="btnG">
</form>
</body>
</html>

View file

@ -0,0 +1,15 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/google-taglib" prefix="google" %>
<html>
<head>
<title>Google Spelling Suggestion</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<!--
Copyright (c) 2002-2003, Erik C. Thauvin
All rights reserved.
-->
<body bgcolor="#FFFFFF" text="#000000">
<google:spelling/>
</body>
</html>

View file

@ -0,0 +1,89 @@
<html>
<head>
<link rel="stylesheet" href="includes/google.css">
<title>Google Tag Library - About</title>
<style type="text/css">
body,td,font,p,a{font-family:arial,sans-serif}
</style>
</head>
<body class="siteowners" bgcolor="#ffffff" text="#000000" link="#0000CC" vlink="#800080" alink="#ff0000" topmargin="2">
<table width="95%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="1%"><a href="index.html"><img src="images/google-logo.png" border="0" width="143" height="37" alt="Return to Google homepage." vspace="5"></a>
</td>
<td valign="middle" bgcolor="#eeeeee"><h1 style="margin-top:10px">
<table width="100%">
<tr>
<td><b>&nbsp;Google Tag Library</b> </td>
</tr>
</table>
</h1></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td width="143" valign="top">
<p>
<small><br>
&nbsp;&nbsp;<a href="index.html">Overview</a> <br>
&nbsp;&nbsp;<a href="http://sourceforge.net/project/showfiles.php?group_id=90444">Download</a> <br>
&nbsp;&nbsp;<a href="docs.html">Documentation</a> <br>
&nbsp;&nbsp;<a href="howto.html">HowTo</a> <br>
&nbsp;&nbsp;<a href="javadoc/index.html">Javadoc</a> <br>
<img src="images/yellowarrow.gif" alt="arrow" width="4" height="8"><b>&nbsp;<font color="#cc9900">About</font></b>
</small>
</p>
<img width="145" height="0" alt="">
<table cellpadding="1" width="120">
<tr>
<td style="background-color: #efefef"><small>
<!-- <div class="sidesearch">
<form action="http://googlesite.google.com/search" method="get">
<div align="center">
<font size="-2"><input type="hidden" name="output" value="googleabout"><input type="hidden" name="site" value="googlesite">
<i>Find on this site:</i><br>
<input type="text" name="q" size="10"><br><input type="submit" value="Search" name="submit">
<br>
</font>
</div>
</form>
</div> -->
</small>
</td>
</tr>
</table>
</td>
<td style="background-color: #cccccc" width="1" valign="top"><img alt="" width="1" height="1"></td>
<td style="background-color: #ffffff" width="10" valign="top"><img alt="" width="1" height="1"></td>
<td valign="top">
<p>
<b>About</b>
</p>
<p>
<font size="-1">The following people are currently working on the Google Tag
Library development:</font>
</p>
<font size="-1">
<ul>
<li>
<a href="http://www.thauvin.net/erik/">Erik C. Thauvin</a>
</li>
<li>
<a href="http://www.postneo.com/">Matt Croydon</a>
</li>
<li>
<a href="http://www.dynamicobjects.com/d2r/">Diego Doval</a>
</li>
</ul>
</font>
<p>
<font size="-1">The Google Tag Library is an <a href="license.html">open source
project</a>, and </font><font size="-1">is not associated with or sponsored by
Google, Inc.</font>
<p>
<font size="-1">If you comments, find errors, or just have questions, please
visit the <a href="http://sourceforge.net/projects/google-taglib/">project's support area</a>.</font></td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,831 @@
<html>
<head>
<link rel="stylesheet" href="includes/google.css">
<title>Google Tag Library - Documentation</title>
<style type="text/css">
body,td,font,.p,a{font-family:arial,sans-serif}
.indent {margin-left: 1em; margin-right: 1em;}
code {font-size:10pt}
</style>
</head>
<body class="siteowners" bgcolor="#ffffff" text="#000000" link="#0000CC" vlink="#800080" alink="#ff0000" topmargin="2">
<table width="95%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="1%"><a href="index.html"><img src="images/google_sm.gif" border="0" width="143" height="37" alt="Return to Google homepage." vspace="5"></a></td>
<td valign="middle" bgcolor="#eeeeee"><h1 style="margin-top:10px">
<table width="100%">
<tr>
<td>
<p>
<b>&nbsp;Google Tag Library </b>
</p>
</td>
</tr>
</table>
</h1></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td width="143" valign="top">
<p>
<small><br>
&nbsp;&nbsp;<a href="index.html">Overview</a> <br>
&nbsp;&nbsp;<a href="http://sourceforge.net/project/showfiles.php?group_id=90444">Download</a> <br>
<img src="images/yellowarrow.gif" alt="arrow" width="4" height="8"><b>&nbsp;<font color="#CC9900">Documentation</font></b>
<br>
&nbsp;&nbsp;<a href="howto.html">HowTo</a> <br>
&nbsp;&nbsp;<a href="javadoc/index.html">Javadoc</a> <br>
&nbsp;&nbsp;<a href="about.html">About</a> </small>
</p>
<img width="145" height="0" alt="">
<table cellpadding="1" width="120">
<tr>
<td style="background-color: #efefef"><small>
<!-- <div class="sidesearch">
<form action="http://googlesite.google.com/search" method="get">
<div align="center">
<font size="-2"><input type="hidden" name="output" value="googleabout"><input type="hidden" name="site" value="googlesite">
<i>Find on this site:</i><br>
<input type="text" name="q" size="10"><br><input type="submit" value="Search" name="submit">
<br>
</font>
</div>
</form>
</div> -->
</small>
</td>
</tr>
</table>
</td>
<td style="background-color: #cccccc" width="1" valign="top"><img alt="" width="1" height="1"></td>
<td style="background-color: #ffffff" width="10" valign="top"><img alt="" width="1" height="1"></td>
<a name="top"></a>
<td valign="top">
<p>
<b><font face="arial, sans-serif">Google Tag Library Documentation </font></b>
</p>
<table cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4"><font face="arial, sans-serif"><b>Contents</b></font></td>
</tr>
</table>
<p>
<font size="-1"><b>&nbsp; &nbsp; 1. <a href="#ov">Overview</a></b></font>
<blockquote>
<font size="-1">1.1 <a href="#1_1">Installation</a><br>
1.2 <a href="#1_2">Google API Library</a><br>
1.3 <a href="#1_3">TagLib Directive </a></font>
</blockquote>
<p>
<font size="-1"><b>&nbsp; &nbsp; 2. <a href="#search">Search Tags </a></b></font>
<font size="-1">&nbsp;</font>
<blockquote>
<font size="-1">2.1 <a href="#2_1">Search Tag</a><br>
2.2 <a href="#2_2">SearchResult Tag </a><br>
2.3 <a href="#2_3">Element Tag</a><br>
2.4 <a href="#2_4">Next &amp; Previous Tags</a><br>
2.5 <a href="#2_5">StartIndex &amp; EndIndex Tags</a><br>
2.6 <a href="#2_6">EstimatedTotal Tag</a><br>
2.7 <a href="#2_7">SearchComments Tag</a><br>
2.8 <a href="#2_8">SearchQuery Tag</a><br>
2.9 <a href="#2_9">SearchTime Tag</a><br>
2.10 <a href="#2_10">SearchTips Tag</a><br>
</font>
</blockquote>
<p>
<font size="-1"><b>&nbsp; &nbsp; 3. <a href="#cached">CachedPage &amp; Spelling
Tags</a></b></font> <font size="-1">&nbsp;</font>
<blockquote>
<font size="-1">3.1 <a href="#3_1">CachedPage Tag </a><br>
3.2 <a href="#3_2">Spelling Tag </a></font>
</blockquote>
<a name="ov"></a>
<table bgcolor="#fff9e4" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td style="background-color: #fff9e4"><b>1. Overview</b><font size="-1">&nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">This document explains in detail the semantics of the JSP tags
provided by the Google Tag Library. In this document, you will learn:</font>
<ul>
<li>
<font size="-1">How to install the Google Tag Library.</font>
</li>
<li>
<font size="-1">How to use the various Search, CachedPage and Spelling tags. </font>
</li>
<li>
<font size="-1">How to customize searches and interpret the search results data.</font>
</li>
</ul>
<p>
<font size="-1">You may also find the following helpful:</font>
<ul>
<li>
<font size="-1">The Google Tag Library <a href="howto.html">HowTo</a>.</font>
</li>
<li>
<font size="-1">The Google Tag Library <a href="javadoc/">Javadoc</a> documention.</font>
</li>
</ul>
<p>
<font size="-1">If you have comments, find errors, or just have questions,
please visit the <a href="http://sourceforge.net/projects/google-taglib/">project's support area</a>.</font>
<p>
<blockquote>
<a name="1_1"></a>
<table bgcolor="#fff9e4" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>1.1 Installation </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">The Google Tag Library requires a JSP (1.1 or higher) container,
such as <a href="http://jakarta.apache.org/tomcat/">Tomcat</a>.</font>
<p>
<font size="-1">To use the Google Tag Library, simply copy the library's JAR
file (<code>google.jar</code>) to your application's <code>WEB-INF/lib</code>
directory. The Tag Library Descriptor (<code>google.tld</code>) should be placed
in your application's <code>WEB-INF</code> directory.</font>
<p>
<font size="-1">You should also modify your web application deployment
descriptor (<code>web.xml</code>) file to map the Google Tag Library TLD URI to
its location:</font>
<blockquote>
<pre>&lt;taglib&gt;<br> &lt;taglib-uri&gt;/google-taglib&lt;/taglib-uri&gt;<br> &lt;taglib-location&gt;/WEB-INF/google.tld&lt;/taglib-location&gt;<br>&lt;/taglib&gt;</pre>
</blockquote>
<p>
<a name="1_2"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>1.2 Google API Library </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">The Google Web APIs Java library is required in order to use
the Google Tag Library. The library is included in the <a href="http://www.google.com/apis/download.html">Google Web APIs developer's kit</a>.
The library's JAR file (<code>googleapi.jar</code>) should be placed into your
application's <code>WEB-INF/lib</code> directory.</font>
<p>
<font size="-1">You must also <a href="https://www.google.com/accounts/NewAccount">register with Google</a> (free) in order to obtain a
license key. The license key is required to access Google's Web Services.</font>
<p>
<font size="-1">The license key can be specified as a context parameter in your
web application deployment descriptor (<code>web.xml</code>) as follows:</font>
<blockquote>
<pre>&lt;context-param&gt;<br> &lt;param-name&gt;google_key&lt;/param-name&gt;<br> &lt;param-value&gt;000000000000000000000000&lt;/param-value&gt;<br>&lt;/context-param&gt;</pre>
</blockquote>
<p>
<font size="-1">The license key can also be specified using the <code>key</code>
search form parameter, <code>key</code> tag attribute or the <code>google_key</code>
application scope attribute.</font>
<p>
<a name="1_3"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4" width="80%"><font face="arial, sans-serif"><b>1.3
TagLib Directive </b></font></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">Using the Google 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:</font>
<blockquote>
<pre>&lt;%@taglib uri=&quot;/google-taglib&quot; prefix=&quot;google&quot;%&gt;</pre>
</blockquote>
</blockquote>
<p>
<a name="search" id="search"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4"><font face="arial, sans-serif"><b>2. Search
Tags </b></font></td>
</tr>
</table>
<blockquote>
<a name="2_1"></a>
<p>
<table bgcolor="#fff9e4" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>2.1 Search Tag </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">The <code>&lt;google:search/&gt;</code> tag is used to perform
searches on Google's index of over 2 billion web pages.</font>
<p>
<font size="-1"><strong>Tag Syntax</strong></font>
<p>
<font size="-1">The search query can be specified directly in the tag <em>body </em>,
e.g.:</font>
<blockquote>
<pre>&lt;google:search&gt;my search query&lt;/google:search&gt;</pre>
</blockquote>
<p>
<font size="-1">or via the <em>q</em> request parameter:</font>
</p>
<blockquote>
<pre>(search page) <br>&lt;form action="search.jsp" &gt;<br> &lt;input type= text" name="q"&gt;<br> ...<br>&lt;/form&gt;<br> <br>(result page)<br>&lt;google:search/&gt;</pre>
</blockquote>
<p>
<font size="-1">Similarly the <code>&lt;google:search/&gt;</code> tag options
can be specified as attributes, e.g.:</font>
<blockquote>
<pre>&lt;google:search start ="10" maxResults ="5" / &gt;</pre>
</blockquote>
<p>
<font size="-1">or via request parameters:</font>
</p>
<blockquote>
<pre>(search page)<br>&lt;form action="search.jsp" &gt; <br> &lt;input type="hidden" name="start" value="10"&gt; <br> &lt;input type="hidden" name="maxResults" value="5"&gt;<br> ...<br>&lt;/form&gt;<br> <br>(result page)<br>&lt;google:search/&gt;</pre>
</blockquote>
<p>
<strong><font size="-1">Tag Attributes / Request Parameters</font></strong>
<p>
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<td style="background-color: #fff9e4" valign="top" width="20%">
<div align="center">
<font size="-1"><b>Name</b></font>
</div>
</td>
<td style="background-color: #fff9e4" valign="top" width="80%">
<div align="center">
<font size="-1"><b>Description</b></font>
</div>
</td>
<td style="background-color: #fff9e4" valign="top">
<div align="center">
<font size="-1"><b>Default<br>
Value</b></font>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>key</b></font>
</div>
</td>
<td><font size="-1">Provided by Google, this is required for you to access the
Google service. Google uses the key for authentication and logging.</font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>q</b></font>
</div>
</td>
<td><font size="-1">The search query string.<br>
<b>Note: </b>There is no q attribute. The query is specified directly within the
body of the tag.</font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>start</b></font>
</div>
</td>
<td><font size="-1">Zero-based index of the first desired result.</font></td>
<td>
<div align="center">
<font size="-1">0</font>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>maxResults</b></font>
</div>
</td>
<td><font size="-1">Number of results desired per query. The maximum value per
query is 10.<br>
<b>Note:</b> If you do a query that doesn't have many matches, the actual number
of results you get may be smaller than what you request.</font></td>
<td>
<div align="center">
<font size="-1">10</font>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>filter</b></font>
</div>
</td>
<td><font size="-1">Activates or deactivates automatic results filtering, which
hides very similar results and results that all come from the same web host.
Filtering tends to improve the end user experience on Google, but for your
application you may prefer to turn it off.</font></td>
<td>
<div align="center">
<font size="-1">true</font>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>restricts</b></font>
</div>
</td>
<td><font size="-1">Restricts the search to a subset of the Google web index,
such as a country like &quot;Ukraine&quot; or a topic like &quot;Linux.&quot;</font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>safeSearch</b></font>
</div>
</td>
<td><font size="-1">A Boolean value which enables filtering of adult content in
the search results.</font></td>
<td>
<div align="center">
<font size="-1">false</font>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>lr</b></font>
</div>
</td>
<td><font size="-1"><i>Language Restrict</i> - Restricts the search to documents
within one or more languages.</font></td>
<td>
<div align="center">
<font size="-1">latin1</font>
</div>
</td>
</tr>
<tr>
<td colspan="3"><font size="-1" color="gray">The parameters listed below are not
part of the Google Web APIs.</font></td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>cache</b></font>
</div>
</td>
<td><font size="-1">By default the search results are cached between search requests. To ensure that a new query has been specified set this parameter to <em>false</em>.</font></td>
<td>
<div align="center">
<font size="-1">true</font>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>site</b></font>
</div>
</td>
<td><font size="-1">Restricts the search to documents within the specfied
site.</font></td>
<td>&nbsp;</td>
</tr>
</table>
<p>
<font size="-1">For detailed information on the above Google search options,
please refer to the <a href="http://www.google.com/apis/reference.html">Google
Web APIs</a> documentation.</font>
<p>
<a name="2_2"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td width="80%" height="23" style="background-color: #fff9e4"><b>2.2
SearchResult Tag </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">The <code>&lt;google:searchResult/&gt;</code> tag is used to
loop through the results returned by of a Google search. </font>
<p>
<font size="-1"><strong>Tag Syntax</strong></font> <font size="-1">
<p>
The search results can be displayed using an HTML ordered list: </font>
<blockquote>
<pre>&lt;ol&gt;<br>&lt;google:searchResult&gt;<br> &lt;li&gt;&lt;google:element name="title-url"/&gt;&lt;/li&gt;<br>&lt;/google:searchResult&gt;<br>&lt;/ol&gt;</pre>
</blockquote>
<p>
<font size="-1">The <code><a href="#2_3">&lt;google:element/&gt;</a></code> tag
is used to display the details of the current result set item.</font>
<p>
<a name="2_3"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>2.3 Element Tag </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">The <code>&lt;google:element/&gt;</code> tag is used to display
the properties of the current result set item. It can only be used inside the <a href="#2_2">
<code>&lt;google:searchResult/&gt;</code></a> tag.</font>
<p>
<font size="-1"><strong>Tag Syntax</strong></font> <font size="-1">
<p>
The URL property of the search results can be displayed as follows: </font>
<blockquote>
<pre>&lt;google:searchResult&gt;<br> &lt;google:element name="url"/&gt;&lt;br&gt;<br>&lt;/google:searchResult&gt;</pre>
</blockquote>
<p>
<font size="-1">The <em>name </em> attribute is used to specify the desired
property of the current result set item.</font>
</p>
<p>
<strong><font size="-1">Name Attributes Values</font></strong>
</p>
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<td style="background-color: #fff9e4" valign="top" width="20%">
<div align="center">
<font size="-1"><b>Name</b></font>
</div>
</td>
<td style="background-color: #fff9e4" valign="top" width="80%">
<div align="center">
<font size="-1"><b>Description</b></font>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>summary</b></font>
</div>
</td>
<td><font size="-1">The search result has a listing in the ODP directory, the
ODP summary appears here as a text string.</font> </td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>URL</b></font>
</div>
</td>
<td><font size="-1">The URL of the search result, returned as text, with an
absolute URL path.</font> </td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>snippet</b></font>
</div>
</td>
<td><font size="-1">A snippet which shows the query in context on the URL where
it appears.</font> </td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>title</b></font>
</div>
</td>
<td><font size="-1">The title of the search result, returned as HTML.</font> </td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>cachedSize</b></font>
</div>
</td>
<td><font size="-1">Indicates that a cached version of the URL is available;
size is indicated in kilobytes.</font> </td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>relatedInformationPresent</b></font>
</div>
</td>
<td><font size="-1">Boolean indicating that the "related:" query term is
supported for this URL. </font> </td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>hostName</b></font>
</div>
</td>
<td><font size="-1">When filtering occurs, a maximum of two results from any
given host is returned. When this occurs, the second result element that comes
from that host contains the host name in this parameter.</font></td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>directoryTitle</b></font>
</div>
</td>
<td><font size="-1">The title that appears in the ODP directory, if any.</font> </td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>directoryCategoryName</b></font>
</div>
</td>
<td><font size="-1">The ODP directory name for the current ODP category.</font> </td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>directoryCategoryEncoding</b></font>
</div>
</td>
<td><font size="-1">Specifies the encoding scheme of the directory information.</font></td>
</tr>
<tr>
<td colspan="2"><font size="-1" color="gray">The properties listed below are not
part of the Google Web APIs.</font></td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>relatedQuery</b></font>
</div>
</td>
<td><font size="-1">The related query, suitable for use with <em>q</em>
request parameter of the <code><a href="#2_1">&lt;google:search/&gt;</a></code>
tag.<br>For example: <code>related:www.example.com/search?q=vacation%20hawaii</code></font></td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>cachedQuery</b></font>
</div>
</td>
<td><font size="-1">The cached query, suitable for use with the <em>q</em>
request parameter of the <code><a href="#3_1">&lt;google:cachedPage/&gt;</a></code>
tag.<br>For example: <code>www.example.com/search?q=vacation%20hawaii</code></font> </td>
</tr>
<tr>
<td>
<div align="center">
<font size="-1"><b>staticQuery</b></font>
</div>
</td>
<td><font size="-1">The static query, suitable for display.<br>For example: <code>www.example.com/search?q=vacation hawaii</code></font></td>
</tr>
</table>
<p>
<font size="-1">For detailed information on the above Google search elements
options, please refer to the <a href="http://www.google.com/apis/reference.html">Google
Web APIs</a> documentation.</font>
<p>
<strong><font size="-1"><a name="autolink"></a>Automatic Link Creation</font></strong>
<p>
<font size="-1">The name of two properties can be combined to automatically
generate properly formatted HTML links. For example, to automatically create a
link whose location is the URL of the current element and whose text is the
current element's title use the following syntax:</font>
<blockquote>
<pre>&lt;google:element name="title-url"/&gt;</pre>
</blockquote>
<p>
<font size="-1">which will automatically generate a property formatted HTML link:</font>
<blockquote>
<pre>&lt;a href="[url]"&gt;[title]&lt;/a&gt;</pre>
</blockquote>
<p>
<font size="-1">Additionally, the link's target and style options can be specify
using the <em>target</em>, <em>style</em> and <em>css</em> attributes of the <code>&lt;google:element/&gt;</code>
tag: </font>
<blockquote>
<pre>&lt;google:element name="title-url" target="_blank" style="text-decoration:none" css=&quot;c&quot;/&gt;</pre>
</blockquote>
<p>
<font size="-1">which will generate:</font>
<blockquote>
<pre>&lt;a href="[url]" target="_blank" class=&quot;c&quot; style="text-decoration:none"&gt;[title]&lt;/a&gt;</pre>
</blockquote>
<p>
<a name="2_4"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>2.4 Next &amp; Previous
Tags </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">The <code>&lt;google:next/&gt;</code> tag is used to
used to display a link to more search results.<br>
The <code>&lt;google:previous/&gt;</code> tag is used to used to display a link
to previous search results.</font>
<p>
<font size="-1"><strong>Tag Syntax</strong></font>
<p>
<font size="-1">The next set of results can be displayed using:</font>
<blockquote>
<pre>Click &lt;google:next&gt;here&lt;/google:next&gt; to view more results.
</pre>
</blockquote>
<p>
<font size="-1">Additionally, the link's target and style options can be specify
using the <a href="#autolink">target, style and css</a> attributes</font>.
<p>
<a name="2_5"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>2.5 StartIndex &amp;
EndIndex Tags </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">The <code>&lt;google:startIndex/&gt;</code> tag is
used to display the index (1-based) of the first search result in the current
result set.<br>
The <code>&lt;google:endIndex/&gt;</code> tag is used to used to
display the index (1-based) of the last search result in the current result set.</font>
<p>
<a name="2_6"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>2.6 EstimatedTotal Tag </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">The <code>&lt;google:estimatedTotal/&gt;</code> tag is used to
display the estimated total number of results that exist for the current query.</font>
<p>
<a name="2_7"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>2.7 SearchComments Tag </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1"></font> <font size="-1">The <code>&lt;google:searchComments/&gt;</code>
tag is used to
display the comments (if any) included with the current result set.</font>
<p>
<a name="2_8" id="2_8"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>2.8 SearchQuery Tag </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1"></font> <font size="-1">The <code>&lt;google:searchQuery/&gt;</code>
tag is used to
display the text of the current query.
</font>
<p>
<a name="2_9" id="2_9"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>2.9 SearchTime Tag </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1"></font> <font size="-1">The <code>&lt;google:searchTime/&gt;</code>
tag is used to
display the total server time used to return the search results, measured in
seconds.</font>
<p>
<a name="2_10" id="2_10"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>2.10 SearchTips Tag </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1"></font> <font size="-1">The <code>&lt;google:searchTips/&gt;</code>
tag is used to
display the tips (if any) included with the current result set.</font>
</blockquote>
<p>
<a name="cached" id="cached"></a>
<table cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4"><b>3. CachedPage &amp; Spelling Tags </b></td>
</tr>
</table>
<blockquote>
<a name="3_1"></a>
<p>
<table bgcolor="#fff9e4" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>3.1 CachedPage Tag </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">The <code>&lt;google:cachedPage/&gt;</code> tag is used to
display Google's cached web pages.</font>
<p>
<font size="-1"><b>Tag Syntax</b></font>
<p>
<font size="-1">The URL can be specified directly in the tag <em>body</em>, e.g.:</font>
<blockquote>
<pre>&lt;google:cachedPage&gt;http://www.google.com&lt;/google:cachedPage&gt;</pre>
</blockquote>
<p>
<font size="-1">or via the <em>q </em> request parameter:</font>
<blockquote>
<pre>(search page)<br>&lt;form action="cache.jsp"&gt; <br> &lt;input type="text" name="q"&gt; <br> ...<br>&lt;/form&gt;<br> <br>(result page)<br>&lt;google:cachedPage/&gt;</pre>
</blockquote>
<p>
<font size="-1">Upon submission the cached page will be displayed.</font>
<p>
<a name="3_2"></a>
<p>
<table bgcolor="#fff9e4" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>3.2 Spelling </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">The &lt;google:spelling/&gt; tag is used to display Google's
spelling suggestions.</font>
<p>
<font size="-1"><b>Tag Syntax</b></font>
<p>
<font size="-1">The text can be specified directly in the tag <em>body</em>, e.g.:</font>
<blockquote>
<pre>&lt;google:spelling&gt;long knifes&lt;/google:spelling&gt;</pre>
</blockquote>
<p>
<font size="-1">or via the <em>q </em> request parameter:</font>
<blockquote>
<pre>(search page)<br>&lt;form action="spelling.jsp"&gt; <br> &lt;input type="text" name="q"&gt; <br> ...<br>&lt;/form&gt;<br> <br>(result page)<br>&lt;google:spelling/&gt;</pre>
</blockquote>
<p>
<font size="-1">Upon submission the spelling suggestion (&quot;long knives&quot;)
will be displayed.</font>
</blockquote>
</td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,441 @@
<html>
<head>
<link rel="stylesheet" href="includes/google.css">
<title>Google Tag Library - HowTo</title>
<style type="text/css">
body,td,font,.p,a{font-family:arial,sans-serif}
.indent { margin-left: 1em; margin-right: 1em;}
</style>
</head>
<body class="siteowners" bgcolor="#ffffff" text="#000000" link="#0000CC" vlink="#800080" alink="#ff0000" topmargin="2">
<table width="95%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="1%"><a href="index.html"><img src="images/google_sm.gif" border="0" width="143" height="37" alt="Return to Google homepage." vspace="5"></a></td>
<td valign="middle" bgcolor="#eeeeee"><h1 style="margin-top:10px">
<table width="100%">
<tr>
<td>
<p>
<b>&nbsp;Google Tag Library </b>
</p>
</td>
</tr>
</table>
</h1></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td width="143" valign="top">
<p>
<small><br>
&nbsp;&nbsp;<a href="index.html">Overview</a> <br>
&nbsp;&nbsp;<a href="http://sourceforge.net/project/showfiles.php?group_id=90444">Download</a> <br>
&nbsp;&nbsp;<a href="docs.html">Documentation</a> <br>
<img src="images/yellowarrow.gif" alt="arrow" width="4" height="8"><b>&nbsp;<font color="#CC9900">HowTo</font></b>
<br>
&nbsp;&nbsp;<a href="javadoc/index.html">Javadoc</a> <br>
&nbsp;&nbsp;<a href="about.html">About</a> </small>
</p>
<img alt="" width="143" height="0">
<table cellpadding="1" width="120">
<tr>
<td style="background-color: #efefef"><small>
<!-- <div class="sidesearch">
<form action="http://googlesite.google.com/search" method="get">
<div align="center">
<font size="-2"><input type="hidden" name="output" value="googleabout"><input type="hidden" name="site" value="googlesite">
<i>Find on this site:</i> <br>
<input type="text" name="q" size="10"><br><input type="submit" value="Search" name="submit">
<br>
</font>
</div>
</form>
</div> -->
</small>
</td>
</tr>
</table>
</td>
<td style="background-color: #cccccc" width="1" valign="top"><img alt="" width="1" height="1"></td>
<td style="background-color: #ffffff" width="10" valign="top"><img alt="" width="1" height="1"></td>
<a name="top"></a>
<td valign="top">
<p>
<b><font face="arial, sans-serif">&nbsp;Google Tag Library HowTo</font></b>
</p>
<table cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4"><font face="arial, sans-serif"><b>Contents</b></font></td>
</tr>
</table>
<p>
<font size="-1"><b>&nbsp; &nbsp; 1. <a href="#search">Search &amp; Display the
Results of a Goggle Search</a></b> </font>
<blockquote>
<font size="-1">1.1 <a href="#1_1">Create a Search Form </a> <br>
1.2 <a href="#1_2">Create a Result Page</a> <br>
1.3 <a href="#1_3">Display the Results </a> </font>
</blockquote>
<font size="-1">
<p>
<b>&nbsp; &nbsp; 2. <a href="#cached">Display a Page Cached by Goggle</a></b> </font>
<blockquote>
<font size="-1">2.1 <a href="#2_1">Create a Search From </a> <br>
2.2 <a href="#2_2">Create a Result Page</a> <br>
2.3 <a href="#2_3">Display the Cached Page</a></font>
</blockquote>
<font size="-1">
<p>
</p>
<b>&nbsp; &nbsp; 3. <a href="#spelling">Display a Goggle Spelling Suggestion </a></b></font>
<blockquote>
<font size="-1">3.1 <a href="#3_1">Create a Search Form</a> <br>
3.2 <a href="#3_2">Create a Result Page </a> <br>
3.3 <a href="#3_3">Display the Spelling Suggestion </a> <br>
</font>
</blockquote>
<a name="search" id="search"></a>
<table bgcolor="#fff9e4" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td style="background-color: #fff9e4" width="80%"><b>1. Search &amp; Display the
Results of a Google Search </b></td>
</tr>
</table>
<p>
<blockquote>
<a name="1_1"></a>
<table bgcolor="#fff9e4" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr colspan="2">
<td style="background-color: #fff9e4" width="80%"><b>1.1 Create a Search From </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">Create the following HTML form on your search page:</font>
<p>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="#0000FF">&lt;form </font><font color="#FF0000">action=</font>&quot;results.jsp&quot;
<font color="#0000FF">&gt;</font> <br>
&nbsp;&nbsp;<font color="#0000FF">&lt;input </font><font color="#FF0000">type=</font>&quot;text&quot;
<font color="#FF0000">name=</font>&quot;q&quot;<font color="#0000FF">&gt;</font> <br>
&nbsp;&nbsp;<font color="#0000FF">&lt;input </font><font color="#FF0000">type=</font>&quot;submit&quot;
<font color="#0000FF">&gt;</font></code><code><br>
<font color="#0000FF">&lt;/form&gt;</font></code></td>
<td><img src="images/arrow.jpg" alt="arrow" width="35" height="28"></td>
<td><img src="images/search.jpg" alt="search" width="268" height="24"></td>
</tr>
</table>
<p>
<font size="-1">The <em>q</em> parameter is required and used to store the
search query string. <br>
The form <em>action</em> points to the <em>results.jsp</em> page, which is
created in step <a href="#1_2">1.2</a>.</font>
<p>
<font size="-1" color="gray">The Google Web APIs authentication key can be
specified as an hidden form input parameter: <br>
</font>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="gray">&lt;input type=&quot;hidden&quot; name=&quot;key&quot;
value=&quot;000000000000000000000000&quot;&gt;</font></code></td>
</tr>
</table>
<p>
<p>
<a name="1_2"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr colspan="2">
<td style="background-color: #fff9e4" width="80%"><b>1.2 Create a Results Page </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">Create a page called <em>results.jsp</em> containing:</font>
<p>
<table cellspacing="5">
<tr>
<td width="5">&nbsp;</td>
<td nowarp><code><font color="#009900">&lt;%@taglib uri=</font>&quot;/google-taglib&quot;
<font color="#009900">prefix=</font>&quot;google&quot;<font color="#009900">%&gt;</font>
<br>
<font color="#CC6600">&lt;google:search/&gt;</font></code></td>
</tr>
</table>
<p>
<font size="-1">The <em>taglib</em> directive is used to specify the Google Tag
library reference and prefix. <br>
The <em>&lt;google:search/&gt;</em> tag is used to perform the query.</font>
<p>
<font size="-1" color="gray">The Google Web APIs authentication key can be
specified as a tag attribute: <br>
</font>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="gray">&lt;google:search key=&quot;000000000000000000000000&quot;/&gt;</font></code></td>
</tr>
</table>
<p>
<a name="1_3"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr colspan="2">
<td style="background-color: #fff9e4" width="80%"><font face="arial, sans-serif">
<b>1.3 Display the Search Results </b></font></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="#0000FF">&lt;ol&gt;</font> <br>
<font color="#CC6600">&lt;google:searchResult&gt;</font> <br>
&nbsp;&nbsp;<font color="#0000FF">&lt;li&gt;</font><font color="#CC6600">&lt;google:element
name</font>=&quot;title-url&quot;<font color="#CC6600">/&gt;</font><font color="#0000FF">&lt;/li&gt;</font>
<br>
<font color="#CC6600">&lt;/google:searchResult&gt;</font> <br>
<font color="#0000FF">&lt;/ol&gt;</font></code></td>
<td><img src="images/arrow.jpg" alt="arrow" width="35" height="28"></td>
<td><img src="images/searchresults.jpg" alt="searchresults" width="196" height="72"></td>
</tr>
</table>
<p>
<font size="-1">The <em>&lt;google:searchResult/&gt;</em> tag is used to loop
through the results. <br>
The <em>&lt;google:element/&gt;</em> tag is used to display the attributes of
the current result set element.</font>
</blockquote>
<a name="cached" id="cached"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4"><font face="arial, sans-serif"><b>2.
Display a Page Cached by Google </b></font></td>
</tr>
</table>
<blockquote>
<a name="2_1"></a>
<p>
<table bgcolor="#fff9e4" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr colspan="2">
<td style="background-color: #fff9e4" width="80%"><b>2.1 Create a Search From</b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1">Create the following HTML form on your search page:</font>
<p>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="#0000FF">&lt;form </font><font color="#FF0000">action=</font>&quot;results.jsp&quot;
<font color="#0000FF">&gt;</font> <br>
&nbsp;&nbsp;<font color="#0000FF">&lt;input </font><font color="#FF0000">type=</font>&quot;text&quot;
<font color="#FF0000">name=</font>&quot;q&quot;<font color="#0000FF">&gt;</font> <br>
&nbsp;&nbsp;<font color="#0000FF">&lt;input </font><font color="#FF0000">type=</font>&quot;submit&quot;
<font color="#0000FF">&gt;</font></code><code><br>
<font color="#0000FF">&lt;/form&gt;</font></code></td>
<td><img src="images/arrow.jpg" alt="arrow" width="35" height="28"></td>
<td><img src="images/cached.jpg" alt="search" width="268" height="26"></td>
</tr>
</table>
<p>
<font size="-1">The <em>q</em> parameter is required and used to store the
search query string. <br>
The form <em>action</em> points to the <em>results.jsp</em> page, which is
created in step <a href="#2_2">2.2</a>.</font>
<p>
<font size="-1" color="gray">The Google Web APIs authentication key can be
specified as an hidden form input parameter: <br>
</font>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="gray">&lt;input type=&quot;hidden&quot; name=&quot;key&quot;
value=&quot;000000000000000000000000&quot;&gt;</font></code></td>
</tr>
</table>
<p>
<font size="-1"></font>
<p>
<a name="2_2"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr colspan="2">
<td width="80%" height="23" style="background-color: #fff9e4"><b>2.2 Create a
Result Page </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<p>
<font size="-1">Create a page called <em>results.jsp</em> containing:</font>
<p>
<table cellspacing="5">
<tr>
<td width="5">&nbsp;</td>
<td nowarp><code><font color="#009900">&lt;%@taglib uri=</font>&quot;/google-taglib&quot;
<font color="#009900">prefix=</font>&quot;google&quot;<font color="#009900">%&gt;</font></code></td>
</tr>
</table>
<p>
<font size="-1">The <em>taglib</em> directive is used to specify the Google Tag
library reference and prefix.</font>
<p>
<a name="2_3"></a>
<table bgcolor="#fff9e4" cellpadding="2" width="100%" border="0">
<tr colspan="2">
<td style="background-color: #fff9e4" width="80%"><b>2.3 Display the Cached Page </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="#CC6600">&lt;google:cachedPage/&gt;</font></code></td>
<td><img src="images/arrow.jpg" alt="arrow" width="35" height="28"></td>
<td><img src="images/cachedresults.jpg" alt="searchresults" width="160" height="147"></td>
</tr>
</table>
<p>
<font size="-1">The <em>&lt;google:cachedPage&gt;</em> tag is used to display
the content of the cached page.</font>
<p>
<font size="-1" color="gray">The Google Web APIs authentication key can be
specified as a tag attribute: <br>
</font>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="gray">&lt;google:cachedPage key=&quot;000000000000000000000000&quot;/&gt;</font></code></td>
</tr>
</table>
<p>
</blockquote>
<p>
<a name="spelling" id="spelling"></a>
<table cellpadding="2" width="100%" border="0">
<tr>
<td style="background-color: #fff9e4"><b>3. Display a Google Spelling Suggestion </b></td>
</tr>
</table>
<blockquote>
<a name="3_1"></a>
<p>
<table bgcolor="#fff9e4" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr colspan="2">
<td style="background-color: #fff9e4" width="80%"><b>3.1 Create a Search Form</b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1"></font>
<p>
<font size="-1">Create the following HTML form on your search page:</font>
<p>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="#0000FF">&lt;form </font><font color="#FF0000">action=</font>&quot;results.jsp&quot;
<font color="#0000FF">&gt;</font> <br>
&nbsp;&nbsp;<font color="#0000FF">&lt;input </font><font color="#FF0000">type=</font>&quot;text&quot;
<font color="#FF0000">name=</font>&quot;q&quot;<font color="#0000FF">&gt;</font> <br>
&nbsp;&nbsp;<font color="#0000FF">&lt;input </font><font color="#FF0000">type=</font>&quot;submit&quot;
<font color="#0000FF">&gt;</font></code><code><br>
<font color="#0000FF">&lt;/form&gt;</font></code></td>
<td><img src="images/arrow.jpg" alt="arrow" width="35" height="28"></td>
<td><img src="images/spelling.jpg" alt="search" width="269" height="26"></td>
</tr>
</table>
<p>
<font size="-1">The <em>q</em> parameter is required and used to store the
search query string. <br>
The form <em>action</em> points to the <em>results.jsp</em> page, which is
created in step <a href="#3_2">3.2</a>.</font> <font size="-1"></font>
<p>
<font size="-1" color="gray">The Google Web APIs authentication key can be
specified as an hidden form input parameter: <br>
</font>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="gray">&lt;input type=&quot;hidden&quot; name=&quot;key&quot;
value=&quot;000000000000000000000000&quot;&gt;</font></code></td>
</tr>
</table>
<p>
<a name="3_2"></a>
<p>
<table bgcolor="#fff9e4" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr colspan="2">
<td style="background-color: #fff9e4" width="80%"><b>3.2 Create a Result Page </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1"></font>
<p>
<font size="-1">Create a page called <em>results.jsp</em> containing:</font>
<p>
<table cellspacing="5">
<tr>
<td width="5">&nbsp;</td>
<td nowarp><code><font color="#009900">&lt;%@taglib uri=</font>&quot;/google-taglib&quot;
<font color="#009900">prefix=</font>&quot;google&quot;<font color="#009900">%&gt;</font></code></td>
</tr>
</table>
<p>
<font size="-1">The <em>taglib</em> directive is used to specify the Google Tag
library reference and prefix.</font>
<p>
<a name="3_3"></a>
<p>
<table bgcolor="#fff9e4" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr colspan="2">
<td style="background-color: #fff9e4" width="80%"><b>3.3 Display the Spelling
Suggestion </b></td>
<td style="background-color: #fff9e4" width="20%" nowrap><font size="-1"><a href="#top">Back
to top</a> &nbsp; &nbsp; </font></td>
</tr>
</table>
<p>
<font size="-1"></font>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="#CC6600">&lt;google:spelling/&gt;</font></code></td>
<td><img src="images/arrow.jpg" alt="arrow" width="35" height="28"></td>
<td nowrap>long knives</td>
</tr>
</table>
<p>
<font size="-1">The <em>&lt;google:spelling&gt;</em> tag is used to display the
suggested spelling for the given query.</font>
<p>
<font size="-1" color="gray">The Google Web APIs authentication key can be
specified as a tag attribute: <br>
</font>
<table cellpadding="5">
<tr>
<td width="5">&nbsp;</td>
<td nowrap><code><font color="gray">&lt;google:spelling key=&quot;000000000000000000000000&quot;/&gt;</font></code></td>
</tr>
</table>
<p>
</blockquote>
</td>
</tr>
</table>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

View file

@ -0,0 +1,42 @@
body, td { background-color: white; }
h1 td, h1, h2, h3, h4, h5, h6, div.topnav,
div.sidenav, div.sidesearch, div.sidequote, div.bottomnav, div.footer, small,
td#sidebartitle { font-family: arial,sans-serif; }
/* rules for the bottom navigation on the results page */
div.bottomnav { margin-top: 1ex; }
div.bottomnav a, span.bottomnav { font-size: 10pt; }
div.bottomnav a, span.big { font-size: 12pt; color: #0000cc; }
/* standard link colors */
a:link { color: #0000cc; }
a:visited { color: #551a8b; }
a:active { color: #ff0000; }
/* top part of the page */
div.topnav { margin-bottom: 0.1ex; }
h1 td { font-size: .95em; font-weight: bolder; }
h1 td { background-color: #669900; color: white; border: none; padding: 2pt; }
div.side { margin-right: 3ex; padding: 2pt; }
div.sidenav { }
div.sidesearch { margin-top: 1em; font-size: 0.75em; }
div.sidequote { text-align: center; margin-top: 1.5in; border-color: red; border-style: solid; border-top-width: 1px; border-bottom-width: 1px; border-left-width: 0px; border-right-width: 0px; }
div.footer { text-align: center; color: #6f6f6f; padding: 3pt; }
/* sidebar on the right */
table.sidebarborder { margin: 3pt; margin-top: 1pt; }
td#sidebarcontent { background-color: #ffffff; }
/* color schemes for different sections of the site */
body.corporate h1 td, body.corporate table.sidebarborder td { background-color: #339966; }
body.corporate td#sidebartitle { background-color: #d8f1e4; }
body.siteowners h1 td, body.siteowners table.sidebarborder td { background-color: #ddad08; }
body.siteowners td#sidebartitle { background-color: #f1e4d8; }
body.search h1 td, body.search table.sidebarborder td { background-color: #336699; }
body.search td#sidebartitle { background-color: #d8e4f1; }
body.zealots h1 td, body.zealots table.sidebarborder td { background-color: #aa1002; }
body.zealots td#sidebartitle { background-color: #f1e4d8; }

View file

@ -0,0 +1,230 @@
<html>
<head>
<link rel="stylesheet" href="includes/google.css">
<title>Google Tag Library</title>
<style type="text/css">
body,td,font,p,a{font-family:arial,sans-serif}
</style>
</head>
<body class="siteowners" bgcolor="#ffffff" text="#000000" link="#0000CC" vlink="#800080" alink="#ff0000" topmargin="2">
<table width="95%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="1%"><a href="index.html"><img src="images/google_sm.gif" border="0" width="143" height="37" alt="Return to Google homepage." vspace="5"></a></td>
<td valign="middle" bgcolor="#eeeeee"><h1 style="margin-top:10px">
<table width="100%">
<tr>
<td><b>&nbsp;Google Tag Library</b></td>
</tr>
</table>
</h1></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td width="143" valign="top">
<p>
<small><br>
<img src="images/yellowarrow.gif" alt="arrow" width="4" height="8"><b>&nbsp;<font color="#CC9900">Overview</font></b>
<br>
&nbsp;&nbsp;<a href="http://sourceforge.net/project/showfiles.php?group_id=90444">Download</a> <br>
&nbsp;&nbsp;<a href="docs.html">Documentation</a> <br>
&nbsp;&nbsp;<a href="howto.html">HowTo</a> <br>
&nbsp;&nbsp;<a href="javadoc/index.html">Javadoc</a> <br>
&nbsp;&nbsp;<a href="about.html">About</a> </small>
</p>
<img alt="" width="143" height="0">
<table cellpadding="1" width="120">
<tr>
<td style="background-color: #efefef"><small>
<!-- <div class="sidesearch">
<form action="http://googlesite.google.com/search" method="get">
<div align="center">
<font size="-2"><input type="hidden" name="output" value="googleabout"><input type="hidden" name="site" value="googlesite">
<i>Find on this site:</i> <br>
<input type="text" name="q" size="10"><br><input type="submit" value="Search" name="submit">
<br>
</font>
</div>
</form>
</div> -->
</small>
</td>
</tr>
</table>
<p>
&nbsp;<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=9044&amp;type=1" width="88" height="31" border="0" alt="SourceForge.net Logo"/></a>
</p>
</td>
<td style="background-color: #cccccc" width="1" valign="top"><img alt="" width="1" height="1"></td>
<td style="background-color: #ffffff" width="10" valign="top"><img alt="" width="10" height="1"></td>
<td valign="top">
<table border="0" cellpadding="0">
<tr>
<td valign="top" width="65%">
<p>
<strong>Easily Include Google Searches in Your Web Applications </strong>
</p>
<p>
<font size="-1">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.</font>
</p>
<p>
<font size="-1">To start using the Google Tag Library:</font>
</p>
<table border="0" cellpadding="5" cellspacing="0">
<tr>
<td style="background-color: #FFEBAE"><font size="5"><b>1</b></font></td>
<td><font size="-1"><b>Download&nbsp;the&nbsp;Google Tag Library </b> <br>
The <a href="http://sourceforge.net/project/showfiles.php?group_id=90444">download</a> includes the tag library and associated TLD.</font></td>
</tr>
<tr>
<td>&nbsp;
</td>
<td>&nbsp;
</td>
</tr>
<tr>
<td style="background-color: #FFEBAE"><font face="arial,sans-serif" size="5"><b>2</b></font></td>
<td><font size="-1"><strong>Download the Google Web API</strong> <br>
To use the Google Web APIs service, you also must <a href="http://api.google.com/">obtain
a license key</a>.</font></td>
</tr>
<tr>
<td>&nbsp;
</td>
<td>&nbsp;
</td>
</tr>
<tr>
<td style="background-color: #FFEBAE"><font size="5"><b>3</b></font></td>
<td><font size="-1"><b>Incorporate the tags in your web pages</b> <br>
Check out the <a href="howto.html">HowTo</a> or read the <a href="docs.html">Documentation</a>
for more information.</font></td>
</tr>
</table>
</td>
<td valign="top">
<div align="center">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="center">
<img src="images/duktumbl.gif" width="130" height="80" alt="Google Web APIs" hspace="5">
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<p>
<font color="cc9900" size="-1">Duke does the Google dance.</font>
</p>
</div>
</td>
</tr>
</table>
<p>
<table class="sidebarborder" border="0" cellspacing="0" hspace="5" vspace="5" width="245" align="center">
<tr>
<td bgcolor="#cccccc">
<table class="sidebar" bgcolor="#ffffff" cellpadding="4" cellspacing="0" border="0" width="100%">
<tr valign="top">
<td colspan="2" style="background-color: #ffffff">
<div align="center">
<font size="-1"><strong>Requirements</strong></font>
</div>
</td>
</tr>
<tr valign="top">
<td id="sidebarcontent"><img src="images/arrow.gif" alt="arrow" width="6" height="14"></td>
<td id="sidebarcontent"><font size="-1">A JSP container, such as <a href="http://jakarta.apache.org/tomcat/">Tomcat</a>.</font></td>
</tr>
<tr valign="top">
<td id="sidebarcontent"><img src="images/arrow.gif" width="6" height="14" alt="arrow"></td>
<td id="sidebarcontent"><font size="-1">The <a href="http://api.google.com/">Google
API</a> Java library. </font></td>
</tr>
<tr valign="top">
<td colspan="2" id="sidebarcontent">
<div align="center">
<font size="-1"><i>See the <a href="docs.html#1_1">Installation Notes</a> for
details.</i></font>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
<table class="sidebarborder" border="0" cellspacing="0" hspace="5" vspace="5" width="245" align="center">
<tr>
<td bgcolor="#cccccc">
<table class="sidebar" bgcolor="#ffffff" cellpadding="4" cellspacing="0" border="0" width="100%">
<tr>
<td colspan="2" valign="top" style="background-color: #ffffff">
<div align="center">
<b><font size="-1">Some Usage Ideas</font></b>
</div>
</td>
</tr>
<tr>
<td valign="top" id="sidebarcontent"><img src="images/arrow.gif" alt="arrow" width="6" height="14"></td>
<td valign="top" id="sidebarcontent"><font size="-1">Provide a way to search
your web site or mailing list using Google.</font></td>
</tr>
<tr>
<td valign="top" id="sidebarcontent"><img src="images/arrow.gif" alt="arrow" width="6" height="14"></td>
<td valign="top" id="sidebarcontent"><font size="-1">Incorporate targeted Google
search results directly into your home page.</font></td>
</tr>
<tr>
<td valign="top" id="sidebarcontent"><img src="images/arrow.gif" alt="arrow" width="6" height="14"></td>
<td valign="top" id="sidebarcontent"><font size="-1">Add Google's spell-checking
to your weblog.</font></td>
</tr>
</table>
</td>
</tr>
</table>
<p>
<table class="sidebarborder" border="0" cellspacing="0" hspace="5" vspace="5" width="245" align="center">
<tr>
<td bgcolor="#cccccc">
<table class="sidebar" bgcolor="#ffffff" cellpadding="4" cellspacing="0" border="0" width="100%">
<tr>
<td valign="top" style="background-color: #ffffff">
<div align="center">
<b><font size="-1">Disclaimer</font></b>
</div>
</td>
</tr>
<tr>
<td valign="top" id="sidebarcontent">
<p>
<font size="-1">The Google Tag Library is open source. Please see its <a href="license.html">license</a>.</font>
</p>
<p>
<font size="-1">The library uses the Google Web APIs, but is not associated with
or sponsored by Google, Inc. </font>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,100 @@
<html>
<head>
<link rel="stylesheet" href="includes/google.css">
<title>Google Tag Library - License</title>
<style type="text/css">
body,td,font,p,a{font-family:arial,sans-serif}
</style>
</head>
<body class="siteowners" bgcolor="#ffffff" text="#000000" link="#0000CC" vlink="#800080" alink="#ff0000" topmargin="2">
<table width="95%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="1%"><a href="index.html"><img src="images/google-logo.png" border="0" width="143" height="37" alt="Return to Google homepage." vspace="5"></a></td>
<td valign="middle" bgcolor="#eeeeee"><h1 style="margin-top:10px">
<table width="100%">
<tr>
<td><b>&nbsp;Google Tag Library</b></td>
</tr>
</table>
</h1></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td width="143" valign="top">
<p>
<small><br>
&nbsp;&nbsp;<a href="index.html">Overview</a> <br>
&nbsp;&nbsp;<a href="http://sourceforge.net/project/showfiles.php?group_id=90444">Download</a> <br>
&nbsp;&nbsp;<a href="docs.html">Documentation</a> <br>
&nbsp;&nbsp;<a href="howto.html">HowTo</a> <br>
&nbsp;&nbsp;<a href="javadoc/index.html">Javadoc</a> <br>
<img src="images/yellowarrow.gif" alt="arrow" width="4" height="8"><b>&nbsp;<font color="#cc9900">About</font></b>
</small>
</p>
<img width="145" height="0" alt="">
<table cellpadding="1" width="120">
<tr>
<td style="background-color: #efefef"><small>
<!-- <div class="sidesearch">
<form action="http://googlesite.google.com/search" method="get">
<div align="center">
<font size="-2"><input type="hidden" name="output" value="googleabout"><input type="hidden" name="site" value="googlesite">
<i>Find on this site:</i><br>
<input type="text" name="q" size="10"><br><input type="submit" value="Search" name="submit">
<br>
</font>
</div>
</form>
</div> -->
</small>
</td>
</tr>
</table>
</td>
<td style="background-color: #cccccc" width="1" valign="top"><img alt="" width="1" height="1"></td>
<td style="background-color: #ffffff" width="10" valign="top"><img alt="" width="1" height="1"></td>
<td valign="top">
<p>
<b>Google Tag Libary License </b>
</p>
<p>
<font size="-1">Copyright (c) 2002-2003, Erik C. Thauvin.<br>
All rights reserved.</font>
</p>
<font size="-1">
<p>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
</p>
<p>
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
</p>
<p>
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.
</p>
<p>
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.
</p>
<p>
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;
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.
</p>
</font></td>
</tr>
</table>
</body>
</html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,90 @@
License Agreement
SUN MICROSYSTEMS, INC. (``SUN'') IS WILLING TO LICENSE ITS JAVABEANS(tm)
ACTIVATION FRAMEWORK SOFTWARE (``SOFTWARE'') TO
YOU ("CUSTOMER") ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE
TERMS CONTAINED IN THIS LICENSE AGREEMENT ("AGREEMENT"). READ THE
TERMS AND CONDITIONS OF THE AGREEMENT CAREFULLY BEFORE SELECTING THE
"ACCEPT" BUTTON AT THE BOTTOM OF THIS PAGE. BY SELECTING THE
"ACCEPT" BUTTON YOU AGREE TO THE TERMS AND CONDITIONS OF THE
AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY ITS TERMS, SELECT
THE "DO NOT ACCEPT" BUTTON AT THE BOTTOM OF THIS PAGE AND THE
INSTALLATION PROCESS WILL NOT CONTINUE.
1. License to Distribute. Customer is granted a royalty-free,
non-transferable right to reproduce and use the Software
for the purpose of developing applications which run in
conjunction with the Software. Customer may not modify the Software
(including any APIs exposed by the Software) in any way.
2. Restrictions. Software is confidential copyrighted information
of Sun and title to all copies is retained by Sun and/or its
licensors. Except to the extent enforcement of this provision is
prohibited by applicable law, if at all, Customer shall not decompile,
disassemble, decrypt, extract, or otherwise reverse engineer Software.
Software is not designed or intended for use in on-line control of
aircraft, air traffic, aircraft navigation or aircraft communications;
or in the design, construction, operation or maintenance of any nuclear
facility. Customer warrants that it will not use or redistribute the
Software for such purposes.
3. Trademarks and Logos. This Agreement does not authorize
Customer to use any Sun name, trademark or logo. Customer acknowledges
that Sun owns the Java trademark and all Java-related trademarks, logos
and icons including the Coffee Cup and Duke (``Java Marks'') and agrees
to: (i) comply with the Java Trademark Guidelines at
http://java.sun.com/trademarks.html; (ii) not do anything harmful to or
inconsistent with Sun's rights in the Java Marks; and (iii) assist Sun
in protecting those rights, including assigning to Sun any rights
acquired by Customer in any Java Mark.
4. Disclaimer of Warranty. Software is provided ``AS IS,'' without a
warranty of any kind. ALL EXPRESS OR IMPLIED REPRESENTATIONS AND
WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
5.Limitation of Liability. IN NO EVENT WILL SUN OR ITS LICENSORS
BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL,
INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED
AND REGARDLESS OF THE THEORY OF LIABILITY ARISING OUT OF THE
DOWNLOADING OF, USE OF, OR INABILITY TO USE, SOFTWARE, EVEN IF SUN HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
6. Termination. Customer may terminate this Agreement at any time
by destroying all copies of Software. This Agreement will terminate
immediately without notice from Sun if Customer fails to comply with any
provision of this Agreement. Upon such termination, Customer must destroy
all copies of Software. Sections 4 and 5 above shall survive termination
of this Agreement.
7. Export Regulations. Software, including technical data, is
subject to U.S. export control laws, including the U.S. Export
Administration Act and its associated regulations, and may be subject
to export or import regulations in other countries. Customer agrees to
comply strictly with all such regulations and acknowledges that it has
the responsibility to obtain licenses to export, re-export, or import
Software. Software may not be downloaded, or otherwise exported or
re-exported (i) into, or to a national or resident of, Cuba, Iraq,
Iran, North Korea, Libya, Sudan, Syria or any country to which the U.S.
has embargoed goods; or (ii) to anyone on the U.S. Treasury
Department's list of Specially Designated Nations or the U.S. Commerce
Department's Table of Denial Orders.
8. Restricted Rights. Use, duplication or disclosure by the United
States government is subject to the restrictions as set forth in the
Rights in Technical Data and Computer Software Clauses in DFARS
252.227-7013(c) (1) (ii) and FAR 52.227-19(c) (2) as applicable.
9. Governing Law. Any action related to this Agreement will be
governed by California law and controlling U.S. federal law. No choice
of law rules of any jurisdiction will apply.
10. Severability. If any of the above provisions are held to be in
violation of applicable law, void, or unenforceable in any
jurisdiction, then such provisions are herewith waived or amended to
the extent necessary for the Agreement to be otherwise enforceable in
such jurisdiction. However, if in Sun's opinion deletion or amendment
of any provisions of the Agreement by operation of this paragraph
unreasonably compromises the rights or increase the liabilities of Sun
or its licensors, Sun reserves the right to terminate the Agreement.

View file

@ -0,0 +1,54 @@
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. 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.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
* ITS 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.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/

View file

@ -0,0 +1,54 @@
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. 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.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The name "Apache Software Foundation" must not be used to endorse or
* promote products derived from this software without prior written
* permission. For written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
* ITS 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.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999-2001, Sun Microsystems,
* Inc., http://www.sun.com. For more information on the Apache Software
* Foundation, please see <http://www.apache.org/>.
*/

View file

@ -0,0 +1,273 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="StarOffice 6.0 (Solaris Sparc)">
<META NAME="CREATED" CONTENT="20010417;9204700">
<META NAME="CHANGED" CONTENT="20030626;13384500">
</HEAD>
<BODY LANG="en-US">
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">Sun
Doc Check Doclet, Version 1.2 Beta 2 </FONT>
</P>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">Pre-Release
Software Evaluation Agreement</FONT></P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">SUN
MICROSYSTEMS, INC. (&quot;SUN&quot;) IS WILLING TO LICENSE SUN DOC
CHECK DOCLET, VERSION 1.2 BETA 2 SOFTWARE TO YOU (&quot;LICENSEE&quot;)
ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN
THIS LICENSE AGREEMENT (&quot;AGREEMENT&quot;). PLEASE READ THE TERMS
AND CONDITIONS OF THIS LICENSE CAREFULLY. BY INSTALLING THIS
SOFTWARE, YOU ACCEPT THE TERMS AND CONDITIONS OF THIS LICENSE
AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY ITS TERMS, SELECT
THE &quot;DO NOT ACCEPT&quot; BUTTON AT THE BOTTOM OF THIS PAGE AND
THE INSTALLATION PROCESS WILL NOT CONTINUE. </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">1.0 DEFINITIONS </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">&quot;Licensed
Software&quot; means the Sun Doc Check Doclet, Version 1.2 Beta 2 in
source form, any portions of the software code provided in binary
form, and any user manuals, programming guides and other
documentation provided to Licensee by Sun under the agreement.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">1.2 &quot;Derivative
Product&quot; means: (a) any work or invention, new material,
information or data which is based in whole or in part upon the
Licensed Software, including any derivative work, improvement,
extension, revision, modification, translation, abridgement,
condensation, expansion, collection, compilation, or any other form
in which the Licensed Software may be recast, transformed or adapted;
or (b) any modification, addition, procedure, routine or work-around
intended to correct any failure of the Licensed Software to perform
its intended functions or any failure to perform in accordance with
any accompanying documentation or specifications.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">2.0 LIMITED
LICENSE </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">Sun grants to
Licensee, a non-exclusive, non-transferable, royalty-free and limited
license to use and modify the Licensed Software internally for the
purpose of generating documentation for commercial and non-commercial
use; provided, that Licensee will hold Sun harmless from any
liability arising from distribution and use of such documentation. No
license is granted to Licensee for any other purpose. Licensee may
not sell, rent, loan or otherwise encumber or transfer Licensed
Software in whole or in part, to any third party.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">3.0 LICENSE
RESTRICTIONS </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">3.1 Licensee may
not duplicate Licensed Software other than for a single copy of
Licensed Software for archival purposes only. Licensee agrees to
reproduce any copyright and other proprietary right notices on any
such copy.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">3.2 Except as
otherwise provided by law and Section 2.0, Licensee may not modify or
create derivative works of the Licensed Software, or reverse
engineer, disassemble or decompile binary portions of the Licensed
Software, or otherwise attempt to derive the source code from such
portions.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">3.3 No right,
title, or interest in or to Licensed Software, any trademarks,
service marks, or trade names of Sun or Sun's licensors is granted
under this Agreement.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">3.4 Except as
provided for in Section 2.0, Licensee shall have no right to use the
Licensed Software for productive or commercial use.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale"><FONT SIZE=3>3.5
Sun will retain ownership of Licensed Software, and all copies
thereof. Sun will own all Derivative Product. Licensee irrevocably
transfers and assigns to Sun any interest it may have in Derivative
Products, including without limitation all world&shy;wide
intellectual property rights and moral rights.&nbsp; Licensee forever
waives and agrees never to assert any moral rights (including without
limitation rights of paternity and attribution) or other intellectual
property rights it may have in Derivative Products, even after
termination of this Agreement. Licensee will assist Sun in taking any
actions required for Sun to obtain or perfect intellectual property
rights in Derivative Products worldwide, as Sun deems reasonably
appropriate. Licensee will enter into agreements with its employees,
employees of subsidiaries and contractors who may create Derivative
Products to ensure the free assignment of the rights granted to Sun
under this Agreement.</FONT></FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">4.0 NO SUPPORT </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">Sun is under no
obligation to support Licensed Software or to provide Licensee with
updates or error corrections (collectively &quot;Software Updates&quot;).
If Sun, at its sole option, supplies Software Updates to Licensee,
the Software Updates will be considered part of Licensed Software,
and subject to the terms of this Agreement.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">5.0 LICENSEE
DUTIES </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">Licensee agrees
to evaluate and test the Licensed Software for use with Licensee's
products and to provide feedback to Sun's email address:
doccheck-feedback@sun.com. Sun shall treat any oral or written
feedback or results of Licensee's testing of the Licensed Software
which Licensee provides to Sun as Sun's Confidential Information
(defined in Section 7 below).</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">6.0 TERM AND
TERMINATION OF AGREEMENT </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">6.1 This
Agreement will commence on the date on which Licensee receives
Licensed Software (the &quot;Effective Date&quot;) and will expire
two (2) years from the Effective Date, unless terminated earlier as
provided below.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">6.2 Either party
may terminate this Agreement upon ten (10) days written notice to the
other party. However, Sun may terminate this Agreement immediately
should any Licensed Software become, or in Sun's opinion be likely to
become, the subject of a claim of infringement of a patent, trade
secret or copyright.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">6.3 Sun may
terminate this Agreement immediately should Licensee materially
breach any of its provisions or take any action in derogation of
Sun's rights to the Confidential Information licensed to Licensee.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">6.4 Upon
termination or expiration of this Agreement, Licensee will
immediately cease use of and destroy Licensed Software and Derivative
Product and any copies thereof and provide Sun a written statement
certifying that Licensee has complied with the foregoing obligations.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">6.5 Rights and
obligations under this Agreement which by their nature should
survive, will remain in effect after termination or expiration
hereof.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">7.0 CONFIDENTIAL
INFORMATION </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">7.1 For purposes
of this Agreement, &quot;Confidential Information&quot; means: (i)
business and technical information and any source code or binary code
which Sun discloses to Licensee related to Licensed Software; (ii)
any Derivative Product, and (iii) the terms, conditions, and
existence of this Agreement. Licensee may not disclose Confidential
Information or use it except for the purposes specified in this
Agreement. Licensee will protect the confidentiality of Confidential
Information to the same degree of care, but no less than reasonable
care, as Licensee uses to protect its own Confidential Information.
Licensee's obligations regarding Confidential Information will expire
no less than five (5) years from the date of receipt of the
Confidential Information, except for Sun source code which will be
protected in perpetuity. Licensee agrees that Licensed Software
contains trade secrets of Sun.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">7.2
Notwithstanding any provisions contained in this Agreement concerning
nondisclosure and non-use of the Confidential Information, the
nondisclosure obligations of Section 7.1 will not apply to any
portion of Confidential Information that a Licensee can demonstrate
in writing is: (i) now, or hereafter through no act or failure to act
on the part of Licensee becomes, generally known to the general
public; (ii) known to Licensee at the time of receiving the
Confidential Information without an obligation of confidentiality;
(iii) hereafter rightfully furnished to Licensee by a third party
without restriction on disclosure; or (iv) independently developed by
Licensee without any use of the Confidential Information.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">7.3 Licensee
must restrict access to Confidential Information to its employees or
contractors with a need for this access to perform their employment
or contractual obligations and who have agreed in writing to be bound
by a confidentiality obligation which incorporates the protections
and restrictions substantially as set forth in this Agreement.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">8.0 DISCLAIMER
OF WARRANTY </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">8.1 Licensee
acknowledges that Licensed Software may contain errors and is not
designed or intended for use in the design, construction, operation
or maintenance of any nuclear facility (&quot;High Risk Activities&quot;).
Sun disclaims an express or implied warranty of fitness for such
uses. Licensee represents and warrants to Sun that it will not use,
distribute or license the Licensed Software for High Risk Activities.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">8.2 LICENSED
SOFTWARE IS PROVIDED &quot;AS IS&quot;. ALL EXPRESS OR IMPLIED
CONDITIONS, REPRESENTATIONS, AND WARRANTIES, INCLUDING ANY IMPLIED
WARRANTY OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO
THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.</FONT></P>
<P STYLE="margin-bottom: 0cm; font-weight: medium"><FONT FACE="Thorndale">9.0
LIMITATION OF LIABILITY </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">9.1 Licensee
acknowledges that the Licensed Software is experimental. Licensee
acknowledges that the Licensed Software may have defects or
deficiencies which cannot or will not be corrected by Sun. Licensee
will hold Sun harmless from any claims based on Licensee's use of the
Licensed Software for any purposes other than those in Section 2.0,
and from any claims that later versions or releases of any Licensed
Software furnished to Licensee are incompatible with the Licensed
Software provided to Licensee under this Agreement.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">9.2 Licensee
shall have the sole responsibility to protect adequately and backup
Licensee's data and/or equipment used in connection with the Licensed
Software. Licensee shall not claim against Sun for lost data, re-run
time, inaccurate output, work delays or lost profits resulting from
Licensee' use of the Licensed Software.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">9.3 Licensee
acknowledges that Sun is under no obligation to release the Licensed
Software as a product of Sun.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">9.4 </FONT><FONT FACE="Thorndale">To
the extent not prohibited by law, in no event will Sun be liable for
any indirect, punitive, special, incidental or consequential damage
in connection with or arising out of this Agreement (including loss
of business, revenue, profits, use, data or other economic
advantage), however it arises, whether for breach or in tort, even if
the other party has been previously advised of the possibility of
such damage.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">10.0 U.S.
GOVERNMENT RIGHTS </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">If Licensed
Software is being acquired by or on behalf of the U.S. Government or
by a U.S. Government prime contractor or subcontractor (at any tier),
then the Government's rights in Software will be only as set forth in
this Agreement; this is in accordance with 48 CFR 227.7201 through
227.7202-4 (for Department of Defense (DOD) acquisitions) and with 48
CFR 2.101 and 12.212 (for non-DOD acquisitions).</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">11.0 GENERAL
TERMS </FONT>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">11.1 Any action
related to this Agreement will be governed by California law and
controlling U.S. federal law. The U.N. Convention for the
International Sale of Goods and the choice of law rules of any
jurisdiction will not apply.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">11.2 Licensed
Software and technical data delivered under this Agreement are
subject to U.S. export control laws and may be subject to export or
import regulations in other countries. Licensee agrees to comply
strictly with all such laws and regulations and acknowledges that it
has the responsibility to obtain such licenses to export, re-export
or import as may be required after delivery to Licensee.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">11.3 It is
understood and agreed that, notwithstanding any other provision of
this Agreement, Licensee's breach of the provisions of Section 7 of
this Agreement will cause Sun irreparable damage for which recovery
of money damages would be inadequate, and that Sun will therefore be
entitled to seek timely injunctive relief to protect Sun's rights
under this Agreement in addition to any and all remedies available at
law.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">11.4 Neither
party may assign or otherwise transfer any of its rights or
obligations under this Agreement, without the prior written consent
of the other party, except that Sun may assign this Agreement to an
affiliated company.</FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Thorndale">11.5 This
Agreement is the parties' entire agreement relating to its subject
matter. It supersedes all prior or contemporaneous oral or written
communications, proposals, conditions, representations and warranties
and prevails over any conflicting or additional terms of any quote,
order, acknowledgment, or other communication between the parties
relating to its subject matter during the term of this Agreement. No
modification to this Agreement will be binding, unless in writing and
signed by an authorized representative of each party.</FONT></P>
<P STYLE="margin-bottom: 0cm"><I><FONT FACE="Thorndale">(LFI#133032/Form
ID#011801)</FONT></I>
</P>
</BODY>
</HTML>

View file

@ -0,0 +1,150 @@
Thank you for using the Google Web APIs (TM) service! By using this
service ("Google Web APIs") you agree to be bound by the following
terms and conditions (the "Terms and Conditions").
PERSONAL AND LEGITIMATE USES ONLY
The Google Web APIs service is made available to you for your
personal, non-commercial use only (at home or at work). You may only
create a single account and must provide accurate identification,
contact, and other information required as part of the registration
process. You may not create any script or other automated tool that
attempts to create multiple Google Web APIs accounts. And you may not
use the search results provided by the Google Web APIs service with an
existing product or service that competes with products or services
offered by Google.
If you are interested in doing anything different than the foregoing,
you must first obtain Google's written consent. If you fail to do so,
Google reserves the right to take legal action against you.
Furthermore, you may not use Google Web APIs in any manner that either
directly or indirectly violates any laws or proprietary rights. This
includes laws and proprietary rights in the United States as well as
in other countries.
If you have questions on your contemplated use or if you have comments
on Google Web APIs or ideas on how to improve it, please email
api-support@google.com. Please note that by doing so, you also grant
Google permission to use and incorporate your ideas or comments into
Google Web APIs without further compensation.
INTELLECTUAL PROPERTY
You agree not to remove, obscure, or alter Google's copyright notice,
trademarks, or other proprietary rights notices affixed to or
contained within Google Web APIs. You also acknowledge that Google
owns all right, title and interest in and to Google Web APIs,
including without limitation all intellectual property rights (the
"Google Rights"). The Google Rights include rights to the following:
(1) the APIs developed and provided by Google, (2) all software
associated with the Google Web APIs server, and (3) the search results
and spell checking you obtain when you use Google Web APIs. The Google
Rights do not include the following: (1) third party components used
as part of Google Web APIs; or (2) software developed by you in
conjunction with using Google Web APIs.
PUBLICITY
So long as you comply with your obligations under this Agreement, you
may indicate that a product or service that you created either used or
is based on Google Web APIs provided that those products or services
do not in Google's reasonable opinion (1) tarnish, infringe, or dilute
Google's trademarks, (2) violate any applicable law, and (3) infringe
any third party rights. If you wish to use the GOOGLE trademark and/or
logo in any other manner, you must first obtain Google's written
consent.
DISCLAIMER OF WARRANTIES
The Google Web APIs service is presently in Beta form and has not been
fully tested or debugged. Accordingly, Google disclaims any
responsibility for any harm resulting from your use of Google Web APIs.
The Google Web APIs service is provided "as is," with no warranties
whatsoever. Google expressly disclaims to the fullest extent permitted
by law all express, implied, and statutory warranties, including,
without limitation, the warranties of merchantability, fitness for a
particular purpose, and non-infringement of proprietary rights. Google
disclaims any warranties regarding the security, reliability,
timeliness, availability, and performance of Google Web APIs.
You understand and agree that you use Google Web APIs at your own
discretion and risk and that you will be solely responsible for any
damages to your computer system or loss of data that results from the
download or use of Google Web APIs.
Some states or other jurisdictions do not allow the exclusion of
implied warranties, so the above exclusions may not apply to you. You
may also have other rights that vary from state to state and
jurisdiction to jurisdiction.
LIMITATION OF LIABILITY
The Google Web APIs service is being provided free of charge.
Accordingly, you agree that Google shall have no liability arising
from or based on your use of Google Web APIs.
Under no circumstances shall Google be liable to any user on account
of that user's use or misuse of Google Web APIs. Such limitation of
liability shall apply to prevent recovery of direct, indirect,
incidental, consequential, special, exemplary, and punitive damages
whether such claim is based on warranty, contract, tort (including
negligence), or otherwise, even if Google has been advised of the
possibility of such damages). Such limitation of liability shall apply
whether the damages arise from use or misuse of and reliance on the
Google Web APIs, from inability to use Google Web APIs, or from the
interruption, suspension, or termination of Google Web APIs (including
such damages incurred by third parties). Such limitation shall apply
notwithstanding a failure of essential purpose of any limited remedy
and to the fullest extent permitted by law.
Some states or other jurisdictions do not allow the exclusion or
limitation of liability for incidental or consequential damages, so
the above limitations and exclusions may not apply to you.
INDEMNIFICATION
You hereby agree to indemnify, defend and hold Google, and its
officers, directors, agents, licensors and licensees (collectively,
the "Indemnified Parties") harmless from and against any and all
liability and costs incurred by the Indemnified Parties in connection
with any claim arising out of your use of Google Web APIs, including,
without limitation, reasonable attorneys' fees. You shall cooperate as
fully as reasonably required in the defense of any claim. Google
reserves the right, at its own expense, to assume the exclusive
defense and control of any matter subject to indemnification by you.
GOOGLE'S SEARCH SERVICE
The Google Web APIs service is designed to be used in conjunction with
Google's search services. Accordingly, your use of Google Web APIs is
also defined by Google's Terms of Service and Privacy Policy. In the
event of a conflict between these Terms and Conditions and Google's
Terms of Service, these Terms and Conditions shall prevail.
TERM AND TERMINATION
If you wish to terminate this Agreement, you may simply cease using
the Google Web APIs service. In such a case, you must delete any
search result information that you may have obtained from the Google
Web APIs service. Google may terminate this Agreement (and your
account) at any time, with or without cause.
GENERAL PROVISIONS
These Terms and Conditions will be governed by and construed in
accordance with the laws of the State of California, without giving
effect to the conflict of laws provisions of California or your actual
state or country of residence. Any dispute arising from these Terms
and Conditions shall be adjudicated in the federal or state courts
located in Santa Clara County, California. If for any reason a court
of competent jurisdiction finds any provision or portion of these
Terms and Conditions to be unenforceable, the remainder of these Terms
and Conditions will continue in full force and effect. These Terms and
Conditions constitute the entire agreement between the parties with
respect to the subject matter hereof and supersede and replace all
prior or contemporaneous understandings or agreements, written or
oral, regarding such subject matter. Any waiver of any provision of
these Terms and Conditions will be effective only if in writing and
signed by Google.

View file

@ -0,0 +1,170 @@
Sun Microsystems, Inc.
Binary Code License Agreement
READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED SUPPLEMENTAL LICENSE TERMS
(COLLECTIVELY "AGREEMENT") CAREFULLY BEFORE OPENING THE SOFTWARE MEDIA
PACKAGE. BY OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF
THIS AGREEMENT. IF YOU ARE ACCESSING THE SOFTWARE ELECTRONICALLY, INDICATE
YOUR ACCEPTANCE OF THESE TERMS BY SELECTING THE "ACCEPT" BUTTON AT THE END
OF THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL THESE TERMS, PROMPTLY RETURN
THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND OR, IF THE
SOFTWARE IS ACCESSED ELECTRONICALLY, SELECT THE "DECLINE" BUTTON AT THE END
OF THIS AGREEMENT.
1. LICENSE TO USE. Sun grants you a non-exclusive and non-transferable
license for the internal use only of the accompanying software and
documentation and any error corrections provided by Sun (collectively
"Software"), by the number of users and the class of computer hardware for
which the corresponding fee has been paid.
2. RESTRICTIONS. Software is confidential and copyrighted. Title to
Software and all associated intellectual property rights is retained by Sun
and/or its licensors. Except as specifically authorized in any Supplemental
License Terms, you may not make copies of Software, other than a single copy
of Software for archival purposes. Unless enforcement is prohibited by
applicable law, you may not modify, decompile, or reverse engineer
Software. You acknowledge that Software is not designed, licensed or
intended for use in the design, construction, operation or maintenance of
any nuclear facility. Sun disclaims any express or implied warranty of
fitness for such uses. No right, title or interest in or to any trademark,
service mark, logo or trade name of Sun or its licensors is granted under
this Agreement.
3. LIMITED WARRANTY. Sun warrants to you that for a period of ninety (90)
days from the date of purchase, as evidenced by a copy of the receipt, the
media on which Software is furnished (if any) will be free of defects in
materials and workmanship under normal use. Except for the foregoing,
Software is provided "AS IS". Your exclusive remedy and Sun's entire
liability under this limited warranty will be at Sun's option to replace
Software media or refund the fee paid for Software.
4. DISCLAIMER OF WARRANTY. UNLESS SPECIFIED IN THIS AGREEMENT, ALL EXPRESS
OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED
WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
NON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS
ARE HELD TO BE LEGALLY INVALID.
5. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO
EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR
DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT
OF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event will Sun's
liability to you, whether in contract, tort (including negligence), or
otherwise, exceed the amount paid by you for Software under this Agreement.
The foregoing limitations will apply even if the above stated warranty fails
of its essential purpose.
6. Termination. This Agreement is effective until terminated. You may
terminate this Agreement at any time by destroying all copies of Software.
This Agreement will terminate immediately without notice from Sun if you
fail to comply with any provision of this Agreement. Upon Termination, you
must destroy all copies of Software.
7. Export Regulations. All Software and technical data delivered under this
Agreement are subject to US export control laws and may be subject to export
or import regulations in other countries. You agree to comply strictly with
all such laws and regulations and acknowledge that you have the
responsibility to obtain such licenses to export, re-export, or import as
may be required after delivery to you.
8. U.S. Government Restricted Rights. If Software is being acquired by or
on behalf of the U.S. Government or by a U.S. Government prime contractor or
subcontractor (at any tier), then the Government's rights in Software and
accompanying documentation will be only as set forth in this Agreement; this
is in accordance with 48 CFR 227.7201 through 227.7202-4 (for Department of
Defense (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD
acquisitions).
9. Governing Law. Any action related to this Agreement will be governed by
California law and controlling U.S. federal law. No choice of law rules of
any jurisdiction will apply.
10. Severability. If any provision of this Agreement is held to be
unenforceable, this Agreement will remain in effect with the provision
omitted, unless omission would frustrate the intent of the parties, in which
case this Agreement will immediately terminate.
11. Integration. This Agreement is the entire agreement between you and
Sun relating to its subject matter. It supersedes all prior or
contemporaneous oral or written communications, proposals, representations
and warranties and prevails over any conflicting or additional terms of any
quote, order, acknowledgment, or other communication between the parties
relating to its subject matter during the term of this Agreement. No
modification of this Agreement will be binding, unless in writing and signed
by an authorized representative of each party.
JAVAMAIL, VERSION 1.2
SUPPLEMENTAL LICENSE TERMS
These supplemental license terms ("Supplemental Terms") add to or modify the
terms of the Binary Code License Agreement (collectively, the "Agreement").
Capitalized terms not defined in these Supplemental Terms shall have the
same meanings ascribed to them in the Agreement. These Supplemental Terms
shall supersede any inconsistent or conflicting terms in the Agreement, or
in any license contained within the Software.
1. Software Internal Use and Development License Grant. Subject to the
terms and conditions of this Agreement, including, but not limited to
Section 3 (Java(TM) Technology Restrictions) of these Supplemental Terms,
Sun grants you a non-exclusive, non-transferable, limited license to
reproduce internally and use internally the binary form of the Software,
complete and unmodified, for the sole purpose of designing, developing and
testing your Java applets and applications ("Programs").
2. License to Distribute Software. Subject to the terms and conditions of
this Agreement, including, but not limited to Section 3 (Java (TM)
Technology Restrictions) of these Supplemental Terms, Sun grants you a
non-exclusive, non-transferable, limited license to reproduce and distribute
the Software in binary code form only, provided that (i) you distribute the
Software complete and unmodified and only bundled as part of, and for the
sole purpose of running, your Java applets or applications ("Programs"),
(ii) the Programs add significant and primary functionality to the Software,
(iii) you do not distribute additional software intended to replace any
component(s) of the Software, (iv) you do not remove or alter any
proprietary legends or notices contained in the Software, (v) you only
distribute the Software subject to a license agreement that protects Sun's
interests consistent with the terms contained in this Agreement, and (vi)
you agree to defend and indemnify Sun and its licensors from and against any
damages, costs, liabilities, settlement amounts and/or expenses (including
attorneys' fees) incurred in connection with any claim, lawsuit or action by
any third party that arises or results from the use or distribution of any
and all Programs and/or Software.
3. Java Technology Restrictions. You may not modify the Java Platform
Interface ("JPI", identified as classes contained within the "java" package
or any subpackages of the "java" package), by creating additional classes
within the JPI or otherwise causing the addition to or modification of the
classes in the JPI. In the event that you create an additional class and
associated API(s) which (i) extends the functionality of the Java platform,
and (ii) is exposed to third party software developers for the purpose of
developing additional software which invokes such additional API, you must
promptly publish broadly an accurate specification for such API for free use
by all developers. You may not create, or authorize your licensees to
create additional classes, interfaces, or subpackages that are in any way
identified as "java", "javax", "sun" or similar convention as specified by
Sun in any naming convention designation.
4. Trademarks and Logos. You acknowledge and agree as between you and Sun
that Sun owns the SUN, SOLARIS, JAVA, JINI, FORTE, STAROFFICE, STARPORTAL
and iPLANET trademarks and all SUN, SOLARIS, JAVA, JINI, FORTE, STAROFFICE,
STARPORTAL and iPLANET-related trademarks, service marks, logos and other
brand designations ("Sun Marks"), and you agree to comply with the Sun
Trademark and Logo Usage Requirements currently located at
http://www.sun.com/policies/trademarks. Any use you make of the Sun Marks
inures to Sun's benefit.
5. Source Code. Software may contain source code that is provided solely for
reference purposes pursuant to the terms of this Agreement. Source code may
not be redistributed unless expressly provided for in this Agreement.
6. Termination for Infringement. Either party may terminate this Agreement
immediately should any Software become, or in either party's opinion be
likely to become, the subject of a claim of infringement of any intellectual
property right.
For inquiries please contact: Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California 94303

View file

@ -0,0 +1,29 @@
Google Tag Library License
Copyright (c) 2002-2003, 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.

View file

@ -0,0 +1,648 @@
/*
* @(#)GoogleSearchBean.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google;
import com.google.soap.search.GoogleSearch;
import com.google.soap.search.GoogleSearchFault;
import com.google.soap.search.GoogleSearchResult;
import com.google.soap.search.GoogleSearchResultElement;
import java.net.URL;
import java.net.URLEncoder;
/**
* Implements methods used to perform searches on Google.
*
* @author Erik C. Thauvin
* @created April 25, 2002
* @version $Revision$
* @since 1.0
*/
public class GoogleSearchBean
{
/**
* The default related-queries filter.
*/
public static final boolean DEFAULT_FILTER = true;
/**
* The default language restricts.
*/
public static final String DEFAULT_LR = "";
/**
* The default maximum number of results to be returned.
*/
public static final int DEFAULT_MAX_RESULTS = 10;
/**
* The default document store restrict.
*/
public static final String DEFAULT_RESTRICT = "";
/**
* The default SafeSearch.
*/
public static final boolean DEFAULT_SAFE_SEARCH = false;
/**
* The default site.
*/
public static final String DEFAULT_SITE = "";
/**
* The default index of the result to be returned.
*/
public static final int DEFAULT_START = 0;
/**
* The <em>next</em> keyword.
*/
public static final String NEXT_KEYWORD = "next";
/**
* The <em>previous</em> keyword.
*/
public static final String PREVIOUS_KEYWORD = "previous";
// Invalid key error message.
private static final String INVALID_KEY_ERROR =
"The authorization key has not been specified.";
private GoogleSearch service = null;
private GoogleSearchResult result = null;
private GoogleSearchResultElement elements[] = null;
private boolean keySet = false;
private int maxResults = 10;
/**
* Constructs a new instance of the bean.
*/
public GoogleSearchBean()
{
service = new GoogleSearch();
}
/**
* Constructs a new instance of the bean with the specified authorization
* key.
*
* @param key The authorization key.
*/
public GoogleSearchBean(String key)
{
this();
setKey(key);
}
/**
* Sets the authorization key.
*
* @param key The key string.
*/
public final void setKey(String key)
{
service.setKey(key);
if ((key != null) && (key.trim().length() > 0))
{
keySet = true;
}
else
{
keySet = false;
}
}
/**
* Returns true if the authorization key is set.
*
* @return true or false.
*/
public final boolean isKeySet()
{
return keySet;
}
/**
* 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, int proxyPort,
String proxyUserName, String proxyPassword)
{
service.setProxyHost(proxyHost);
service.setProxyPort(proxyPort);
service.setProxyUserName(proxyUserName);
service.setProxyPassword(proxyPassword);
}
/**
* Returns the results of the search.
*
* @return The GoogleSearchResult object.
*/
public final GoogleSearchResult getResult()
{
return result;
}
/**
* Returns an array of result elements that corresponds to the actual list
* of search results.
*
* @return The array of result elements.
*/
public final GoogleSearchResultElement[] getResultElements()
{
return elements;
}
/**
* Returns the count of result elements.
*
* @return The result elements count.
* @see #getResultElements()
*/
public final int getResultElementsCount()
{
if (elements != null)
{
return elements.length;
}
return 0;
}
/**
* Returns true whenever the result set is valid, indicating that a search
* was performed.
*
* @return true or false.
*/
public final boolean isValidResult()
{
if (result != null)
{
return true;
}
return false;
}
/**
* Returns a cached web page from Google.
*
* @param url The page's URL.
* @return The HTML code of the cached page.
* @exception GoogleSearchFault
*/
public String getCachedPage(String url)
throws GoogleSearchFault
{
if (isKeySet())
{
reset();
return new String(service.doGetCachedPage(url));
}
throw new GoogleSearchFault(INVALID_KEY_ERROR);
}
/**
* Invokes a Google search.
*
* @param q The Google query.
* @param start The index of the result to be returned.
* @param maxResults The maximum number of results to be returned.
* @param filter The related-queries filter.
* @param restrict The document store restrict value (e.g.: "linux").
* @param safeSearch Enable or disable SafeSearch.
* @param lr The language restricts for the search.
* @return The results of the search.
* @exception GoogleSearchFault
*/
public GoogleSearchResult getGoogleSearch(String q, int start,
int maxResults, boolean filter,
String restrict,
boolean safeSearch, String lr)
throws GoogleSearchFault
{
if (isKeySet())
{
reset();
service.setQueryString(q);
service.setStartResult(start);
this.maxResults = maxResults;
service.setMaxResults(maxResults);
service.setFilter(filter);
service.setRestrict(restrict);
service.setSafeSearch(safeSearch);
service.setLanguageRestricts(lr);
result = service.doSearch();
if (result != null)
{
elements = result.getResultElements();
}
return result;
}
throw new GoogleSearchFault(INVALID_KEY_ERROR);
}
/**
* Returns the GoogleSearch attribute of the GoogleSearchBean object.
*
* @param key The authorization key.
* @param q The Google query.
* @param start The index of the result to be returned.
* @param maxResults The maximum number of results to be returned.
* @param filter The related-queries filter.
* @param restrict The document store restrict value (e.g.: "linux").
* @param safeSearch Enable or disable SafeSearch.
* @param lr The language restricts for the search.
* @return The results of the search.
* @exception GoogleSearchFault
* @see #getGoogleSearch(String, int, int, boolean, String, boolean, String)
*/
public GoogleSearchResult getGoogleSearch(String key, String q, int start,
int maxResults, boolean filter,
String restrict,
boolean safeSearch, String lr)
throws GoogleSearchFault
{
setKey(key);
return getGoogleSearch(q, start, maxResults, filter, restrict,
safeSearch, lr);
}
/**
* Returns the GoogleSearch attribute of the GoogleSearchBean object.
*
* @param q The Google query.
* @return The results of the search.
* @exception GoogleSearchFault
* @see #getGoogleSearch(String, int, int, boolean, String, boolean, String)
*/
public GoogleSearchResult getGoogleSearch(String q)
throws GoogleSearchFault
{
return getGoogleSearch(q, DEFAULT_START, DEFAULT_MAX_RESULTS,
DEFAULT_FILTER, DEFAULT_RESTRICT,
DEFAULT_SAFE_SEARCH, DEFAULT_LR);
}
/**
* Returns the specified property of the given element index in the current
* result set.
* <p>The properties are:</p>
* <table border="3">
* <tr><td><code>"summary"</code></td><td>Returns the ODP summary text
* string.</td></tr>
* <tr><td><code>"url"</code></td><td>Returns the absolute URL path of the
* search.</td></tr>
* <tr><td><code>"snippet"</code></td><td>Returns a text snippet of the
* query in context.</td></tr>
* <tr><td><code>"title"</code></td><td>Returns the title (HTML) of the
* search result.</td></tr>
* <tr><td><code>"cachedSize"</code></td><td>Returns the size of (size +
* <code>k</code>) the cached version of the URL, in kilobytes.</td></tr>
* <tr><td><code>"relatedInformationPresent"</code></td><td>Returns
* <code>true</code> when the <em>related:</em> query term is supported for
* this URL; <code>false</code>, otherwise.</td></tr>
* <tr><td><code>"hostName"</code></td><td>Returns the host name.</td></tr>
* <tr><td><code>"directoryTitle"</code></td><td>Returns the ODP directory
* title.</td></tr>
* <tr><td><code>"directoryCategoryName"</code></td><td>Returns the ODP
* directory name of the current ODP category.</td></tr>
* <tr><td><code>"directoryCategoryEncoding"</code></td><td>Returns the
* encoding scheme of the current ODP category.</td></tr>
* <tr><td><code>"relatedQuery"</code></td><td>Returns the related query
* string, suitable for use as a {@link #getGoogleSearch(String) search}
* query string.</td></tr>
* <tr><td><code>"cachedQuery"</code></td><td>Returns the cached query
* string, suitable for use as a {@link #getCachedPage(String) cached} query
* string.</td></tr>
* </table>
*
* @param index The element index.
* @param property The property name.
* @return The property value.
*/
public String getResultElementProperty(int index, String property)
{
if (elements != null)
{
if ((index >= 0) && (index < elements.length))
{
if (property.equalsIgnoreCase("url"))
{
return elements[index].getURL();
}
else if (property.equalsIgnoreCase("summary"))
{
return elements[index].getSummary();
}
else if (property.equalsIgnoreCase("snippet"))
{
return elements[index].getSnippet();
}
else if (property.equalsIgnoreCase("title"))
{
return elements[index].getTitle();
}
else if (property.equalsIgnoreCase("cachedSize"))
{
return elements[index].getCachedSize();
}
else if (property.equalsIgnoreCase("hostName"))
{
return elements[index].getHostName();
}
else if (property.equalsIgnoreCase("relatedInformationPresent"))
{
return String.valueOf(elements[index]
.getRelatedInformationPresent());
}
else if (property.equalsIgnoreCase("directoryTitle"))
{
return elements[index].getDirectoryTitle();
}
else if (property.equalsIgnoreCase("directoryCategoryName"))
{
return elements[index].getDirectoryCategory()
.getFullViewableName();
}
else if (property.equalsIgnoreCase("directoryCategoryEncoding"))
{
return elements[index].getDirectoryCategory()
.getSpecialEncoding();
}
else if (property.toLowerCase().endsWith("query"))
{
try
{
URL url = new URL(elements[index].getURL());
String urlString = url.toString();
String staticQuery =
urlString.substring(urlString.indexOf(url.getHost()));
if (property.equalsIgnoreCase("relatedQuery"))
{
return ("related:" + URLEncoder.encode(staticQuery));
}
else if (property.equalsIgnoreCase("cachedQuery"))
{
return (URLEncoder.encode(staticQuery));
}
else if (property.equalsIgnoreCase("staticQuery"))
{
return staticQuery;
}
}
catch (Exception e)
{
; // Do nothing
}
}
}
}
return "";
}
/**
* Returns the given property of the result set.
* <p>The properties are:</p>
* <table border="3">
* <tr><td><code>"estimatedTotalResultsCount"</code></td><td>Returns the
* estimated total number of results returned for the query.</td></tr>
* <tr><td><code>"startIndex"</code></td><td>Returns the index (1-based) of
* the first search result in the result elements.</td></tr>
* <tr><td><code>"endIndex"</code></td><td>Returns the index (1-based) of
* the last search result in the result elements.</td></tr>
* <tr><td><code>"searchTime"</code></td><td>Returns the total server time
* to process the query, in seconds.</td></tr>
* <tr><td><code>"searchTips"</code></td><td>Returns a string providing
* instructive suggestions on how to use Google.</td></tr>
* <tr><td><code>"searchComments"</code></td><td>Returns a string intended
* for display to the end user. (e.g.: list of removed <em>stop words</em>,
* etc.)</td></tr>
* <tr><td><code>"documentFiltering"</code></td><td>Returns
* <code>true</code> if filtering was performed on the search results;
* <code>false</code> otherwise.</td></tr>
* <tr><td><code>"searchQuery"</code></td><td>Returns the query string that
* generated this result.</td></tr>
* <tr><td><code>{@link #NEXT_KEYWORD next}</code></td><td>Returns the start
* index of the next set of results.</td></tr>
* <tr><td><code>{@link #PREVIOUS_KEYWORD previous}</code></td><td>Returns
* the start index of the previous set of results.</td></tr>
* </table>
*
* @param property The property name.
* @return The property value.
*/
public String getResultProperty(String property)
{
if (result != null)
{
if (property.equalsIgnoreCase("estimatedTotalResultsCount"))
{
return String.valueOf(result.getEstimatedTotalResultsCount());
}
else if (property.equalsIgnoreCase("startIndex"))
{
return String.valueOf(result.getStartIndex());
}
else if (property.equalsIgnoreCase("endIndex"))
{
return String.valueOf(result.getEndIndex());
}
else if (property.equalsIgnoreCase("searchTime"))
{
return String.valueOf(result.getSearchTime());
}
else if (property.equalsIgnoreCase("searchTips"))
{
return result.getSearchTips();
}
else if (property.equalsIgnoreCase("searchComments"))
{
return result.getSearchComments();
}
else if (property.equalsIgnoreCase("documentFiltering"))
{
return String.valueOf(result.getDocumentFiltering());
}
else if (property.equalsIgnoreCase("searchQuery"))
{
return result.getSearchQuery();
}
else if (property.equalsIgnoreCase(NEXT_KEYWORD))
{
if (result.getEndIndex() < result.getEstimatedTotalResultsCount())
{
if (maxResults == (result.getEndIndex()
- result.getStartIndex() + 1))
{
return String.valueOf(result.getEndIndex());
}
}
}
else if (property.equalsIgnoreCase(PREVIOUS_KEYWORD))
{
if (result.getStartIndex() > 1)
{
return String.valueOf(result.getStartIndex() - maxResults
- 1);
}
}
}
return "";
}
/**
* Asks Google to return a spelling suggestion for a word or phrase.
*
* @param phrase The word or phrase to correct the spelling for.
* @return The suggested correct spelling, or null if none.
* @exception GoogleSearchFault
*/
public String getSpellingSuggestion(String phrase)
throws GoogleSearchFault
{
if (isKeySet())
{
reset();
return service.doSpellingSuggestion(phrase);
}
throw new GoogleSearchFault(INVALID_KEY_ERROR);
}
/**
* Demonstration program to perform various Google searches.
* <p>The arguments are:</p>
* <code>&lt;client-key&gt; (search &lt;query&gt; | cached &lt;URL&gt; |
* spell &lt;phrase&gt;)</code>
*
* @param args The command line arguments.
*/
public static final void main(String args[])
{
GoogleSearchBean bean = new GoogleSearchBean();
if (args.length == 3)
{
String action = args[1];
try
{
bean.setKey(args[0]);
if (action.equalsIgnoreCase("search"))
{
bean.getGoogleSearch(args[2]);
for (int i = 0; i < bean.getResultElementsCount(); i++)
{
System.out.println(bean.getResultElementProperty(i,
"title")
+ " ("
+ bean.getResultElementProperty(i,
"url")
+ ')');
}
}
else if (action.equalsIgnoreCase("spell"))
{
System.out.println(bean.getSpellingSuggestion(args[2]));
}
else if (action.equalsIgnoreCase("cached"))
{
System.out.println(bean.getCachedPage(args[2]));
}
else
{
usage();
}
}
catch (GoogleSearchFault googleSearchFault)
{
googleSearchFault.printStackTrace();
}
}
else
{
usage();
}
}
/**
* Reset the bean properties.
*/
public void reset()
{
// Reset the result and elements
result = null;
elements = null;
}
/**
* Prints the usage and exits.
*/
private static void usage()
{
System.err.println("Usage: java " + GoogleSearchBean.class.getName()
+ " <client-key> (search <query> | cached <URL> | spell <phrase>)");
System.exit(1);
}
}

View file

@ -0,0 +1,452 @@
/*
* @(#)TagUtility.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google;
import java.net.URLEncoder;
import java.util.Enumeration;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.BodyContent;
/**
* Implements various methods commonly used by custom tags.
*
* @author Erik C. Thauvin
* @created April 25, 2002
* @version $Revision$
* @since 1.0
*/
public class TagUtility
{
/**
* The name of the cache request parameter.
*/
public static final String CACHE_PARAM = "cache";
/**
* The name of the filter request parameter.
*/
public static final String FILTER_PARAM = "filter";
/**
* The name of the Google Search bean attribute.
*/
public static final String GOOGLE_SEARCH_BEAN = "GoogleSearchBean";
/**
* The name of the input encoding context parameter.
*/
public static final String IE_PARAM = "ie";
/**
* The name of the key context parameter.
*/
public static final String KEY_CONTEXT_PARAM = "google_key";
/**
* The name of the key request parameter.
*/
public static final String KEY_PARAM = "key";
/**
* The name of the language restrict context parameter.
*/
public static final String LR_PARAM = "lr";
/**
* The name of the maxResults request parameter.
*/
public static final String MAX_RESULTS_PARAM = "maxResults";
/**
* The name of the output encoding context parameter.
*/
public static final String OE_PARAM = "oe";
/**
* The name of the query request parameter.
*/
public static final String QUERY_PARAM = "q";
/**
* The name of the restrict context parameter.
*/
public static final String RESTRICT_PARAM = "restrict";
/**
* The name of the safeSearch context parameter.
*/
public static final String SAFE_SEARCH_PARAM = "safeSearch";
/**
* The name of the site context parameter.
*/
public static final String SITE_PARAM = "site";
/**
* The name of the start request parameter.
*/
public static final String START_PARAM = "start";
/**
* Protected constructor to disable instantiation.
*/
protected TagUtility()
{
// Disabled
}
/**
* Returns the body of a tag.
*
* @param bodyContent The body.
* @return The tag body string or null.
*/
public static final String getTagBody(BodyContent bodyContent)
{
return getTagBody(bodyContent, false);
}
/**
* Returns the body of a tag.
*
* @param bodyContent The body.
* @param trim Trim the body if true
* @return The tag body string or null.
*/
public static final String getTagBody(BodyContent bodyContent, boolean trim)
{
try
{
if (trim)
{
return bodyContent.getString().trim();
}
else
{
return bodyContent.getString();
}
}
catch (NullPointerException e)
{
return null;
}
}
/**
* Validates a string value by insuring it is not null or empty.
* <p>
* Beginning and trailing spaces are removed whenever the trim
* flag is set to true.
*
* @param stringValue The String value.
* @param trim The trim flag.
* @return true if valid, false if not.
*/
public static final boolean isValidString(String stringValue, boolean trim)
{
if ((stringValue != null))
{
if (trim)
{
return isValidString(stringValue.trim());
}
else
{
return isValidString(stringValue);
}
}
return false;
}
/**
* Validates a string value by insuring it is not null or empty.
*
* @param stringValue The String value.
* @return true if valid, false if not.
*/
public static final boolean isValidString(String stringValue)
{
if ((stringValue != null) && (stringValue.length() > 0))
{
return true;
}
return false;
}
/**
* Returns the GoogleSearchBean attribute using the default
* {@link #GOOGLE_SEARCH_BEAN bean name}.
*
* @param pageContext The page context.
* @return The default Google search bean.
*/
public static GoogleSearchBean getGoogleSearchBean(PageContext pageContext)
{
// Fetch the bean using the default name
return ((GoogleSearchBean)pageContext.findAttribute(GOOGLE_SEARCH_BEAN));
}
/**
* Returns the value a specified parameter.
*
* @param request The ServletRequest object
* @param paramName The parameter name String value.
* @return The parameter value or null.
*/
public static String getParameter(ServletRequest request, String paramName)
{
// The parameter value
String paramValue = null;
if (isValidString(paramName))
{
// Get all parameters names
final Enumeration names = request.getParameterNames();
// Loop thru the names
while (names.hasMoreElements())
{
// Get the next parameter name
final String name = (String)names.nextElement();
// Is it our parameter?
if (name.equalsIgnoreCase(paramName))
{
// Get the parameter value
paramValue = request.getParameter(name);
}
}
}
// Return the parameter value
return paramValue;
}
/**
* Builds a HTML reference link:
* <p>
* For example: <code><a href="url" class="css" style="style" target="target">body</a></code>.
*
* @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
* @return A HTML reference link.
*/
public static final String buildRefLink(String url, String body,
String target, String style,
String css)
{
final StringBuffer refLink = new StringBuffer();
// Output the hyperlink reference
refLink.append("<A HREF=\"").append(url).append('"');
// Is a target specified?
if (TagUtility.isValidString(target))
{
// Output the HREF target
refLink.append(" TARGET=\"").append(target).append('"');
}
if (TagUtility.isValidString(css))
{
// Ouput the CSS class
refLink.append(" CLASS=\"").append(css).append('"');
}
if (TagUtility.isValidString(style))
{
// Output the CSS style
refLink.append(" STYLE=\"").append(style).append('"');
}
// Close HREF
refLink.append('>').append(body).append("</A>");
return (refLink.toString());
}
/**
* Returns the default tag misplaced (not in container) error exception.
*
* @param tag The tag name.
* @param container The container name.
* @return The default misplaced error exception.
*/
public static final JspTagException misplacedError(String tag,
String container)
{
return new JspTagException("The '" + tag
+ "' tag must be located within the '"
+ container + "' container tag.");
}
/**
* Returns the default tag misplaced (not in valid container) error
* exception.
*
* @param tag The tag name.
* @return The default misplaced error exception.
*/
public static final JspTagException misplacedError(String tag)
{
return new JspTagException("The '" + tag
+ "' tag must be located within a valid container tag.");
}
/**
* Builds name=value pair with URL encoding.
*
* @param name The name string.
* @param value The value string.
* @return The name=value pair.
*/
public static final String nameValuePair(String name, String value)
{
return (URLEncoder.encode(name) + "=" + URLEncoder.encode(value));
}
/**
* Returns a nested exception.
* <p>
* The nested exception format is as follows:
* <blockquote>
* <code>
* New Message<br>
* &lt;space>&gt;space&gt;nested exception is:&lt;space&gt;<br>
* &lt;tab&gt; java.lang.Exception: Old Message
* </code>
* </blockquote>
*
* @param msg The new exception message.
* @param old The old exception object.
* @return A nested exception.
*/
public static final JspTagException nestedException(String msg,
Exception old)
{
return new JspTagException(msg + "\n nested exception is: \n\t"
+ old.toString());
}
/**
* Returns the default tag output error exception.
*
* @param tag The tag name.
* @param e The caught exception.
* @return The default tag output error exception.
*/
public static final JspTagException outputError(String tag, Exception e)
{
StringBuffer buff =
new StringBuffer("An error occurred while processing the '" + tag
+ "' tag.");
if (e != null)
{
buff.append("\n\nException:\n");
}
if (e != null)
{
buff.append("\n nested exception is: \n\t"
+ e.getClass().getName() + ": "
+ e.getLocalizedMessage());
}
return new JspTagException(buff.toString());
}
/**
* Converts the request's parameter names/values into ampersand-delimited
* and URL-encoded name/value pairs.
*
* @param request The servlet request object.
* @param remove The parameter to be removed.
* @return The name/value pairs.
*/
public static final String requestParamsToUrl(HttpServletRequest request,
String remove)
{
final StringBuffer buff = new StringBuffer();
final Enumeration names = request.getParameterNames();
// Are there any parameters?
if (names.hasMoreElements())
{
// Loop through the parameter names
while (names.hasMoreElements())
{
// Get the next parameter name
final String name = (String)names.nextElement();
// Is it the name to be removed?
if ((remove == null) || (!remove.equals(name)))
{
// Get the parameter values
final String values[] = request.getParameterValues(name);
// Loop through the values
for (int i = 0; i < values.length; i++)
{
// Is it the very first parameter?
if (buff.length() > 0)
{
// Append an ampersand to the buffer
buff.append("&");
}
// Append the parameter name and value to the buffer
buff.append(nameValuePair(name, values[i]));
}
}
}
}
return (buff.toString());
}
}

View file

@ -0,0 +1,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Google Tag Library</TITLE>
</HEAD>
<BODY>
This package contains the core bean and utility classes.
@since 1.0
</BODY>
</HTML>

View file

@ -0,0 +1,105 @@
/*
* @(#)CachedPage.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
import net.thauvin.google.GoogleSearchBean;
import net.thauvin.google.TagUtility;
import javax.servlet.jsp.*;
/**
* A custom tag used to access and retrieve pages cached on Google.
*
* @author Erik C. Thauvin
* @created April 25, 2002
* @version $Revision$
* @since 1.0
*/
public class CachedPage extends QuerySupport
{
/**
* doEndTag method.
*
* @return EVAL_PAGE
* @exception JspException
*/
public int doEndTag()
throws JspException
{
final String query = getQuery();
if (TagUtility.isValidString(query, true))
{
try
{
final GoogleSearchBean bean = new GoogleSearchBean(getKey());
// Output the body
pageContext.getOut().write(bean.getCachedPage(query));
}
catch (Exception e)
{
throw TagUtility.outputError("cachedPage", e);
}
}
// Reset the values
reset();
return EVAL_PAGE;
}
/**
* Release method.
*/
public void release()
{
super.release();
// Reset the values
reset();
}
/**
* Reset the values.
*/
protected void reset()
{
super.reset();
}
}

View file

@ -0,0 +1,158 @@
/*
* @(#)Element.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
import net.thauvin.google.TagUtility;
import javax.servlet.jsp.*;
/**
* A custom tag used to retrieve a Google search result element.
*
* @author Erik C. Thauvin
* @created April 25, 2002
* @version $Revision$
* @since 1.0
*/
public class Element extends StyleSupport
{
private SearchResult parentTag = null;
private String name = null;
/**
* Sets the search result element name.
*
* @param name The name of the element.
*/
public final void setName(String name)
{
this.name = name;
}
/**
* doAfterBody method.
*
* @return EVAL_PAGE
* @exception JspException
*/
public int doEndTag()
throws JspException
{
if (TagUtility.isValidString(name, true))
{
try
{
String property = "";
int sep = name.indexOf('-');
if (sep != -1)
{
String url =
parentTag.getElementProperty(name.substring(sep + 1));
String body =
parentTag.getElementProperty(name.substring(0, sep));
if (body.length() == 0)
{
body = url;
}
property =
TagUtility.buildRefLink(url, body, target, style, css);
}
else
{
property = parentTag.getElementProperty(name);
}
pageContext.getOut().write(property);
}
catch (Exception e)
{
throw TagUtility.outputError("result", e);
}
}
// Reset the values
reset();
return EVAL_PAGE;
}
/**
* doStartTag method.
*
* @return SKIP_BODY.
* @exception JspTagException
*/
public int doStartTag()
throws JspTagException
{
// Find the parent tag
parentTag =
(SearchResult)findAncestorWithClass(this, SearchResult.class);
// Is it valid?
if (parentTag == null)
{
throw TagUtility.misplacedError("element", "searchResult");
}
return (SKIP_BODY);
}
/**
* Release method.
*/
public void release()
{
super.release();
// Reset the parent tag
parentTag = null;
}
/**
* Reset the values.
*/
protected void reset()
{
super.reset();
}
}

View file

@ -0,0 +1,69 @@
/*
* @(#)EndIndex.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
/**
* A custom tag used to retrieve the Google search result end index.
*
* @author Erik C. Thauvin
* @created April 26, 2002
* @version $Revision$
* @since 1.0
*/
public class EndIndex extends SearchResultSupport
{
/**
* Returns the property provided by this tag.
*
* @return The property name.
*/
protected String getPropertyName()
{
return "endIndex";
}
/**
* Returns the name of this tag.
*
* @return The tag name.
*/
protected String getTagName()
{
return "endIndex";
}
}

View file

@ -0,0 +1,70 @@
/*
* @(#)EstimatedTotal.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
/**
* A custom tag used to retrieve the estimated total results count of a Google
* search.
*
* @author Erik C. Thauvin
* @created April 26, 2002
* @version $Revision$
* @since 1.0
*/
public class EstimatedTotal extends SearchResultSupport
{
/**
* Returns the property provided by this tag.
*
* @return The property name.
*/
protected String getPropertyName()
{
return "estimatedTotalResultsCount";
}
/**
* Returns the name of this tag.
*
* @return The tag name.
*/
protected String getTagName()
{
return "estimatedTotal";
}
}

View file

@ -0,0 +1,154 @@
/*
* @(#)KeySupport.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
import net.thauvin.google.TagUtility;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
/**
* Implements support for specifying the key used for authorization in the
* Google API.
* <p>
* The key can be specified using one the following:
* <ul>
* <li>The {@link #key key} attribute.</li>
* <li>The {@link net.thauvin.google.TagUtility#KEY_PARAM key} request parameter.</li>
* <li>The {@link net.thauvin.google.TagUtility#KEY_CONTEXT_PARAM key} context
* parameter.</li>
* <li>The {@link net.thauvin.google.TagUtility#KEY_CONTEXT_PARAM key} application scope
* attribute.</li>
* </ul>
*
* @author Erik C. Thauvin
* @created April 25, 2002
* @version $Revision$
* @since 1.0
*/
public abstract class KeySupport extends BodyTagSupport
{
/**
* The key attribute.
*/
protected String key = null;
/**
* Sets the key attribute.
*
* @param key The new attribute value.
* @see #getKey
*/
public final void setKey(String key)
{
this.key = key;
}
/**
* Returns the key attribute.
*
* @return The attribute value.
* @see #setKey(String)
*/
public String getKey()
{
if (TagUtility.isValidString(key, true))
{
return key;
}
else
{
String keyParam =
TagUtility.getParameter(pageContext.getRequest(),
TagUtility.KEY_PARAM);
if (TagUtility.isValidString(keyParam, true))
{
return keyParam;
}
keyParam =
pageContext.getServletContext().getInitParameter(TagUtility.KEY_CONTEXT_PARAM);
if (TagUtility.isValidString(keyParam, true))
{
return keyParam;
}
try
{
keyParam =
(String)(pageContext.getAttribute(TagUtility.KEY_CONTEXT_PARAM,
PageContext.APPLICATION_SCOPE));
if (TagUtility.isValidString(keyParam, true))
{
return keyParam;
}
}
catch (NullPointerException e)
{
; // Do nothing
}
}
return "";
}
/**
* Release method.
*/
public void release()
{
super.release();
// Reset the key value
key = null;
// Reset the values
reset();
}
/**
* Reset the values.
*/
protected void reset()
{
//super.reset();
}
}

View file

@ -0,0 +1,71 @@
/*
* @(#)Next.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
import net.thauvin.google.GoogleSearchBean;
/**
* A custom tag used to create a link to the next Google search result set.
*
* @author Erik C. Thauvin
* @created April 26, 2002
* @version $Revision$
* @since 1.0
*/
public class Next extends SearchResultSupport
{
/**
* Returns the property provided by this tag.
*
* @return The property name.
*/
protected String getPropertyName()
{
return GoogleSearchBean.NEXT_KEYWORD;
}
/**
* Returns the name of this tag.
*
* @return The tag name.
*/
protected String getTagName()
{
return "next";
}
}

View file

@ -0,0 +1,71 @@
/*
* @(#)Previous.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
import net.thauvin.google.GoogleSearchBean;
/**
* A custom tag used to create a link to the previous Google search result set.
*
* @author Erik C. Thauvin
* @created April 26, 2002
* @version $Revision$
* @since 1.0
*/
public class Previous extends SearchResultSupport
{
/**
* Returns the property provided by this tag.
*
* @return The property name.
*/
protected String getPropertyName()
{
return GoogleSearchBean.PREVIOUS_KEYWORD;
}
/**
* Returns the name of this tag.
*
* @return The tag name.
*/
protected String getTagName()
{
return "previous";
}
}

View file

@ -0,0 +1,99 @@
/*
* @(#)QuerySupport.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
import net.thauvin.google.TagUtility;
/**
* Implements supports for specifying the Google query string.
* <p>
* The query can be specified using one the following:
* <ul>
* <li>The {@link net.thauvin.google.TagUtility#QUERY_PARAM query} request parameter.</li>
* <li>Directly within the body of the tag.</li>
* </ul>
*
* @author Erik C. Thauvin
* @created April 29, 2002
* @version $Revision$
* @since 1.0
*/
public abstract class QuerySupport extends KeySupport
{
/**
* Release method.
*/
public void release()
{
super.release();
}
/**
* Returns the specified query.
*
* @return The query value.
*/
protected final String getQuery()
{
String query =
TagUtility.getParameter(pageContext.getRequest(),
TagUtility.QUERY_PARAM);
if (TagUtility.isValidString(query, true))
{
return query;
}
query = TagUtility.getTagBody(bodyContent, true);
if (TagUtility.isValidString(query, true))
{
return query;
}
return "";
}
/**
* Reset the values.
*/
protected void reset()
{
super.reset();
}
}

View file

@ -0,0 +1,428 @@
/*
* @(#)Search.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
import net.thauvin.google.GoogleSearchBean;
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$
* @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 filter = GoogleSearchBean.DEFAULT_FILTER;
private boolean safeSearch = GoogleSearchBean.DEFAULT_SAFE_SEARCH;
private int maxResults = GoogleSearchBean.DEFAULT_MAX_RESULTS;
private int start = GoogleSearchBean.DEFAULT_START;
/**
* 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)
{
try
{
this.maxResults = Integer.valueOf(maxResults).intValue();
}
catch (NumberFormatException e)
{
; // 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)
{
this.site = site;
}
/**
* Returns the stie attribute.
*
* @return The attribute value.
* @see #setSite(String)
*/
public final String getSite()
{
String site = getStringParam(TagUtility.SITE_PARAM, this.site);
if (site.length() > 0)
{
return ("site:" + site + ' ');
}
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()
{
return getIntParam(TagUtility.START_PARAM, start);
}
/**
* doEndTag method.
*
* @return EVAL_PAGE
* @exception JspException
*/
public int doEndTag()
throws JspException
{
final String query = getQuery();
if (TagUtility.isValidString(query, true))
{
try
{
bean.getGoogleSearch(getKey(), getSite() + getQuery(),
getStart(), getMaxResults(), getFilter(),
getRestrict(), getSafeSearch(), getLr());
}
catch (Exception e)
{
throw TagUtility.outputError("search", e);
}
}
else if (!getCache())
{
bean.reset();
}
// Reset the values
reset();
return EVAL_PAGE;
}
/**
* doStartTag method.
*
* @return EVAL_BODY_TAG.
* @exception JspException
*/
public int doStartTag()
throws JspException
{
// Get the Google bean
bean = TagUtility.getGoogleSearchBean(pageContext);
// Create a new bean if it doesn't exists
if (bean == null)
{
try
{
bean = new GoogleSearchBean();
// Set the bean as named session attribute
pageContext.setAttribute(TagUtility.GOOGLE_SEARCH_BEAN, bean,
PageContext.SESSION_SCOPE);
}
catch (Exception e)
{
throw new JspException("An unknown error ocurred while creating the Google search bean.");
}
}
return EVAL_BODY_TAG;
}
/**
* Release method.
*/
public void release()
{
super.release();
// Reset all attributes
start = GoogleSearchBean.DEFAULT_START;
maxResults = GoogleSearchBean.DEFAULT_MAX_RESULTS;
filter = GoogleSearchBean.DEFAULT_FILTER;
safeSearch = GoogleSearchBean.DEFAULT_SAFE_SEARCH;
restrict = GoogleSearchBean.DEFAULT_RESTRICT;
lr = GoogleSearchBean.DEFAULT_LR;
site = GoogleSearchBean.DEFAULT_SITE;
cache = true;
// Reset the bean
bean = null;
// Reset the values
reset();
}
/**
* Reset the values.
*/
protected void reset()
{
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;
}
}

View file

@ -0,0 +1,69 @@
/*
* @(#)SearchComments.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
/**
* A custom tag used to retrieve the Google search comments message.
*
* @author Erik C. Thauvin
* @created April 26, 2002
* @version $Revision$
* @since 1.0
*/
public class SearchComments extends SearchResultSupport
{
/**
* Returns the property provided by this tag.
*
* @return The property name.
*/
protected String getPropertyName()
{
return "searchComments";
}
/**
* Returns the name of this tag.
*
* @return The tag name.
*/
protected String getTagName()
{
return "searchComments";
}
}

View file

@ -0,0 +1,69 @@
/*
* @(#)SearchQuery.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
/**
* A custom tag used to retrieve the query string of a Google search.
*
* @author Erik C. Thauvin
* @created April 29, 2002
* @version $Revision$
* @since 1.0
*/
public class SearchQuery extends SearchResultSupport
{
/**
* Returns the property provided by this tag.
*
* @return The property name.
*/
protected String getPropertyName()
{
return "searchQuery";
}
/**
* Returns the name of this tag.
*
* @return The tag name.
*/
protected String getTagName()
{
return "searchQuery";
}
}

View file

@ -0,0 +1,191 @@
/*
* @(#)SearchResult.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
import net.thauvin.google.GoogleSearchBean;
import net.thauvin.google.TagUtility;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
/**
* A custom tag used to parse and loop through Google search results.
*
* @author Erik C. Thauvin
* @created April 25, 2002
* @version $Revision$
* @since 1.0
*/
public class SearchResult extends BodyTagSupport
{
private GoogleSearchBean bean = null;
private StringBuffer output = null;
private int loopCount = 0;
/**
* doAfterBody method.
*
* @return EVAL_BODY_TAG or SKIP_BODY.
* @exception JspTagException
*/
public int doAfterBody()
throws JspTagException
{
// Get the body content
final String body = bodyContent.getString();
// Append the body to the ouput
output.append(body);
try
{
// Clear the body content
bodyContent.clear();
}
catch (java.io.IOException e)
{
throw TagUtility.nestedException("An error occurred while clearing the content of the 'searchResult' tag.",
e);
}
// Increment the loop count, if there are more elements
if (++loopCount < bean.getResultElementsCount())
{
return EVAL_BODY_TAG;
}
return SKIP_BODY;
}
/**
* doEndTag method.
*
* @return EVAL_PAGE.
* @exception JspTagException
*/
public int doEndTag()
throws JspTagException
{
// Is there anything to ouput?
if (output.length() > 0)
{
try
{
// Write the output into the tag body
bodyContent.getEnclosingWriter().write(output.toString());
}
catch (java.io.IOException e)
{
throw TagUtility.outputError("searchResult", e);
}
}
// Reset the values
reset();
return EVAL_PAGE;
}
/**
* doStartTag method.
*
* @return EVAL_BODY_TAG.
* @exception JspException
*/
public int doStartTag()
throws JspException
{
output = new StringBuffer();
// Reset the loopCount
loopCount = 0;
// Get the Google bean
bean = TagUtility.getGoogleSearchBean(pageContext);
// Are there any elements?
if ((bean != null) && (bean.getResultElementsCount() > 0))
{
return EVAL_BODY_TAG;
}
return SKIP_BODY;
}
/**
* Release method.
*/
public void release()
{
super.release();
// Reset the bean
bean = null;
// Reset the output
output = null;
// Reset the values
reset();
}
/**
* Returns the current search result element specified property.
*
* @param name The property name.
* @return The property value.
*/
protected String getElementProperty(String name)
{
if (bean != null)
{
return bean.getResultElementProperty(loopCount, name);
}
return "";
}
/**
* Reset the values.
*/
protected void reset()
{
// Reset the loop count value
loopCount = 0;
}
}

View file

@ -0,0 +1,188 @@
/*
* @(#)SearchResultSupport.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
import net.thauvin.google.GoogleSearchBean;
import net.thauvin.google.TagUtility;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpUtils;
import javax.servlet.jsp.JspException;
/**
* Implements methods used to retrieve Google Search Result properties.
*
* @author Erik C. Thauvin
* @created April 26, 2002
* @version $Revision$
* @since 1.0
*/
public abstract class SearchResultSupport extends StyleSupport
{
/**
* The Google search bean.
*/
protected GoogleSearchBean bean = null;
/**
* doEndTag method.
*
* @return EVAL_PAGE
* @exception JspException
*/
public int doEndTag()
throws JspException
{
try
{
// Is the result valid?
if ((bean != null) && (bean.isValidResult()))
{
// Output the property
pageContext.getOut().write(getResultProperty());
}
}
catch (Exception e)
{
throw TagUtility.outputError(getTagName(), e);
}
// Reset the values
reset();
return EVAL_PAGE;
}
/**
* doStartTag method.
*
* @return EVAL_BODY_TAG or SKIP_BODY.
* @exception JspException
*/
public int doStartTag()
throws JspException
{
// Get the Google bean
bean = TagUtility.getGoogleSearchBean(pageContext);
// Is the result valid?
if ((bean != null) && (bean.isValidResult()))
{
return EVAL_BODY_TAG;
}
return SKIP_BODY;
}
/**
* Release method.
*/
public void release()
{
super.release();
// Reset the bean
bean = null;
// Reset the values
reset();
}
/**
* Returns the result of the build action and must be implemented by classes
* which extend SearchResultSupport.
* <p>
* For example:
* <p>
* <blockquote>return "Some Value";</blockquote>
*
* @return The property name.
*/
protected abstract String getPropertyName();
/**
* Returns the value of specified search result property.
*
* @return The property value.
*/
protected String getResultProperty()
{
String name = getPropertyName();
String value = bean.getResultProperty(name);
if ((TagUtility.isValidString(value))
&& (name.equals(GoogleSearchBean.NEXT_KEYWORD)
|| name.equals(GoogleSearchBean.PREVIOUS_KEYWORD)))
{
HttpServletRequest request =
(HttpServletRequest)pageContext.getRequest();
String url =
HttpUtils.getRequestURL(request).toString() + '?'
+ TagUtility.START_PARAM + '=' + value + '&'
+ TagUtility.requestParamsToUrl(request, TagUtility.START_PARAM);
return (TagUtility.buildRefLink(url,
TagUtility.getTagBody(bodyContent),
target, style, css));
}
else
{
return value;
}
}
/**
* Returns the name of the tag extending SearchResultSupport.
* <p>
* For example:
* <p>
* <blockquote> void getErrorString() { return "MyTag"; }</blockquote>
*
* @return The tag name.
*/
protected abstract String getTagName();
/**
* Reset the values.
*/
protected void reset()
{
super.reset();
}
}

View file

@ -0,0 +1,69 @@
/*
* @(#)SearchTime.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
/**
* A custom tag used to retrieve the elapsed time of a Google search.
*
* @author Erik C. Thauvin
* @created April 26, 2002
* @version $Revision$
* @since 1.0
*/
public class SearchTime extends SearchResultSupport
{
/**
* Returns the property provided by this tag.
*
* @return The property name.
*/
protected String getPropertyName()
{
return "searchTime";
}
/**
* Returns the name of this tag.
*
* @return The tag name.
*/
protected String getTagName()
{
return "searchTime";
}
}

View file

@ -0,0 +1,69 @@
/*
* @(#)SearchTips.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
/**
* A custom tag used to retrieve the Google search tips message.
*
* @author Erik C. Thauvin
* @created April 26, 2002
* @version $Revision$
* @since 1.0
*/
public class SearchTips extends SearchResultSupport
{
/**
* Returns the property provided by this tag.
*
* @return The property name.
*/
protected String getPropertyName()
{
return "searchTips";
}
/**
* Returns the name of this tag.
*
* @return The tag name.
*/
protected String getTagName()
{
return "searchTips";
}
}

View file

@ -0,0 +1,112 @@
/*
* @(#)Spelling.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
import net.thauvin.google.GoogleSearchBean;
import net.thauvin.google.TagUtility;
import javax.servlet.jsp.JspException;
/**
* A custom tag used to access and retrieve Google spelling suggestions.
*
* @author Erik C. Thauvin
* @created April 25, 2002
* @version $Revision$
* @since 1.0
*/
public class Spelling extends QuerySupport
{
/**
* doEndTag method.
*
* @return EVAL_PAGE
* @exception JspException
*/
public int doEndTag()
throws JspException
{
final String query = getQuery();
if (TagUtility.isValidString(query, true))
{
try
{
final GoogleSearchBean bean = new GoogleSearchBean(getKey());
String result = bean.getSpellingSuggestion(query);
if (!TagUtility.isValidString(result, true))
{
result = query;
}
// Output the spelling suggestion
pageContext.getOut().write(result);
}
catch (Exception e)
{
throw TagUtility.outputError("Spelling", e);
}
}
// Reset the values
reset();
return EVAL_PAGE;
}
/**
* Release method.
*/
public void release()
{
super.release();
// Reset the values
reset();
}
/**
* Reset the values.
*/
protected void reset()
{
super.reset();
}
}

View file

@ -0,0 +1,69 @@
/*
* @(#)StartIndex.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
/**
* A custom tag used to retrieve the Google search result start index.
*
* @author Erik C. Thauvin
* @created April 26, 2002
* @version $Revision$
* @since 1.0
*/
public class StartIndex extends SearchResultSupport
{
/**
* Returns the property provided by this tag.
*
* @return The property name.
*/
protected String getPropertyName()
{
return "startIndex";
}
/**
* Returns the name of this tag.
*
* @return The tag name.
*/
protected String getTagName()
{
return "startIndex";
}
}

View file

@ -0,0 +1,116 @@
/*
* @(#)StyleSupport.java
*
* Copyright (c) 2002-2003, 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 net.thauvin.google.taglibs;
import javax.servlet.jsp.tagext.BodyTagSupport;
/**
* Implements support for the style, target and css tag attributes.
*
* @author Erik C. Thauvin
* @created Sep 4, 2003
* @version $Revision$
* @since 1.0
*/
public abstract class StyleSupport extends BodyTagSupport
{
/**
* The css attribute.
*/
protected String css = null;
/**
* The style attribute.
*/
protected String style = null;
/**
* The target attribute.
*/
protected String target = null;
/**
* Sets the css attribute.
*
* @param css The new attribute value.
*/
public final void setCss(String css)
{
this.css = css;
}
/**
* Sets the style attribute.
*
* @param style The new attribute value.
*/
public final void setStyle(String style)
{
this.style = style;
}
/**
* Sets the target attribute.
*
* @param target The new attribute value.
*/
public final void setTarget(String target)
{
this.target = target;
}
/**
* Release method.
*/
public void release()
{
super.release();
// Reset the values
reset();
}
/**
* Reset the values.
*/
protected void reset()
{
// Reset the target, style and css
target = style = css = null;
}
}

View file

@ -0,0 +1,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Google Tag Library</TITLE>
</HEAD>
<BODY>
This package contains the custom tag libraries.
@since 1.0
</BODY>
</HTML>

View file

@ -0,0 +1,215 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<!-- Tag library descriptor -->
<taglib>
<!-- The version number of this tag library -->
<tlibversion>@version@</tlibversion>
<!-- The JSP specification version required to function -->
<jspversion>1.1</jspversion>
<!-- The short name of this tag library -->
<shortname>google</shortname>
<!-- Public URI that uniquely identifies this version of the tag library -->
<uri>http://www.thauvin.net/taglibs/google-taglib-@version@</uri>
<!-- General information about this tag library -->
<info>
The Google Tag Library.
</info>
<!-- CachedPage Tag -->
<tag>
<name>cachedPage</name>
<tagclass>net.thauvin.google.taglibs.CachedPage</tagclass>
<bodycontent>JSP</bodycontent>
<info>Displays a page cached by Google.</info>
<attribute>
<name>key</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<!-- Element Tag -->
<tag>
<name>element</name>
<tagclass>net.thauvin.google.taglibs.Element</tagclass>
<bodycontent>empty</bodycontent>
<info>Displays the given property of the current search result element.</info>
<attribute>
<name>css</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>style</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>target</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<!-- EndIndex Tag -->
<tag>
<name>endIndex</name>
<tagclass>net.thauvin.google.taglibs.EndIndex</tagclass>
<bodycontent>empty</bodycontent>
<info>Displays the current search result end index.</info>
</tag>
<!-- EstimatedTotal Tag -->
<tag>
<name>estimatedTotal</name>
<tagclass>net.thauvin.google.taglibs.EstimatedTotal</tagclass>
<bodycontent>empty</bodycontent>
<info>Displays the estimated total results count of the current search.</info>
</tag>
<!-- Next Tag -->
<tag>
<name>next</name>
<tagclass>net.thauvin.google.taglibs.Next</tagclass>
<bodycontent>JSP</bodycontent>
<info>Displays a link to the next search result set.</info>
<attribute>
<name>css</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>style</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>target</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<!-- Previous Tag -->
<tag>
<name>previous</name>
<tagclass>net.thauvin.google.taglibs.Previous</tagclass>
<bodycontent>JSP</bodycontent>
<info>Displays a link to the previous search result set.</info>
<attribute>
<name>css</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>style</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>target</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<!-- Search Tag -->
<tag>
<name>search</name>
<tagclass>net.thauvin.google.taglibs.Search</tagclass>
<bodycontent>JSP</bodycontent>
<info>Performs a Google search.</info>
<attribute>
<name>cache</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>filter</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>key</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>lr</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>maxResults</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>safeSearch</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>site</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>start</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<!-- SearchComments Tag -->
<tag>
<name>searchComments</name>
<tagclass>net.thauvin.google.taglibs.SearchComments</tagclass>
<bodycontent>empty</bodycontent>
<info>Displays the current search comments.</info>
</tag>
<!-- SearchQuery Tag -->
<tag>
<name>searchQuery</name>
<tagclass>net.thauvin.google.taglibs.SearchQuery</tagclass>
<bodycontent>empty</bodycontent>
<info>Displays the current search query.</info>
</tag>
<!-- SearchResult Tag -->
<tag>
<name>searchResult</name>
<tagclass>net.thauvin.google.taglibs.SearchResult</tagclass>
<bodycontent>JSP</bodycontent>
<info>Loops through the current search results</info>
</tag>
<!-- SearchTime Tag -->
<tag>
<name>searchTime</name>
<tagclass>net.thauvin.google.taglibs.SearchTime</tagclass>
<bodycontent>empty</bodycontent>
<info>Displays the elapsed time of the current search.</info>
</tag>
<!-- SearchTips Tag -->
<tag>
<name>searchTips</name>
<tagclass>net.thauvin.google.taglibs.SearchTips</tagclass>
<bodycontent>empty</bodycontent>
<info>Displays the search tips of the current search.</info>
</tag>
<!-- Spelling Tag -->
<tag>
<name>spelling</name>
<tagclass>net.thauvin.google.taglibs.Spelling</tagclass>
<bodycontent>JSP</bodycontent>
<info>Performs a Google spelling suggestion.</info>
<attribute>
<name>key</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<!-- StartIndex Tag -->
<tag>
<name>startIndex</name>
<tagclass>net.thauvin.google.taglibs.StartIndex</tagclass>
<bodycontent>empty</bodycontent>
<info>Displays the current search result start index.</info>
</tag>
</taglib>