public abstract class RecordAccessorServlet
extends javax.servlet.http.HttpServlet
Handles server-side semantic accessors. The SemanticAccessorServlet provides
the data from a server-based
RecordAccessor as textual output in
various formats The servlet uses a
StructureWriter to specify the format and
write out its data. The SemanticAccessorServlet can also serialize the
results and send the serialized results to a
RecordAccessorClient. The servlet can
handle multiple accessors simultaneously, coordinating queries to different
accessors with any particular request.
Concrete implementations of this class should initialize the accessor in the
servlet init method.
| Constructor and Description |
|---|
RecordAccessorServlet() |
| Modifier and Type | Method and Description |
|---|---|
void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Handles the servlet GET request.
|
protected void |
generateData(java.lang.String dataName,
java.lang.String nodeName,
javax.servlet.http.HttpServletResponse res,
boolean serial)
Generate the data for the named data structure, sending it on the
response.
|
RecordAccessor |
getAccessor()
Get the data accessor currently used
|
javax.xml.parsers.DocumentBuilder |
getDocBuilder()
Get the document builder used to generate XML.
|
StructureWriter |
getSemanticWriter()
Get the semantic writer used to format the data structures
|
javax.xml.transform.Transformer |
getTransformer()
Get the transformer used to format or transform the XML output.
|
protected boolean |
isDebug()
Return whether the servlet is in debug mode for a particular request.
|
void |
setAccessor(RecordAccessor accessor)
Set the SemanticAccessor used by this servlet.
|
protected void |
setDebug(boolean debugFlag)
Set the debug flag
|
void |
setSemanticWriter(StructureWriter writer)
Set the semantic writer used by this servlet.
|
protected void |
writeXml(org.w3c.dom.Document doc,
javax.servlet.http.HttpServletResponse res)
Write the XML document out to the Servlet Response.
|
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, servicepublic void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
Handles the servlet GET request. This method accepts several parameters:
doGet in class javax.servlet.http.HttpServletreq - the request the client has made of the servletres - the response the servlet sends to the clientjavax.servlet.ServletException - if the request could not be handledjava.io.IOException - if an input or output error is detected when the
servlet handles the requestprotected void generateData(java.lang.String dataName,
java.lang.String nodeName,
javax.servlet.http.HttpServletResponse res,
boolean serial)
throws java.io.IOException
dataName - the name of the data structure.nodeName - the name of a node within the data structure. If set,
the semantic accessor will use the name to expand a data
structure. If null, the accessor will generate data without
regard to any particular node.res - the servlet response objectserial - whether to serialize the data.java.io.IOException - if there is a problem writing the datapublic RecordAccessor getAccessor()
public javax.xml.parsers.DocumentBuilder getDocBuilder()
public StructureWriter getSemanticWriter()
public javax.xml.transform.Transformer getTransformer()
protected boolean isDebug()
public void setAccessor(RecordAccessor accessor)
accessor - the semantic accessorprotected void setDebug(boolean debugFlag)
debugFlag - the debug flagpublic void setSemanticWriter(StructureWriter writer)
writer - the semanticWriterprotected void writeXml(org.w3c.dom.Document doc,
javax.servlet.http.HttpServletResponse res)
doc - the XML documentres - the servlet response object