public class UnsupportedRequest extends Object implements Request
Request
that throws an
UnsupportedOperationException
if any method is called.
This class is intended to be extended for unit testing, rather
than implementing the Request
interface directly.
DocRequest
Constructor and Description |
---|
UnsupportedRequest() |
Modifier and Type | Method and Description |
---|---|
boolean |
canRespondWithNoContent(Date lastModified)
Returns
true if the GSA or other client's current copy of the
document was retrieved after the lastModified date and GSA can
handle HTTP 204 response; false otherwise. |
DocId |
getDocId()
Provides the document ID for the document that is being requested.
|
Date |
getLastAccessTime()
Returns the last time a GSA or other client retrieved the data, or
null if none was provided by the client. |
boolean |
hasChangedSinceLastAccess(Date lastModified)
Returns
true if the GSA or other client's current copy of the
document was retrieved after the lastModified date; false
otherwise. |
public boolean hasChangedSinceLastAccess(Date lastModified)
Request
true
if the GSA or other client's current copy of the
document was retrieved after the lastModified
date; false
otherwise. lastModified
must be in GMT.
If false
, the client does not need to be re-sent the data, since
what they have cached is the most recent version. In this case, you should
then call Response.respondNotModified()
.
hasChangedSinceLastAccess
in interface Request
lastModified
- is actual time document was last modifiedUnsupportedOperationException
- alwayspublic boolean canRespondWithNoContent(Date lastModified)
Request
true
if the GSA or other client's current copy of the
document was retrieved after the lastModified
date and GSA can
handle HTTP 204 response; false
otherwise. lastModified
must be in GMT.
If true
, the client does not need to be re-sent the file content
, since what they have cached is the most recent version. In this case,
you should then call Response.respondNoContent()
.
canRespondWithNoContent
in interface Request
lastModified
- is actual time document was last modifiedUnsupportedOperationException
- alwayspublic Date getLastAccessTime()
Request
null
if none was provided by the client. The returned Date
is in
GMT.
This is useful for determining if the client needs to be re-sent the
data since what they have cached may be the most recent version. If the
client is up-to-date, then call Response.respondNotModified()
.
getLastAccessTime
in interface Request
null
UnsupportedOperationException
- alwayspublic DocId getDocId()
Request
DocId
was not necessarily provided previously by the Adaptor; it is
client-provided and must not be trusted. If the document does not
exist, then Adaptor.getDocContent(com.google.enterprise.adaptor.Request, com.google.enterprise.adaptor.Response)
must call Response.respondNotFound()
.getDocId
in interface Request
UnsupportedOperationException
- always