org.cdlib.xtf.zing
Class SRU

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

public class SRU
extends CrossQuery

The SRU servlet coordinates the process of parsing a URL query, activating the textEngine to find all occurrences, and finally formatting the results.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class CrossQuery
config, decimalFormat
 
Fields inherited from class TextServlet
stylesheetCache
 
Constructor Summary
SRU()
           
 
Method Summary
protected  void apply(AttribList attribs, HttpServletRequest req, HttpServletResponse res)
          Creates the query request, processes it, and formats the results.
private  boolean directOutput(EasyNode node, String name, HttpServletResponse res)
          Scans the node and its descendants for an SRW 'explainResponse' or 'diagnostics'.
 TextConfig getConfig()
          Retrieves the current configuration information (that was read in by readConfig()).
 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)
          Loads the specific configuration file for crossQuery.
protected  boolean shuntQueryReq(HttpServletRequest req, HttpServletResponse res, Source queryReqDoc)
          Called right after the raw query request has been generated, but before it is parsed.
protected  String stepSetup(HttpServletRequest req, HttpServletResponse res)
          Add additional stuff to the usual debug step mode
 
Methods inherited from class CrossQuery
doGet, formatHits, runQueryParser, runQueryRouter
 
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

SRU

public SRU()
Method Detail

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

readConfig

protected TextConfig readConfig(String configPath)
Description copied from class: CrossQuery
Loads the specific configuration file for crossQuery.

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

getConfig

public TextConfig getConfig()
Description copied from class: CrossQuery
Retrieves the current configuration information (that was read in by readConfig()).

Overrides:
getConfig in class CrossQuery

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(AttribList attribs,
                     HttpServletRequest req,
                     HttpServletResponse res)
              throws Exception
Description copied from class: CrossQuery
Creates the query request, processes it, and formats the results.

Overrides:
apply in class CrossQuery
Parameters:
attribs - Attributes to pass to the stylesheets.
req - The original HTTP request
res - Where to send the response
Throws:
Exception - Passes on various errors that might occur.

shuntQueryReq

protected boolean shuntQueryReq(HttpServletRequest req,
                                HttpServletResponse res,
                                Source queryReqDoc)
                         throws IOException
Called right after the raw query request has been generated, but before it is parsed. Gives us a chance to stop processing here in if SRW diagnostics should be output instead of running a query.

Overrides:
shuntQueryReq in class CrossQuery
Throws:
IOException

stepSetup

protected String stepSetup(HttpServletRequest req,
                           HttpServletResponse res)
                    throws IOException
Add additional stuff to the usual debug step mode

Overrides:
stepSetup in class CrossQuery
Parameters:
req - The HTTP request (in)
res - The HTTP response (out)
Returns:
A string to output if in step setup phase, null to do normal processing
Throws:
IOException

directOutput

private boolean directOutput(EasyNode node,
                             String name,
                             HttpServletResponse res)
                      throws IOException
Scans the node and its descendants for an SRW 'explainResponse' or 'diagnostics'. If found, it is output directly.

Parameters:
node - Node to scan
name - Name to scan for
Returns:
true if direct output was made
Throws:
IOException