org.cdlib.xtf.crossQuery.test
Class TestableCrossQuery
Object
GenericServlet
HttpServlet
TextServlet
CrossQuery
TestableCrossQuery
- All Implemented Interfaces:
- Serializable, Servlet, ServletConfig
public class TestableCrossQuery
- extends CrossQuery
Derived version of the crossQuery servlet, used to abuse crossQuery during
load tests. The main difference is that it throws exceptions upward instead
of formatting an error page. This ensures that exceptions don't get hidden
in the noise.
Also, for each thread we track the number of hits returned by the last
request.
- Author:
- Martin Haye
- See Also:
- Serialized Form
Field Summary |
private ThreadLocal<Integer> |
nHits
|
Method Summary |
protected void |
formatHits(String mainTagName,
HttpServletRequest req,
HttpServletResponse res,
AttribList attribs,
QueryRequest queryRequest,
QueryResult queryResult,
long startTime)
Formats a list of hits using the resultFormatter stylesheet. |
protected void |
genErrorPage(HttpServletRequest req,
HttpServletResponse res,
Exception exc)
Generate an error page based on the given exception. |
int |
nHits()
Return the number of hits in the last request processed by this thread |
Methods inherited from class TextServlet |
addParam, addToken, addTokens, buildParamBlock, calcMimeType, convertUTF8inURL, cqlTokenize, createFilteredReceiver, createQueryProcessor, decodeURL, defaultTokenize, doPost, 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 |
nHits
private ThreadLocal<Integer> nHits
TestableCrossQuery
public TestableCrossQuery()
nHits
public int nHits()
- Return the number of hits in the last request processed by this thread
formatHits
protected void formatHits(String mainTagName,
HttpServletRequest req,
HttpServletResponse res,
AttribList attribs,
QueryRequest queryRequest,
QueryResult queryResult,
long startTime)
throws Exception
- Description copied from class:
CrossQuery
- Formats a list of hits using the resultFormatter stylesheet.
- Overrides:
formatHits
in class CrossQuery
- Parameters:
mainTagName
- Name of the top-level tag to generate (e.g.
"crossQueryResult", etc.)req
- The original HTTP requestres
- Where to send the HTML responseattribs
- Parameters to pass to the stylesheetqueryRequest
- Query request that produced the hitsqueryResult
- Hits resulting from the query requeststartTime
- Time (in milliseconds) request began
- Throws:
Exception
genErrorPage
protected void genErrorPage(HttpServletRequest req,
HttpServletResponse res,
Exception exc)
- Description copied from class:
TextServlet
- Generate an error page based on the given exception. Utilizes the system
error stylesheet to produce a nicely formatted HTML page.
- Overrides:
genErrorPage
in class TextServlet
- Parameters:
req
- The HTTP request we're responding tores
- The HTTP result to write toexc
- The exception producing the error. If it's a
DynaXMLException, the attributes will be passed to
the error stylesheet.