Package eu.clarin.sru.server
Interface SRURequest
-
public interface SRURequest
Provides information about a SRU request.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SRUAuthenticationInfo
getAuthentication()
Get the authentication information that was extracted from the the request.String
getAuthenticationSubject()
Get the subject of the request.String
getExtraRequestData(String name)
Get the value of an extra parameter of this request.List<String>
getExtraRequestDataNames()
Get the names of extra parameters of this request.String
getHttpAccept()
(SRU 2.0) The request parameter httpAccept may be supplied to indicate the preferred format of the response.int
getMaximumRecords()
Get the maximumRecords parameter of this request.int
getMaximumTerms()
Get the maximumTerms parameter of this request.SRUOperation
getOperation()
Get the operation parameter of this request.String
getProtocolScheme()
Get the protocol schema which was used of this request.SRUQuery<?>
getQuery()
Get the query parameter of this request.<T extends SRUQuery<?>>
TgetQuery(Class<T> type)
Get the query parameter of this request.String
getQueryType()
Get the queryType parameter of this request.SRURecordPacking
getRecordPacking()
Get the recordPacking (SRU 2.0) parameter of this request.String
getRecordSchemaIdentifier()
Get the record schema identifier derived from the recordSchema parameter of this request.SRURecordXmlEscaping
getRecordXmlEscaping()
Get the recordXmlEscpaing (SRU 2.0) or recordPacking (SRU 1.1 and SRU 1.2) parameter of this request.String
getRecordXPath()
Get the recordXPath parameter of this request.SRURenderBy
getRenderBy()
Get the renderBy parameter of this request.String
getResponeType()
(SRU 2.0) The request parameter responseType, paired with the Internet media type specified for the response (via either the httpAccept parameter or http accept header) determines the schema for the response.int
getResponsePosition()
Get the responsePosition parameter of this request.int
getResultSetTTL()
Get the resultSetTTL parameter of this request.org.z3950.zing.cql.CQLNode
getScanClause()
Get the scanClause parameter of this request.javax.servlet.http.HttpServletRequest
getServletRequest()
Get the raw client request information from the Servlet container.String
getSortKeys()
Get the sortKeys parameter of this request.int
getStartRecord()
Get the startRecord parameter of this request.String
getStylesheet()
Get the stylesheet parameter of this request.SRUVersion
getVersion()
Get the version parameter of this request.boolean
isQueryType(String queryType)
Check if the request was made with the given queryType.boolean
isVersion(SRUVersion version)
Check if this request is of a specific version.boolean
isVersion(SRUVersion min, SRUVersion max)
Check if version of this request is at least min and at most max.
-
-
-
Method Detail
-
getAuthentication
SRUAuthenticationInfo getAuthentication()
Get the authentication information that was extracted from the the request.- Returns:
- the request authentication or
null
-
getAuthenticationSubject
String getAuthenticationSubject()
Get the subject of the request.- Returns:
- the subject of the request or
null
-
getOperation
SRUOperation getOperation()
Get the operation parameter of this request. Available for explain, searchRetrieve and scan requests.- Returns:
- the operation
- See Also:
SRUOperation
-
getVersion
SRUVersion getVersion()
Get the version parameter of this request. Available for explain, searchRetrieve and scan requests.- Returns:
- the version
- See Also:
SRUVersion
-
isVersion
boolean isVersion(SRUVersion version)
Check if this request is of a specific version.- Parameters:
version
- the version to check- Returns:
true
if this request is in the requested version,false
otherwise- Throws:
NullPointerException
- if version isnull
-
isVersion
boolean isVersion(SRUVersion min, SRUVersion max)
Check if version of this request is at least min and at most max.- Parameters:
min
- the minimum versionmax
- the maximum version- Returns:
true
if this request is in the provides version,false
otherwise- Throws:
NullPointerException
- if minimum or maximumnull
IllegalArgumentException
- if minimum is larger the maximum
-
getRecordXmlEscaping
SRURecordXmlEscaping getRecordXmlEscaping()
Get the recordXmlEscpaing (SRU 2.0) or recordPacking (SRU 1.1 and SRU 1.2) parameter of this request. Only available for explain and searchRetrieve requests.- Returns:
- the record XML escaping method
- See Also:
SRURecordXmlEscaping
-
getRecordPacking
SRURecordPacking getRecordPacking()
Get the recordPacking (SRU 2.0) parameter of this request. Only available for searchRetrieve requests.- Returns:
- the record packing method
- See Also:
SRURecordPacking
-
getQuery
SRUQuery<?> getQuery()
Get the query parameter of this request. Only available for searchRetrieve requests.- Returns:
- an
SRUQuery
instance tailored for the used queryType ornull
if not a searchRetrieve request
-
getQuery
<T extends SRUQuery<?>> T getQuery(Class<T> type)
Get the query parameter of this request. Only available for searchRetrieve requests. This convenience method tried to cast the query object to the supplied type.- Type Parameters:
T
- Class of the returned type- Parameters:
type
- Class representing the return type to convert the query to- Returns:
- an
SRUQuery
instance tailored for the used queryType ornull
if not a searchRetrieve request - Throws:
ClassCastException
- if conversion is not supported, type isnull
or another error occurs
-
getQueryType
String getQueryType()
Get the queryType parameter of this request. Only available for searchRetrieve requests.- Returns:
- the queryType of the parsed query or
null
if not a searchRetrieve request
-
isQueryType
boolean isQueryType(String queryType)
Check if the request was made with the given queryType. Only available for searchRetrieve requests.- Parameters:
queryType
- the queryType to compare with- Returns:
true
if the queryType matches,false
otherwise
-
getStartRecord
int getStartRecord()
Get the startRecord parameter of this request. Only available for searchRetrieve requests. If the client did not provide a value for the request, it is set to1
.- Returns:
- the number of the start record
-
getMaximumRecords
int getMaximumRecords()
Get the maximumRecords parameter of this request. Only available for searchRetrieve requests. If no value was supplied with the request, the server will automatically set a default value.- Returns:
- the maximum number of records
-
getRecordSchemaIdentifier
String getRecordSchemaIdentifier()
Get the record schema identifier derived from the recordSchema parameter of this request. Only available for searchRetrieve requests. If the request was send with the short record schema name, it will automatically expanded to the record schema identifier.- Returns:
- the record schema identifier or
null
if no recordSchema parameter was supplied for this request
-
getRecordXPath
String getRecordXPath()
Get the recordXPath parameter of this request. Only available for searchRetrieve requests and version 1.1 requests.- Returns:
- the record XPath or
null
of no value was supplied for this request
-
getResultSetTTL
int getResultSetTTL()
Get the resultSetTTL parameter of this request. Only available for searchRetrieve requests.- Returns:
- the result set TTL or
-1
if no value was supplied for this request
-
getSortKeys
String getSortKeys()
Get the sortKeys parameter of this request. Only available for searchRetrieve requests and version 1.1 requests.- Returns:
- the record XPath or
null
of no value was supplied for this request
-
getScanClause
org.z3950.zing.cql.CQLNode getScanClause()
Get the scanClause parameter of this request. Only available for scan requests.- Returns:
- the parsed scan clause or
null
if not a scan request
-
getResponsePosition
int getResponsePosition()
Get the responsePosition parameter of this request. Only available for scan requests. If the client did not provide a value for the request, it is set to1
.- Returns:
- the response position
-
getMaximumTerms
int getMaximumTerms()
Get the maximumTerms parameter of this request. Available for any type of request.- Returns:
- the maximum number of terms or
-1
if no value was supplied for this request
-
getStylesheet
String getStylesheet()
Get the stylesheet parameter of this request. Available for explain, searchRetrieve and scan requests.- Returns:
- the stylesheet or
null
if no value was supplied for this request
-
getRenderBy
SRURenderBy getRenderBy()
Get the renderBy parameter of this request.- Returns:
- the renderBy parameter or
null
if no value was supplied for this request
-
getResponeType
String getResponeType()
(SRU 2.0) The request parameter responseType, paired with the Internet media type specified for the response (via either the httpAccept parameter or http accept header) determines the schema for the response.- Returns:
- the value of the responeType request parameter or
null
if no value was supplied for this request
-
getHttpAccept
String getHttpAccept()
(SRU 2.0) The request parameter httpAccept may be supplied to indicate the preferred format of the response. The value is an Internet media type.- Returns:
- the value of the httpAccept request parameter or
null
if no value was supplied for
-
getProtocolScheme
String getProtocolScheme()
Get the protocol schema which was used of this request. Available for explain, searchRetrieve and scan requests.- Returns:
- the protocol scheme
-
getExtraRequestDataNames
List<String> getExtraRequestDataNames()
Get the names of extra parameters of this request. Available for explain, searchRetrieve and scan requests.- Returns:
- a possibly empty list of parameter names
-
getExtraRequestData
String getExtraRequestData(String name)
Get the value of an extra parameter of this request. Available for explain, searchRetrieve and scan requests.- Parameters:
name
- name of the extra parameter. Must be prefixed withx-
- Returns:
- the value of the parameter of
null
of extra parameter with that name exists - Throws:
NullPointerException
- ifname
is nullIllegalArgumentException
- ifname
does not start withx-
-
getServletRequest
javax.servlet.http.HttpServletRequest getServletRequest()
Get the raw client request information from the Servlet container.- Returns:
- the Servlet request
-
-