Because it is possible for optimized URLs not to contain query
string parameters (these parameters can be stored in the path), you cannot rely
on the
UrlENEQuery
class to create an
ENEQuery
object from a URL.
Instead, use a
UrlFormatter
to parse the incoming request URL in
order to populate the
UrlState
with the current URL query parameters, then
use a
QueryBuilder
to create the
ENEQuery
from the
UrlState
.
To parse an incoming request and query an MDEX Engine, follow these steps:
Parse the request into a
UrlState
instance.For example:
UrlState requestUrlState = urlFormatter.parseRequest(request);
Build an
ENEQuery
based on theUrlState
.For example:
ENEQuery eneQuery = queryBuilder.buildQuery(requestUrlState);
Execute the request and retrieve the results.
For example:
HttpENEConnection conn = new HttpENEConnection(mdexHost, mdexPort); ENEQueryResults eneQueryResults = conn.query(eneQuery);