Open Search Servlet – build open search configuration on the fly

Here is open search specification – http://www.opensearch.org/Specifications/OpenSearch/1.1

Let’s enable your browser to detect your search engine automatically; using open search servlet you can generate open search configuration file on the fly.

Download information is here –

Binary library

Source maven project

Binary war file (includes example usages)

Usages:

  1. Copy “open-search-x.jar” file on your WEB-INF/lib/ directory
  2. Edit web.xml file.
  3. add these entries –
< servlet >
    < servlet-name >openSearch< /servlet-name >
    < servlet-class >com.we4tech.openSearch.servlet.OpenSearchServlet< /servlet-class >
    < !-- URL matching pattern -- >
    < init-param >
      < param-name >url-match< /param-name >
      < param-value >.*/(.+).osd< /param-value >
      < !--< param-value >.*/search/(.+)< /param-value >-- >
    < /init-param >
    < !-- map open search configuration with url -- >
    < init-param >
      < param-name >open-search< /param-name >
      < param-value >open-search.properties< /param-value >
    < /init-param >
    < init-param >
      < param-name >somewherein-blog< /param-name >
      < param-value >somewherein-blog.properties< /param-value >
    < /init-param >
  < /servlet >

  < servlet-mapping >
    < servlet-name >openSearch< /servlet-name >
    < !--< url-pattern >/search/*< /url-pattern >-- >
    < url-pattern >*.osd< /url-pattern >
  < /servlet-mapping >
  1. Now place configuration properties file with in your WEB-INF/classes/
  2. for example: “open-search.properties”
# Default open-search. properties
shortName=colorful moment.
description=somewhere in blog
contact=hasan@somewherein.net

url.1=text/html,get,http://www.somewherein.net/blog/index.php?s={searchTerms}&submit=
image.1=16,16,image/x-icon,http://www.searchmash.com/favicon.ico
  1. Congratulations you have completed all steps 😉

Sample usages on your web site can be found here –

http://www.opensearch.org/Specifications/OpenSearch/1.1#Autodiscovery_in_HTML.2FXHTML

Best wishes,

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

my tweets

May 2007
S S M T W T F
« Apr   Jun »
 1234
567891011
12131415161718
19202122232425
262728293031  

Flickr Photos

RSS my shared links on google reader

  • An error has occurred; the feed is probably down. Try again later.
%d bloggers like this: