Class CoolSearch

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--CoolSearch
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class CoolSearch
extends javax.servlet.http.HttpServlet

The servlet class. The manager.html will post to this servlet and the search.html will get from this servlet so that we can distinguish between two request.

See Also:
Serialized Form

Field Summary
private static WebIndex w
          The Index that store keywords-pages.
 
Fields inherited from class javax.servlet.http.HttpServlet
 
Fields inherited from class javax.servlet.GenericServlet
 
Constructor Summary
CoolSearch()
           
 
Method Summary
private  void clearup()
          clear up the web index
private  void crawl(int numCrawl, java.lang.String url, WebIndex w, java.lang.String filename)
          Crawl the web!!
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          the get method that response to the search.html
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          the post method that response to manager.html
private  void restore(java.lang.String filename)
          restore the webindex from file
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

w

private static WebIndex w
The Index that store keywords-pages. The static ensure that all user can access to the same webindex.

Constructor Detail

CoolSearch

public CoolSearch()
Method Detail

doPost

protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException,
                      java.io.IOException
the post method that response to manager.html

Overrides:
doPost in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
java.io.IOException

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     java.io.IOException
the get method that response to the search.html

Overrides:
doGet in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
java.io.IOException

crawl

private void crawl(int numCrawl,
                   java.lang.String url,
                   WebIndex w,
                   java.lang.String filename)
            throws java.lang.Exception
Crawl the web!!

java.lang.Exception

restore

private void restore(java.lang.String filename)
              throws java.io.IOException
restore the webindex from file

java.io.IOException

clearup

private void clearup()
clear up the web index