log.debug("ttl="+ttl);
if(ttl<resultSetIdleTime)
resultSetIdleTime=ttl;
}
String dbname=(String)msgContext.getProperty("dbname");
SRWDatabase db=(SRWDatabase)msgContext.getProperty("db");
if(log.isDebugEnabled())
log.debug("db="+db);
String sortKeys=request.getSortKeys();
if(sortKeys!=null)
request.setSortKeys(sortKeys);
String query=request.getQuery();
if(query.indexOf('%')>=0)
try {
request.setQuery(java.net.URLDecoder.decode(query, "utf-8"));
}
catch (java.io.UnsupportedEncodingException e) {
}
if(query==null) {
response=new SearchRetrieveResponseType();
db.diagnostic(SRWDiagnostic.MandatoryParameterNotSupplied,
"query", response);
}
else if(request.getStartRecord()!=null &&
request.getStartRecord().intValue()==Integer.MAX_VALUE) {
response=new SearchRetrieveResponseType();
db.diagnostic(SRWDiagnostic.UnsupportedParameterValue,
"startRecord", response);
}
else if(request.getMaximumRecords()!=null &&
request.getMaximumRecords().intValue()==Integer.MAX_VALUE) {
response=new SearchRetrieveResponseType();
db.diagnostic(SRWDiagnostic.UnsupportedParameterValue,
"maximumRecords", response);
}
else if(request.getResultSetTTL()!=null &&
request.getResultSetTTL().intValue()==Integer.MAX_VALUE) {
response=new SearchRetrieveResponseType();
db.diagnostic(SRWDiagnostic.UnsupportedParameterValue,
"resultSetTTL", response);
}
else
try {
response=db.doRequest(request);
if(response==null) {
response=new SearchRetrieveResponseType();
response.setVersion("1.1");
setEchoedSearchRetrieveRequestType(request, response);
db.diagnostic(SRWDiagnostic.GeneralSystemError, null, response);
return response;
}
if(msgContext.getProperty("sru")!=null &&
request.getStylesheet()!=null) // you can't ask for a stylesheet in srw!
db.diagnostic(SRWDiagnostic.StylesheetsNotSupported, null, response);
setEchoedSearchRetrieveRequestType(request, response);
if(request.getRecordXPath()!=null)
db.diagnostic(72, null, response);
if(request.getSortKeys()!=null &&
!request.getSortKeys().equals("") && !db.supportsSort())
db.diagnostic(SRWDiagnostic.SortNotSupported, null, response);
// set extraResponseData
StringBuffer extraResponseData = new StringBuffer();
// we're going to stick the database name in extraResponseData every time