org.cdlib.xtf.crossQuery.raw
Class RawQuery

Object
  extended by GenericServlet
      extended by HttpServlet
          extended by TextServlet
              extended by CrossQuery
                  extended by RawQuery
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class RawQuery
extends CrossQuery

Derived version of the crossQuery servlet, used to provide a "web service" interface to XTF. Takes an HTTP post containing a single XTF query in XML, parses the request, executes the query, and returns raw XML-formatted results.

Author:
Martin Haye
See Also:
Serialized Form

Nested Class Summary
private  class RawQuery.RawQueryConfig
           
 
Field Summary
 
Fields inherited from class CrossQuery
config, decimalFormat
 
Fields inherited from class TextServlet
stylesheetCache
 
Constructor Summary
RawQuery()
           
 
Method Summary
protected  void apply(HttpServletRequest req, HttpServletResponse res)
          Creates the query request, processes it, and formats the results.
 void doGet(HttpServletRequest req, HttpServletResponse res)
          Handles the HTTP 'get' and 'put' methods.
 String getConfigName()
          Called by the superclass to find out the name of our specific config file.
 String getServletInfo()
          Informational method required by Servlet interface.
protected  TextConfig readConfig(String configPath)
          We're keeping this servlet intentionally very simple -- so no config file.
 
Methods inherited from class CrossQuery
apply, formatHits, getConfig, runQueryParser, runQueryRouter, shuntQueryReq, stepSetup
 
Methods inherited from class TextServlet
addParam, addToken, addTokens, buildParamBlock, calcMimeType, convertUTF8inURL, cqlTokenize, createFilteredReceiver, createQueryProcessor, decodeURL, defaultTokenize, doPost, genErrorPage, getCurRequest, getCurResponse, getCurServlet, getRealPath, getRequestURL, getText, isEmpty, isSessionTrackingEnabled, makeAttribList, makeHtmlString, makeHtmlString, rawTokenize, readBranding, requireOrElse, restoreWildcards, saveWildcards, service, setErrorGenSheet, stuffAttribs, stuffAttribs, stuffSpecialAttribs
 
Methods inherited from class HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
 
Methods inherited from class GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawQuery

public RawQuery()
Method Detail

readConfig

protected TextConfig readConfig(String configPath)
We're keeping this servlet intentionally very simple -- so no config file.

Overrides:
readConfig in class CrossQuery
Parameters:
configPath - Path to the configuration file
Returns:
Parsed config information

getConfigName

public String getConfigName()
Description copied from class: CrossQuery
Called by the superclass to find out the name of our specific config file.

Overrides:
getConfigName in class CrossQuery

doGet

public void doGet(HttpServletRequest req,
                  HttpServletResponse res)
           throws IOException
Handles the HTTP 'get' and 'put' methods. Initializes the servlet if nececssary, then parses the HTTP request and processes it appropriately.

Overrides:
doGet in class CrossQuery
Parameters:
req - The HTTP request (in)
res - The HTTP response (out)
Throws:
IOException - If unable to read an index or data file, or if unable to write the output stream.

getServletInfo

public String getServletInfo()
Description copied from class: CrossQuery
Informational method required by Servlet interface. Doesn't seem to matter what it says.

Specified by:
getServletInfo in interface Servlet
Overrides:
getServletInfo in class CrossQuery
Returns:
A string describing this servlet.

apply

protected void apply(HttpServletRequest req,
                     HttpServletResponse res)
              throws Exception
Creates the query request, processes it, and formats the results.

Parameters:
req - The original HTTP request
res - Where to send the response
Throws:
Exception - Passes on various errors that might occur.