org.mycore.services.fieldquery
Class MCRSearchServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.mycore.frontend.servlets.MCRServlet
              extended by org.mycore.services.fieldquery.MCRSearchServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class MCRSearchServlet
extends MCRServlet

This servlet executes queries and presents result pages.

Author:
Frank L�tzenkirchen, Harald Richter
See Also:
Serialized Form

Field Summary
protected static Logger LOGGER
           
 
Fields inherited from class org.mycore.frontend.servlets.MCRServlet
BASE_URL_ATTRIBUTE, trustedProxies
 
Constructor Summary
MCRSearchServlet()
           
 
Method Summary
protected  MCRCondition cleanupQuery(Document input)
          cleans the query e.g.
 void doGetPost(MCRServletJob job)
          This method should be overwritten by other servlets.
protected  void doQuery(HttpServletRequest request, HttpServletResponse response)
          Executes a query that comes from editor search mask, and redirects the browser to the first results page
protected  MCRCachedQueryData getQueryData(HttpServletRequest request)
           
 void init()
           
protected  void loadQuery(HttpServletRequest request, HttpServletResponse response)
          Returns a query that was previously submitted, to reload it into the editor search mask.
protected  void sendRedirect(HttpServletRequest req, HttpServletResponse res, String id, String numPerPage)
          Redirect browser to results page
protected  void sendToLayout(HttpServletRequest req, HttpServletResponse res, Document jdom)
          Forwards the document to the output
protected  void showResults(HttpServletRequest request, HttpServletResponse response)
          Shows a results page.
 
Methods inherited from class org.mycore.frontend.servlets.MCRServlet
buildRedirectURL, doGet, doGet, doPost, doPost, generateActiveLinkErrorpage, generateErrorPage, getBaseURL, getLastModified, getLayoutService, getProperty, getRemoteAddr, getServletBaseURL, getSession, handleException, initTrustedProxies, render, reportException, think
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final Logger LOGGER
Constructor Detail

MCRSearchServlet

public MCRSearchServlet()
Method Detail

init

public void init()
          throws ServletException
Overrides:
init in class MCRServlet
Throws:
ServletException

doGetPost

public void doGetPost(MCRServletJob job)
               throws IOException
Description copied from class: MCRServlet
This method should be overwritten by other servlets. As a default response we indicate the HTTP 1.1 status code 501 (Not Implemented).

Overrides:
doGetPost in class MCRServlet
Throws:
IOException

getQueryData

protected MCRCachedQueryData getQueryData(HttpServletRequest request)

loadQuery

protected void loadQuery(HttpServletRequest request,
                         HttpServletResponse response)
                  throws IOException
Returns a query that was previously submitted, to reload it into the editor search mask. Usage: MCRSearchServlet?mode=load&id=XXXXX

Throws:
IOException

showResults

protected void showResults(HttpServletRequest request,
                           HttpServletResponse response)
                    throws IOException
Shows a results page. Usage: MCRSearchServlet?mode=results&numPerPage=10&page=1

Throws:
IOException

doQuery

protected void doQuery(HttpServletRequest request,
                       HttpServletResponse response)
                throws IOException
Executes a query that comes from editor search mask, and redirects the browser to the first results page

Throws:
IOException

cleanupQuery

protected MCRCondition cleanupQuery(Document input)
cleans the query e.g. renames condition elements and removes empty condition elements

Parameters:
input - - the jdom-Document containing the query, which has to be modified

sendToLayout

protected void sendToLayout(HttpServletRequest req,
                            HttpServletResponse res,
                            Document jdom)
                     throws IOException
Forwards the document to the output

Throws:
IOException
See Also:
overwritten in jspdocportal

sendRedirect

protected void sendRedirect(HttpServletRequest req,
                            HttpServletResponse res,
                            String id,
                            String numPerPage)
                     throws IOException
Redirect browser to results page

Throws:
IOException
See Also:
overwritten in jspdocportal