SMILA 1.0 API documentation

org.eclipse.smila.search.servlet
Class SMILASearchServlet

java.lang.Object
  extended by HttpServlet
      extended by org.eclipse.smila.search.servlet.SMILASearchServlet

public class SMILASearchServlet
extends HttpServlet

Author:
jschumacher

Field Summary
static java.lang.String DEFAULT_PIPELINE
          default pipeline name.
static java.lang.String DEFAULT_STYLESHEET
          default stylesheet name.
static java.lang.String ELEMENT_INDEX_NAME
          Element name for a index names list entry.
static java.lang.String ELEMENT_INDEX_NAMES
          Element name for the index names list.
 
Constructor Summary
SMILASearchServlet()
           
 
Method Summary
protected  void appendIndexList(org.w3c.dom.Document doc)
          Appends a list of index names to the document.
protected  void doGet(HttpServletRequest request, HttpServletResponse response)
          
protected  void doPost(HttpServletRequest request, HttpServletResponse response)
          
protected  void doPut(HttpServletRequest request, HttpServletResponse response)
          
protected  ResultDocumentBuilder getErrorBuilder()
          ensure and return a ResultDocumentBuilder.
protected  ServletFileUpload getFileUploadParser()
          ensure and return a file upload parser.
protected  javax.xml.transform.Transformer getXSLTransformer(org.w3c.dom.Document xslDoc)
          create XSL transformer for stylesheet.
protected  void processRequest(HttpServletRequest request, HttpServletResponse response)
          extract query parameters from request, create SMILA Query record and send it to a SearchService, transform the DOM result to HTML using an XSLT stylesheet.
protected  byte[] transform(org.w3c.dom.Document doc, java.lang.String stylesheet)
          transform DOM documment using stylesheet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PIPELINE

public static final java.lang.String DEFAULT_PIPELINE
default pipeline name.

See Also:
Constant Field Values

DEFAULT_STYLESHEET

public static final java.lang.String DEFAULT_STYLESHEET
default stylesheet name.

See Also:
Constant Field Values

ELEMENT_INDEX_NAMES

public static final java.lang.String ELEMENT_INDEX_NAMES
Element name for the index names list.

See Also:
Constant Field Values

ELEMENT_INDEX_NAME

public static final java.lang.String ELEMENT_INDEX_NAME
Element name for a index names list entry.

See Also:
Constant Field Values
Constructor Detail

SMILASearchServlet

public SMILASearchServlet()
Method Detail

doGet

protected void doGet(HttpServletRequest request,
                     HttpServletResponse response)
              throws ServletException,
                     java.io.IOException

Throws:
ServletException
java.io.IOException
See Also:
javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

doPost

protected void doPost(HttpServletRequest request,
                      HttpServletResponse response)
               throws ServletException,
                      java.io.IOException

Throws:
ServletException
java.io.IOException
See Also:
javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

doPut

protected void doPut(HttpServletRequest request,
                     HttpServletResponse response)
              throws ServletException,
                     java.io.IOException

Throws:
ServletException
java.io.IOException
See Also:
javax.servlet.http.HttpServlet#doPut(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

processRequest

protected void processRequest(HttpServletRequest request,
                              HttpServletResponse response)
                       throws ServletException,
                              java.io.IOException
extract query parameters from request, create SMILA Query record and send it to a SearchService, transform the DOM result to HTML using an XSLT stylesheet.

Parameters:
request - HTTP request
response - HTTP response
Throws:
ServletException - error during processing
java.io.IOException - error writing result to response stream

transform

protected byte[] transform(org.w3c.dom.Document doc,
                           java.lang.String stylesheet)
                    throws ServletException
transform DOM documment using stylesheet.

Parameters:
doc - DOM search result document
stylesheet - stylesheet name (without .xsl suffix)
Returns:
HTML result
Throws:
ServletException - error during transformation

getXSLTransformer

protected javax.xml.transform.Transformer getXSLTransformer(org.w3c.dom.Document xslDoc)
                                                     throws ServletException
create XSL transformer for stylesheet.

Parameters:
xslDoc - XSL DOM document
Returns:
XSL transformer
Throws:
ServletException - error.

appendIndexList

protected void appendIndexList(org.w3c.dom.Document doc)
Appends a list of index names to the document.

Parameters:
doc - the document to append the list to

getFileUploadParser

protected ServletFileUpload getFileUploadParser()
ensure and return a file upload parser.

Returns:
FileUpload helper.

getErrorBuilder

protected ResultDocumentBuilder getErrorBuilder()
ensure and return a ResultDocumentBuilder.

Returns:
ResultDocumentBuilder helper.

SMILA 1.0 API documentation