public class TestableDynaXML extends DynaXML
Modifier and Type | Field and Description |
---|---|
private String |
baseDir |
private String |
indexDirOverride |
private IndexWarmer |
indexWarmer |
private ThreadLocal<Integer> |
nHits |
stylesheetCache
Constructor and Description |
---|
TestableDynaXML(String baseDir)
Simplified initialization for use outside a real servlet container.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
authenticate(DocRequest docReq,
HttpServletRequest req,
HttpServletResponse res)
Performs user authentication for a request, given the authentication
info for the document.
|
DocLocator |
createDocLocator()
Create a DocLocator.
|
QueryProcessor |
createQueryProcessor()
For test mode, allow override of index warmer.
|
protected void |
genErrorPage(HttpServletRequest req,
HttpServletResponse res,
Exception exc)
Would normally generate an error page.
|
protected Source |
getSourceDoc(DocRequest docReq,
Transformer transformer)
Perform the normal dynaXML getSourceDoc() operation, then record the
resulting number of hits (if any) that came out.
|
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 DocRequest |
runDocReqParser(HttpServletRequest req,
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.
|
doGet, getConfig, getConfigName, getServletInfo, readConfig, setProfiling
addParam, addToken, addTokens, buildParamBlock, calcMimeType, convertUTF8inURL, cqlTokenize, createFilteredReceiver, decodeURL, defaultTokenize, destroy, doPost, getCurRequest, getCurResponse, getCurServlet, getRealPath, getRequestURL, getRequestURL, getText, isEmpty, isSessionTrackingEnabled, makeAttribList, makeHtmlString, makeHtmlString, rawTokenize, readBranding, requireOrElse, restoreWildcards, saveWildcards, service, setErrorGenSheet, stuffAttribs, stuffAttribs, stuffSpecialAttribs
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
private String baseDir
private String indexDirOverride
private IndexWarmer indexWarmer
private ThreadLocal<Integer> nHits
public TestableDynaXML(String baseDir) throws ServletException
baseDir
- the XTF home directory.ServletException
- if anything goes wrong.public void overrideIndexDir(String dir)
public void setIndexWarmer(IndexWarmer warmer)
public int nHits()
protected void setupTrace(TextConfig config)
setupTrace
in class TextServlet
protected DocRequest runDocReqParser(HttpServletRequest req, AttribList attribs) throws Exception
runDocReqParser
in class DynaXML
req
- The original HTTP requestattribs
- 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-getServletException
IOException
protected Source getSourceDoc(DocRequest docReq, Transformer transformer) throws InvalidDocumentException, IOException, SAXException, ParserConfigurationException
getSourceDoc
in class DynaXML
docReq
- Tells which document to load, the query to
apply, tec.transformer
- The XSLT transformer that will be used on the
document.IOException
- If a problem is encountered loading a file or URLSAXException
- If the document cannot be parsed as valid XMLParserConfigurationException
- Miscellaneous configuration
problemsInvalidDocumentException
protected boolean authenticate(DocRequest docReq, HttpServletRequest req, HttpServletResponse res) throws Exception
authenticate
in class DynaXML
docReq
- Info structure containing authentication parametersreq
- The request being processedres
- Where to send results if authentication failsException
protected void genErrorPage(HttpServletRequest req, HttpServletResponse res, Exception exc)
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.public DocLocator createDocLocator()
DynaXML
DefaultDocLocator
is
created.createDocLocator
in class DynaXML