|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectGenericServlet
HttpServlet
TextServlet
CrossQuery
TestableCrossQuery
public class TestableCrossQuery
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.
Field Summary | |
---|---|
private String |
baseDir
|
private String |
indexDirOverride
|
private IndexWarmer |
indexWarmer
|
private ThreadLocal<Integer> |
nHits
|
Fields inherited from class CrossQuery |
---|
config, decimalFormat, profListener |
Fields inherited from class TextServlet |
---|
stylesheetCache |
Constructor Summary | |
---|---|
TestableCrossQuery(String baseDir)
Simplified initialization for use outside a real servlet container. |
Method Summary | |
---|---|
QueryProcessor |
createQueryProcessor()
For test mode, allow override of index warmer. |
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 |
void |
overrideIndexDir(String dir)
Allows overriding the directory specified in future query requests. |
protected QueryRequest |
runQueryParser(HttpServletRequest req,
HttpServletResponse res,
QueryRoute route,
AttribList attribs)
Allow overriding the index directory |
void |
service(String url)
Simplified method to test-get the given URL. |
void |
setIndexWarmer(IndexWarmer warmer)
Allows overriding default index warmer. |
protected void |
setupTrace(TextConfig config)
For test mode, do nothing to the current trace flags. |
Methods inherited from class CrossQuery |
---|
apply, doGet, getConfig, getConfigName, getServletInfo, readConfig, runQueryRouter, shuntQueryReq, stepSetup |
Methods inherited from class HttpServlet |
---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service |
Methods inherited from class GenericServlet |
---|
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 |
Field Detail |
---|
private String baseDir
private String indexDirOverride
private IndexWarmer indexWarmer
private ThreadLocal<Integer> nHits
Constructor Detail |
---|
public TestableCrossQuery(String baseDir) throws ServletException
baseDir
- the XTF home directory.
ServletException
- if anything goes wrong.Method Detail |
---|
public void overrideIndexDir(String dir)
public void setIndexWarmer(IndexWarmer warmer)
public int nHits()
protected void setupTrace(TextConfig config)
setupTrace
in class TextServlet
protected QueryRequest runQueryParser(HttpServletRequest req, HttpServletResponse res, QueryRoute route, AttribList attribs) throws Exception
runQueryParser
in class CrossQuery
req
- The original HTTP requestres
- The HTTP response (used for step mode only)route
- Route to the query parserattribs
- Attributes to pass to the stylesheet.
Exception
public QueryProcessor createQueryProcessor()
createQueryProcessor
in class TextServlet
public void service(String url) throws ServletException, IOException
url
- the URL to test-get
ServletException
IOException
protected void formatHits(String mainTagName, HttpServletRequest req, HttpServletResponse res, AttribList attribs, QueryRequest queryRequest, QueryResult queryResult, long startTime) throws Exception
CrossQuery
formatHits
in class CrossQuery
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
Exception
protected void genErrorPage(HttpServletRequest req, HttpServletResponse res, Exception exc)
TextServlet
genErrorPage
in class TextServlet
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |