|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.iphrase.onestep.beans.QueryHandler
QueryHandler provides high-level access to the OneStep Runtime API Query object.
The following is an example of using QueryHandler
directly to set a hidden constraint on every query:
<%@ page import="com.iphrase.runtime.query.constraint.*" %> <% QueryHandler queryHandler = new QueryHandler(); QueryHandler.initializeWithPageContext(pageContext); // add hidden constraint every time String[] values = {"foo", "bar"}; Constraint c = new Enumerated.InList("some_feature", values); c.setHidden(); QueryHandler.getRuntimeQuery().getConstraints().merge(new Disjunction(c)); queryHandler.execute(); %>
There are three important steps that QueryHandler performs when processing each search request:
1. Provide connection parameters required for communication with the OneStep server.
The OneStep server address is obtained using one of the following:
web.xml
server
context parameter
ip_server
URL parameter (i.e. ip_server=onestep_host:onestep_port)
2. Extract search parameters from the HttpServletRequest
object and
provide them as an input to the OneStep server.
3. Receive search results from the OneStep server and prepare them so that
they are easily accessible from the JSP code. For this purpose,
QueryHandler
builds and stores the following variables in the request-scope:
queryRqst
an instance of the Query
class
queryResultRqst
an instance of the QueryResult
class
voiceOverRqst
an instance of the VoiceOver
bean
drillDownTabsRqst
an instance of the DrillDownTabs
bean
breadcrumbsRqst
an instance of the Breadcrumb
bean
Constructor Summary | |
QueryHandler()
Construct a new (i.e., empty and uninitialized) QueryHandler instance. |
Method Summary | |
void |
addServerAddress(java.lang.String address)
Sets a single OneStep server address in the following format onestep_host:onestep_port. |
java.lang.String |
decodeInputParameter(java.lang.String paramName)
Returns the URL-decoded value of a request parameter as a String, or null if the parameter does not exist. |
void |
execute()
Executes the OneStep Runtime API Query instance and stores the results it receives in the request-scope for the remainder of the page. |
java.lang.String |
getLayout()
Get the layout name to be used for the results rendering. |
java.lang.String |
getLayoutFileName()
Get the layout file name to be used for the results rendering. |
com.iphrase.runtime.query.result.QueryResult |
getQueryResult()
Get the query results returned by the OneStep server. |
com.iphrase.runtime.Connector |
getRuntimeConnector()
Get the OneStep Runtime API Connector object created by this handler. |
com.iphrase.runtime.query.Query |
getRuntimeQuery()
Get the OneStep Runtime API Query object created by this handler. |
boolean |
initializeWithPageContext(javax.servlet.jsp.PageContext pageContext)
Initialize this QueryHandler instance with the servlet page context. |
void |
setRetry(float retrySecs)
The setter for the optional retry attribute. |
void |
setTimeout(float secs)
The setter for the optional timeout attribute. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public QueryHandler()
QueryHandler
instance.Method Detail |
public boolean initializeWithPageContext(javax.servlet.jsp.PageContext pageContext) throws javax.servlet.jsp.JspException
QueryHandler
instance with the servlet page context.
This includes initialization and request parameters.javax.servlet.jsp.JspException
- public void execute() throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException
- public com.iphrase.runtime.query.result.QueryResult getQueryResult()
QueryResult
instancepublic java.lang.String getLayout()
public java.lang.String getLayoutFileName()
public com.iphrase.runtime.Connector getRuntimeConnector()
Connector
public com.iphrase.runtime.query.Query getRuntimeQuery()
Query
instancepublic void setRetry(float retrySecs)
retry
attribute.
Pass value of -1 if you want a "dead" server to be immediately available for the next retry.retrySeconds
- wait before retrying a "dead" iPhrase serverpublic void setTimeout(float secs)
timeout
attribute.secs
- specifies the maximal number of seconds to wait for
the OneStep server response.public void addServerAddress(java.lang.String address)
address
- single server address.public java.lang.String decodeInputParameter(java.lang.String paramName)
a
- String specifying the name of the parameter
|
© Copyright 2005, 2006. IBM Corporation. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |