public class DocRequest extends Object implements Request
Request
.UnsupportedRequest
Constructor and Description |
---|
DocRequest(DocId docId)
Constructs a request with a null access time that supports HTTP
204 responses.
|
DocRequest(DocId docId,
Date lastAccessTime)
Constructs a request that supports HTTP 204 responses.
|
DocRequest(DocId docId,
Date lastAccessTime,
boolean isNoContentSupported)
Constructs a request.
|
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. |
String |
toString() |
public DocRequest(DocId docId)
docId
- the requested document IDNullPointerException
- if docId
is nullpublic DocRequest(DocId docId, Date lastAccessTime)
docId
- the requested document IDlastAccessTime
- the last time the document was crawledNullPointerException
- if docId
is nullpublic DocRequest(DocId docId, Date lastAccessTime, boolean isNoContentSupported)
docId
- the requested document IDlastAccessTime
- the last time the document was crawled;
null
implies that the document has never been crawledisNoContentSupported
- true
if an HTTP 204 response
is allowed, and false
otherwiseNullPointerException
- if docId
is nullpublic 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()
.public 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
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 modifiedpublic 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 modifiedtrue
if the docuemnt has not changed and we are
either talking to GSA version 7.4 or higher, or a web browser,
and false
otherwise