public abstract class AbstractSearchServlet extends javax.servlet.http.HttpServlet implements SearchViewLogic, SearchViewConfiguration
servlet of the
search. URIEncoding="UTF-8" or better useBodyEncodingForURI="true" for the
connector in the server.xml of your tomcat.| Modifier and Type | Field and Description |
|---|---|
private String |
bundleName |
private SearchEngineConfigurationHolder |
configurationHolder |
private SearchEngineConfigurationLoader |
configurationReader |
private String |
configurationUri |
private String |
detailsPath
The name of the view (URL segment) for the details.
|
private Collection<? extends SearchEntryTypeView> |
entryTypeViews |
private String |
errorPath
The name of the view (JSP without ".jsp") for the error page or
null to dispatch to the
current view even in case of an error. |
private Map<String,SearchEntryTypeViewBean> |
id2viewMap |
private Iso8601Util |
iso8601Util |
private String |
lastRefreshDate |
private org.slf4j.Logger |
logger
The
Logger. |
private NlsLocalizer |
nlsLocalizer |
private ManagedSearchEngine |
searchEngine |
private String |
searchPath
The name of the view (URL segment) for the actual search.
|
private static long |
serialVersionUID
The UID for serialization.
|
private Collection<SearchSourceViewBean> |
sourceViews |
private XmlUtil |
xmlUtil |
DEFAULT_BUNDLE_NAME, DEFAULT_DETAILS_PATH, DEFAULT_SEARCH_PATH, PARAMETER_BUNDLE_NAME, PARAMETER_CONFIGURATION_URL, PARAMETER_DETAILS_PATH, PARAMETER_ERROR_PATH, PARAMETER_SEARCH_PATH| Constructor and Description |
|---|
AbstractSearchServlet()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
appendFieldQuery(ComplexSearchQuery complexQuery,
String field,
String value)
This method extends the given
complexQuery with a query for the given property. |
void |
destroy() |
protected void |
doDispatch(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
boolean exception)
This method dispatches the request to the according view (by default according JSP).
|
protected void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
String |
getBundleName()
This method gets the qualified name of the
ResourceBundle used if texts for the UI from
the configuration are specified in the from
{<KEY>}. |
SearchEngineConfiguration |
getConfiguration()
This method gets the
SearchEngineConfiguration. |
String |
getDetailsPath()
The
servlet-path for the view of the
details of a particular SearchHit. |
String |
getDisplayTitle(SearchEntry searchEntry)
This method get the display-title from the given
searchEntry. |
SearchEntryType |
getEntryType(String id)
|
Collection<? extends SearchEntryTypeView> |
getEntryTypeViews()
This method gets the list of
SearchEntryTypeViews sorted by title. |
String |
getErrorPath()
This method get the name of the path to
dispatch to in case of an error (e.g. |
protected abstract IocContainer |
getIocContainer()
This method gets the
IocContainer used to manage components with their implementation. |
Iso8601Util |
getIso8601Util()
This method gets the
Iso8601Util that can be used to format and parse dates. |
String |
getLastRefreshDate()
This method gets the date of the last refresh as String.
|
protected org.slf4j.Logger |
getLogger()
This method gets the
Logger. |
NlsLocalizer |
getNlsLocalizer()
This method gets the
NlsLocalizer used for localization of the UI. |
private static String |
getParameter(javax.servlet.ServletConfig config,
String key,
String defaultValue)
This method gets an
init-parameter. |
ManagedSearchEngine |
getSearchEngine()
This method gets the
ManagedSearchEngine. |
String |
getSearchPath()
The
servlet-path for the view of the
actual search (enter query and show results). |
Collection<SearchSourceViewBean> |
getSourceViews()
This method gets the list of views on the
SearchSourceViews sorted by
title. |
XmlUtil |
getXmlUtil()
|
void |
init(javax.servlet.ServletConfig config) |
boolean |
refresh()
This method reloads the
configuration and the
SearchEngine on the fly. |
private void |
update()
This method updates the internal state and views.
|
private void |
updateEntryTypeViews()
This method updates the
entry type views. |
private void |
updateSourceViews()
This method updates the
entry type views. |
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceprivate final org.slf4j.Logger logger
Logger.private static final long serialVersionUID
private String searchPath
private String detailsPath
private String errorPath
null to dispatch to the
current view even in case of an error.private SearchEngineConfigurationLoader configurationReader
refresh()private String configurationUri
init(ServletConfig)private SearchEngineConfigurationHolder configurationHolder
getConfiguration()private ManagedSearchEngine searchEngine
getSearchEngine()private XmlUtil xmlUtil
getXmlUtil()private Iso8601Util iso8601Util
getIso8601Util()private Collection<? extends SearchEntryTypeView> entryTypeViews
getEntryTypeViews()private Map<String,SearchEntryTypeViewBean> id2viewMap
updateEntryTypeViews()private Collection<SearchSourceViewBean> sourceViews
getSourceViews()private String lastRefreshDate
getLastRefreshDate()private NlsLocalizer nlsLocalizer
getNlsLocalizer()private String bundleName
getBundleName()protected org.slf4j.Logger getLogger()
Logger.Logger.public ManagedSearchEngine getSearchEngine()
ManagedSearchEngine.getSearchEngine in interface SearchViewLogicManagedSearchEngine.public SearchEngineConfiguration getConfiguration()
SearchEngineConfiguration.getConfiguration in interface SearchViewLogicSearchEngineConfiguration.SearchViewLogic.getEntryTypeViews(),
SearchViewLogic.getEntryType(String),
SearchViewLogic.getSourceViews()public XmlUtil getXmlUtil()
getXmlUtil in interface SearchViewLogicXmlUtil.public Iso8601Util getIso8601Util()
Iso8601Util that can be used to format and parse dates.getIso8601Util in interface SearchViewLogicIso8601Util.public String getLastRefreshDate()
getLastRefreshDate in interface SearchViewLogicpublic String getSearchPath()
servlet-path for the view of the
actual search (enter query and show results).getSearchPath in interface SearchViewConfigurationSearchViewConfiguration.DEFAULT_SEARCH_PATHpublic String getDetailsPath()
servlet-path for the view of the
details of a particular SearchHit.getDetailsPath in interface SearchViewConfigurationSearchViewConfiguration.DEFAULT_DETAILS_PATHpublic String getErrorPath()
dispatch to in case of an error (e.g. "error.jsp") or null to dispatch to the current view
even in case of an error.getErrorPath in interface SearchViewConfigurationpublic Collection<? extends SearchEntryTypeView> getEntryTypeViews()
SearchEntryTypeViews sorted by title.getEntryTypeViews in interface SearchViewLogicSearchEntryTypeViews.public Collection<SearchSourceViewBean> getSourceViews()
SearchSourceViews sorted by
title.getSourceViews in interface SearchViewLogicpublic NlsLocalizer getNlsLocalizer()
NlsLocalizer used for localization of the UI.getNlsLocalizer in interface SearchViewLogicNlsLocalizer.public String getBundleName()
ResourceBundle used if texts for the UI from
the configuration are specified in the from
{<KEY>}.getBundleName in interface SearchViewConfigurationNlsTemplateImpl.getName()public SearchEntryType getEntryType(String id)
getEntryType in interface SearchViewLogicid - is the ID of the requested SearchEntryType.SearchEntryType.protected abstract IocContainer getIocContainer()
IocContainer used to manage components with their implementation. The
IocContainer will be created and initialized on the first call of this method.IocContainer.private static String getParameter(javax.servlet.ServletConfig config, String key, String defaultValue)
init-parameter.config - is the ServletConfig.key - is the name of the requested parameter.defaultValue - the default value returned if the actual parameter is NOT set (null).
May also be null.defaultValue if NOT set.public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
init in interface javax.servlet.Servletinit in class javax.servlet.GenericServletjavax.servlet.ServletExceptionpublic void destroy()
destroy in interface javax.servlet.Servletdestroy in class javax.servlet.GenericServletprivate void appendFieldQuery(ComplexSearchQuery complexQuery, String field, String value)
complexQuery with a query for the given property.complexQuery - is the existing query to extend.field - is the name of the field to add to the query.value - is the value to search in the given property.protected void doDispatch(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
boolean exception)
throws javax.servlet.ServletException,
IOException
request - is the HttpServletRequest.response - is the HttpServletResponse.exception - - true if an Exception occurred, false on success.javax.servlet.ServletException - if something goes wrong.IOException - if something goes wrong.protected void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
IOException
doGet in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionprivate void updateSourceViews()
entry type views. SearchEngineConfiguration defines the SearchEntryTypes. For this view these
SearchEntryTypes are reduced to those types that actually exist in the search-index. Then they
are combined and finally sorted according
to the title. private void update()
private void updateEntryTypeViews()
entry type views. SearchEngineConfiguration defines the SearchEntryTypes. For this view these
SearchEntryTypes are reduced to those types that actually exist in the search-index. Then they
are combined and finally sorted according
to the title. public boolean refresh()
configuration and the
SearchEngine on the fly. search-engine.
This method refreshes the given object. This can be anything from reloading configuration to rebuilding the
internal state. An invocation of this method may be expensive and should only be invoked as needed. The
implementation of this method should be thread-safe if the object itself is to be used by separate consumers at
all.refresh in interface SearchViewLogicrefresh in interface Refreshabletrue if something has changed, false otherwise. If the implementation can not determine the
change it should return true.public String getDisplayTitle(SearchEntry searchEntry)
searchEntry. In advance to
SearchEntry.getTitle() this method will create a combination of filename and the actual title and
handle null values.getDisplayTitle in interface SearchViewLogicsearchEntry - is the SearchEntry where to get the title from.title of the SearchEntry.Copyright © 2001–2016 mmm-Team. All rights reserved.