org.archive.wayback.core
Class WaybackRequest

java.lang.Object
  extended by org.archive.wayback.core.WaybackRequest

public class WaybackRequest
extends Object

Abstraction of all the data associated with a users request to the Wayback Machine.

Version:
$Date: 2010-09-29 05:28:38 +0700 (Wed, 29 Sep 2010) $, $Revision: 3262 $
Author:
Brad Tofel

Field Summary
static String REQUEST_ANCHOR_DATE
          Replay-Only: indicates the date to tend towards when computing closest matches within time.
static String REQUEST_ANCHOR_WINDOW
          Replay-Only: String representation of number of seconds.
static String REQUEST_AUTH_TYPE
          Authorization Type: "BASIC", "SSL", or null if none.
static String REQUEST_AUTHORIZATION
          Exact value from HTTP request for header "Authorization"
static String REQUEST_CAPTURE_QUERY
          REQUEST_TYPE option indicating a query against the ResourceIndex for captures of URLs matching the REQUEST_URL
static String REQUEST_CHARSET_MODE
          Request: Charset detection mode
static String REQUEST_CSS_CONTEXT
          Request: CSS context requested
static String REQUEST_DATE
          GUARANTEED PRESENT for Replay requests only.
static String REQUEST_END_DATE
          GUARANTEED PRESENT: omit results after this 14-digit String timestamp.
static String REQUEST_EXACT_DATE
          GUARANTEED PRESENT for Replay requests only, no meaning for Query requests.
static String REQUEST_EXACT_HOST_ONLY
          Indicates user only wants results that exactly match the hostname within REQUEST_URL -- no canonicalization.
static String REQUEST_EXACT_SCHEME_ONLY
          Indicates user only wants results that were captured using the same scheme as that specified in REQUEST_URL.
static String REQUEST_IDENTITY_CONTEXT
          Request: Identity context requested (totally transparent)
static String REQUEST_IMAGE_CONTEXT
          Request: IMG context requested
static String REQUEST_IS_LIVE_WEB
          Indicates user requested content from proxied from the live web.
static String REQUEST_JS_CONTEXT
          Request: JS context requested
static String REQUEST_LOCALE_LANG
          User Locale name: Best Guess at users requested locale.
static String REQUEST_META_MODE
          Request: replay actual document or metadata for document: "yes" means replay metadata only, not the actual document: (TimeLine mode)
static String REQUEST_REFERER_URL
          incoming requests HTTP "Referer:" header, or null
static String REQUEST_REMOTE_ADDRESS
          Remote Address that connected to this webapp to create the request string IP address: "127.0.0.1"
static String REQUEST_REMOTE_USER
          Remote User or null if the request did not contain auth info.
static String REQUEST_REPLAY_QUERY
          REQUEST_TYPE option indicating a request for Replay of the Resource matching REQUEST_URL closest in time to REQUEST_DATE
static String REQUEST_RESOLUTION
          resolution of results to be displayed: (TimeLine mode)
static String REQUEST_RESOLUTION_AUTO
          auto resolution (TimeLine mode)
static String REQUEST_RESOLUTION_DAYS
          day resolution (TimeLine mode)
static String REQUEST_RESOLUTION_HOURS
          hour resolution (TimeLine mode)
static String REQUEST_RESOLUTION_MONTHS
          month resolution (TimeLine mode)
static String REQUEST_RESOLUTION_TWO_MONTHS
          two-month resolution (TimeLine mode)
static String REQUEST_RESOLUTION_YEARS
          year resolution (TimeLine mode)
static String REQUEST_START_DATE
          GUARANTEED PRESENT: omit results before this 14-digit String timestamp.
static String REQUEST_TYPE
          specifies the TYPE of the this particular request.
static String REQUEST_URL
          GUARANTEED PRESENT: Original(RAW) URL or URL prefix requested, before any cleanup/fixing
static String REQUEST_URL_QUERY
          REQUEST_TYPE option indicating a query against the ResourceIndex for summaries of URLs prefixed with the REQUEST_URL
static String REQUEST_WAYBACK_CONTEXT
          the string (webapp) context that received this request
static String REQUEST_WAYBACK_HOSTNAME
          incoming requests HTTP "Host:" header, or null
static String REQUEST_WAYBACK_PORT
          the port the remote user connected to for this request
static String REQUEST_XML_DATA
          Request: xml data requested
static String REQUEST_YES
          indicates positive value for any request boolean flag.
 
Constructor Summary
WaybackRequest()
           
 
Method Summary
 void addResultFilter(ObjectFilter<CaptureSearchResult> resultFilter)
           
 WaybackRequest clone()
           
 boolean containsKey(String key)
          Deprecated.  
 void fixup(javax.servlet.http.HttpServletRequest httpRequest)
          attempt to fixup this WaybackRequest, mostly with respect to dates: if only "date" was specified, infer start and end dates from it.
 String get(String key)
           
 AccessPoint getAccessPoint()
           
 Date getAnchorDate()
           
 String getAnchorTimestamp()
           
 long getAnchorWindow()
           
 String getAuthType()
           
 int getCharsetMode()
           
 String getContextPrefix()
          Deprecated. use AccessPoint.setReplayPrefix or setQueryPrefix
 Date getEndDate()
           
 String getEndTimestamp()
           
 ExclusionFilter getExclusionFilter()
           
 StringFormatter getFormatter()
           
 String getLocaleLanguage()
           
 int getPageNum()
           
 String getQueryArguments()
           
 String getQueryArguments(int pageNum)
           
 String getRefererUrl()
           
 String getRemoteIPAddress()
           
 String getRemoteUser()
           
 Date getReplayDate()
           
 String getReplayTimestamp()
           
 String getRequestUrl()
           
 int getResultsPerPage()
           
 String getServerPrefix()
          Deprecated. use AccessPoint.get*Prefix
 Date getStartDate()
           
 String getStartTimestamp()
           
 String getTimelineResolution()
           
 String getWaybackContext()
           
 String getWaybackHostname()
           
 int getWaybackPort()
           
 boolean isCaptureQueryRequest()
           
 boolean isCSSContext()
           
 boolean isExactHost()
           
 boolean isExactScheme()
           
 boolean isIdentityContext()
           
 boolean isIMGContext()
           
 boolean isJSContext()
           
 boolean isLiveWebRequest()
           
 boolean isMetaMode()
           
 boolean isReplayRequest()
           
 boolean isUrlQueryRequest()
           
 boolean isXMLMode()
           
 Set<String> keySet()
          Deprecated.  
 void put(String key, String value)
           
 void remove(String key)
           
 void setAccessPoint(AccessPoint accessPoint)
           
 void setAnchorDate(Date date)
           
 void setAnchorTimestamp(String timestamp)
           
 void setAnchorWindow(long seconds)
           
 void setCaptureQueryRequest()
          marks this request as a Capture Query request
 void setCharsetMode(int mode)
           
 void setContextPrefix(String prefix)
          Deprecated. use getAccessPoint.getStaticPrefix() or getAccessPoint.getReplayPrefix()
 void setCSSContext(boolean isCSSContext)
           
 void setEndDate(Date date)
           
 void setEndTimestamp(String timestamp)
           
 void setExactHost(boolean isExactHost)
           
 void setExactScheme(boolean isExactScheme)
           
 void setExclusionFilter(ExclusionFilter exclusionFilter)
           
 void setIdentityContext(boolean isIdentityContext)
           
 void setIMGContext(boolean isIMGContext)
           
 void setJSContext(boolean isJSContext)
           
 void setLiveWebRequest(boolean isLiveWebRequest)
           
 void setLocale(Locale l)
          Set the Locale for the request, which impacts UI Strings
 void setMetaMode(boolean isMetaMode)
           
 void setPageNum(int pageNum)
           
 void setReplayDate(Date date)
           
 void setReplayRequest()
          marks this request as a Replay request
 void setReplayTimestamp(String timestamp)
           
 void setRequestUrl(String urlStr)
          Set the request URL.
 void setResultFilters(ObjectFilterChain<CaptureSearchResult> resultFilters)
           
 void setResultsPerPage(int resultsPerPage)
           
 void setServerPrefix(String prefix)
          Deprecated. use AccessPoint.set*Prefix
 void setStartDate(Date date)
           
 void setStartTimestamp(String timestamp)
           
 void setTimelineAutoResolution()
           
 void setTimelineDayResolution()
           
 void setTimelineHourResolution()
           
 void setTimelineMonthResolution()
           
 void setTimelineTwoMonthResolution()
           
 void setTimelineYearResolution()
           
 void setUrlQueryRequest()
          marks this request as an Url Query request
 void setXMLMode(boolean isXMLMode)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUEST_TYPE

public static final String REQUEST_TYPE
specifies the TYPE of the this particular request. One of: *) REQUEST_REPLAY_QUERY *) REQUEST_CAPTURE_QUERY *) REQUEST_URL_QUERY

See Also:
Constant Field Values

REQUEST_REPLAY_QUERY

public static final String REQUEST_REPLAY_QUERY
REQUEST_TYPE option indicating a request for Replay of the Resource matching REQUEST_URL closest in time to REQUEST_DATE

See Also:
Constant Field Values

REQUEST_CAPTURE_QUERY

public static final String REQUEST_CAPTURE_QUERY
REQUEST_TYPE option indicating a query against the ResourceIndex for captures of URLs matching the REQUEST_URL

See Also:
Constant Field Values

REQUEST_URL_QUERY

public static final String REQUEST_URL_QUERY
REQUEST_TYPE option indicating a query against the ResourceIndex for summaries of URLs prefixed with the REQUEST_URL

See Also:
Constant Field Values

REQUEST_URL

public static final String REQUEST_URL
GUARANTEED PRESENT: Original(RAW) URL or URL prefix requested, before any cleanup/fixing

See Also:
Constant Field Values

REQUEST_END_DATE

public static final String REQUEST_END_DATE
GUARANTEED PRESENT: omit results after this 14-digit String timestamp. Possibly created from: 1) specified directly in request 2) a partial REQUEST_DATE (latest possible given a prefix) 3) RequestParser default 4) 14-digit representation of the moment the request was recieved.

See Also:
Constant Field Values

REQUEST_START_DATE

public static final String REQUEST_START_DATE
GUARANTEED PRESENT: omit results before this 14-digit String timestamp. Possibly created from: 1) specified directly in request 2) a partial REQUEST_DATE (earliest possible given a prefix) 3) RequestParser default 4) 14-digit representation of midnight Jan 1, 1996.

See Also:
Constant Field Values

REQUEST_DATE

public static final String REQUEST_DATE
GUARANTEED PRESENT for Replay requests only. If present for Query requests, then it will be interpreted as a partial timestamp for missing REQUEST_START_DATE and REQUEST_END_DATE fields. Original (RAW/possibly partial) 14-digit timestamp of date requested for Replay

See Also:
Constant Field Values

REQUEST_EXACT_DATE

public static final String REQUEST_EXACT_DATE
GUARANTEED PRESENT for Replay requests only, no meaning for Query requests. Cleaned up version of original REQUEST_DATE, padded to 14 digits assuming the

See Also:
Constant Field Values

REQUEST_EXACT_HOST_ONLY

public static final String REQUEST_EXACT_HOST_ONLY
Indicates user only wants results that exactly match the hostname within REQUEST_URL -- no canonicalization.

See Also:
Constant Field Values

REQUEST_EXACT_SCHEME_ONLY

public static final String REQUEST_EXACT_SCHEME_ONLY
Indicates user only wants results that were captured using the same scheme as that specified in REQUEST_URL.

See Also:
Constant Field Values

REQUEST_IS_LIVE_WEB

public static final String REQUEST_IS_LIVE_WEB
Indicates user requested content from proxied from the live web.

See Also:
Constant Field Values

REQUEST_YES

public static final String REQUEST_YES
indicates positive value for any request boolean flag.

See Also:
Constant Field Values

REQUEST_ANCHOR_DATE

public static final String REQUEST_ANCHOR_DATE
Replay-Only: indicates the date to tend towards when computing closest matches within time. Used to prevent "time drift" while surfing from a particular date.

See Also:
Constant Field Values

REQUEST_ANCHOR_WINDOW

public static final String REQUEST_ANCHOR_WINDOW
Replay-Only: String representation of number of seconds. Used only in conjunction with REQUEST_ANCHOR_DATE, and indicates that documents more than this many seconds should not be shown in a replay session. Useful for QA purposes, to ensure that all content within a replay session was crawled near a particular point, the REQUEST_ANCHOR_DATE.

See Also:
Constant Field Values

REQUEST_META_MODE

public static final String REQUEST_META_MODE
Request: replay actual document or metadata for document: "yes" means replay metadata only, not the actual document: (TimeLine mode)

See Also:
Constant Field Values

REQUEST_XML_DATA

public static final String REQUEST_XML_DATA
Request: xml data requested

See Also:
Constant Field Values

REQUEST_CSS_CONTEXT

public static final String REQUEST_CSS_CONTEXT
Request: CSS context requested

See Also:
Constant Field Values

REQUEST_JS_CONTEXT

public static final String REQUEST_JS_CONTEXT
Request: JS context requested

See Also:
Constant Field Values

REQUEST_IMAGE_CONTEXT

public static final String REQUEST_IMAGE_CONTEXT
Request: IMG context requested

See Also:
Constant Field Values

REQUEST_IDENTITY_CONTEXT

public static final String REQUEST_IDENTITY_CONTEXT
Request: Identity context requested (totally transparent)

See Also:
Constant Field Values

REQUEST_CHARSET_MODE

public static final String REQUEST_CHARSET_MODE
Request: Charset detection mode

See Also:
Constant Field Values

REQUEST_WAYBACK_CONTEXT

public static final String REQUEST_WAYBACK_CONTEXT
the string (webapp) context that received this request

See Also:
Constant Field Values

REQUEST_WAYBACK_PORT

public static final String REQUEST_WAYBACK_PORT
the port the remote user connected to for this request

See Also:
Constant Field Values

REQUEST_WAYBACK_HOSTNAME

public static final String REQUEST_WAYBACK_HOSTNAME
incoming requests HTTP "Host:" header, or null

See Also:
Constant Field Values

REQUEST_REFERER_URL

public static final String REQUEST_REFERER_URL
incoming requests HTTP "Referer:" header, or null

See Also:
Constant Field Values

REQUEST_REMOTE_ADDRESS

public static final String REQUEST_REMOTE_ADDRESS
Remote Address that connected to this webapp to create the request string IP address: "127.0.0.1"

See Also:
Constant Field Values

REQUEST_REMOTE_USER

public static final String REQUEST_REMOTE_USER
Remote User or null if the request did not contain auth info. see HttpServletRequest.getRemoteUser()

See Also:
Constant Field Values

REQUEST_AUTHORIZATION

public static final String REQUEST_AUTHORIZATION
Exact value from HTTP request for header "Authorization"

See Also:
Constant Field Values

REQUEST_LOCALE_LANG

public static final String REQUEST_LOCALE_LANG
User Locale name: Best Guess at users requested locale. see ServletRequest.getLocale().getDisplayLanguage()

See Also:
Constant Field Values

REQUEST_AUTH_TYPE

public static final String REQUEST_AUTH_TYPE
Authorization Type: "BASIC", "SSL", or null if none. see HttpServletRequest.getAuthType()

See Also:
Constant Field Values

REQUEST_RESOLUTION

public static final String REQUEST_RESOLUTION
resolution of results to be displayed: (TimeLine mode)

See Also:
Constant Field Values

REQUEST_RESOLUTION_AUTO

public static final String REQUEST_RESOLUTION_AUTO
auto resolution (TimeLine mode)

See Also:
Constant Field Values

REQUEST_RESOLUTION_YEARS

public static final String REQUEST_RESOLUTION_YEARS
year resolution (TimeLine mode)

See Also:
Constant Field Values

REQUEST_RESOLUTION_TWO_MONTHS

public static final String REQUEST_RESOLUTION_TWO_MONTHS
two-month resolution (TimeLine mode)

See Also:
Constant Field Values

REQUEST_RESOLUTION_MONTHS

public static final String REQUEST_RESOLUTION_MONTHS
month resolution (TimeLine mode)

See Also:
Constant Field Values

REQUEST_RESOLUTION_DAYS

public static final String REQUEST_RESOLUTION_DAYS
day resolution (TimeLine mode)

See Also:
Constant Field Values

REQUEST_RESOLUTION_HOURS

public static final String REQUEST_RESOLUTION_HOURS
hour resolution (TimeLine mode)

See Also:
Constant Field Values
Constructor Detail

WaybackRequest

public WaybackRequest()
Method Detail

getResultsPerPage

public int getResultsPerPage()
Returns:
Returns the resultsPerPage.

setResultsPerPage

public void setResultsPerPage(int resultsPerPage)
Parameters:
resultsPerPage - The resultsPerPage to set.

getPageNum

public int getPageNum()
Returns:
Returns the pageNum.

setPageNum

public void setPageNum(int pageNum)
Parameters:
pageNum - The pageNum to set.

setContextPrefix

public void setContextPrefix(String prefix)
Deprecated. use getAccessPoint.getStaticPrefix() or getAccessPoint.getReplayPrefix()

Parameters:
prefix -

getContextPrefix

public String getContextPrefix()
Deprecated. use AccessPoint.setReplayPrefix or setQueryPrefix

Construct an absolute URL that points to the root of the context that received the request, including a trailing "/".

Returns:
String absolute URL pointing to the Context root where the request was received.

setServerPrefix

public void setServerPrefix(String prefix)
Deprecated. use AccessPoint.set*Prefix

Parameters:
prefix -

getServerPrefix

public String getServerPrefix()
Deprecated. use AccessPoint.get*Prefix

Parameters:
prefix -
Returns:
an absolute String URL that will point to the root of the server that is handling the request.

getAccessPoint

public AccessPoint getAccessPoint()
Returns:
the accessPoint

setAccessPoint

public void setAccessPoint(AccessPoint accessPoint)
Parameters:
accessPoint - the accessPoint to set

getExclusionFilter

public ExclusionFilter getExclusionFilter()

setExclusionFilter

public void setExclusionFilter(ExclusionFilter exclusionFilter)

setResultFilters

public void setResultFilters(ObjectFilterChain<CaptureSearchResult> resultFilters)

addResultFilter

public void addResultFilter(ObjectFilter<CaptureSearchResult> resultFilter)

getFormatter

public StringFormatter getFormatter()
Returns:
StringFormatter based on user request info

get

public String get(String key)
Parameters:
key -
Returns:
String value for key 'key', or null if no value exists

put

public void put(String key,
                String value)
Parameters:
key -
value -

remove

public void remove(String key)

containsKey

public boolean containsKey(String key)
Deprecated. 

Parameters:
key -
Returns:
boolean, true if the request contains key 'key'

isReplayRequest

public boolean isReplayRequest()
Returns:
true if this is a Replay request

setReplayRequest

public void setReplayRequest()
marks this request as a Replay request


isCaptureQueryRequest

public boolean isCaptureQueryRequest()
Returns:
true if this is a Capture Query request

setCaptureQueryRequest

public void setCaptureQueryRequest()
marks this request as a Capture Query request


isUrlQueryRequest

public boolean isUrlQueryRequest()
Returns:
true if this is an Url Query request

setUrlQueryRequest

public void setUrlQueryRequest()
marks this request as an Url Query request


getRequestUrl

public String getRequestUrl()

setRequestUrl

public void setRequestUrl(String urlStr)
Set the request URL.

Parameters:
urlStr - Request URL.

getEndTimestamp

public String getEndTimestamp()

getEndDate

public Date getEndDate()

setEndDate

public void setEndDate(Date date)

setEndTimestamp

public void setEndTimestamp(String timestamp)

getStartTimestamp

public String getStartTimestamp()

getStartDate

public Date getStartDate()

setStartDate

public void setStartDate(Date date)

setStartTimestamp

public void setStartTimestamp(String timestamp)

getReplayTimestamp

public String getReplayTimestamp()

getReplayDate

public Date getReplayDate()

setReplayDate

public void setReplayDate(Date date)

setReplayTimestamp

public void setReplayTimestamp(String timestamp)

setExactHost

public void setExactHost(boolean isExactHost)

isExactHost

public boolean isExactHost()

setExactScheme

public void setExactScheme(boolean isExactScheme)

isExactScheme

public boolean isExactScheme()

setLiveWebRequest

public void setLiveWebRequest(boolean isLiveWebRequest)

isLiveWebRequest

public boolean isLiveWebRequest()

getAnchorTimestamp

public String getAnchorTimestamp()

getAnchorDate

public Date getAnchorDate()

setAnchorDate

public void setAnchorDate(Date date)

setAnchorTimestamp

public void setAnchorTimestamp(String timestamp)

getAnchorWindow

public long getAnchorWindow()

setAnchorWindow

public void setAnchorWindow(long seconds)

setMetaMode

public void setMetaMode(boolean isMetaMode)

isMetaMode

public boolean isMetaMode()

setXMLMode

public void setXMLMode(boolean isXMLMode)

isXMLMode

public boolean isXMLMode()

setJSContext

public void setJSContext(boolean isJSContext)

isJSContext

public boolean isJSContext()

setCSSContext

public void setCSSContext(boolean isCSSContext)

isCSSContext

public boolean isCSSContext()

setIMGContext

public void setIMGContext(boolean isIMGContext)

isIMGContext

public boolean isIMGContext()

setIdentityContext

public void setIdentityContext(boolean isIdentityContext)

isIdentityContext

public boolean isIdentityContext()

setCharsetMode

public void setCharsetMode(int mode)

getCharsetMode

public int getCharsetMode()

getWaybackContext

public String getWaybackContext()

getWaybackPort

public int getWaybackPort()

getWaybackHostname

public String getWaybackHostname()

getRefererUrl

public String getRefererUrl()

getRemoteIPAddress

public String getRemoteIPAddress()

getRemoteUser

public String getRemoteUser()

getLocaleLanguage

public String getLocaleLanguage()

getAuthType

public String getAuthType()

getTimelineResolution

public String getTimelineResolution()

setTimelineAutoResolution

public void setTimelineAutoResolution()

setTimelineYearResolution

public void setTimelineYearResolution()

setTimelineTwoMonthResolution

public void setTimelineTwoMonthResolution()

setTimelineMonthResolution

public void setTimelineMonthResolution()

setTimelineDayResolution

public void setTimelineDayResolution()

setTimelineHourResolution

public void setTimelineHourResolution()

setLocale

public void setLocale(Locale l)
Set the Locale for the request, which impacts UI Strings

Parameters:
l -

fixup

public void fixup(javax.servlet.http.HttpServletRequest httpRequest)
attempt to fixup this WaybackRequest, mostly with respect to dates: if only "date" was specified, infer start and end dates from it. Also grab useful info from the HttpServletRequest, cookies, remote address, etc.

Parameters:
httpRequest -

getQueryArguments

public String getQueryArguments()
Returns:
String hex-encoded GET CGI arguments which will duplicate this wayback request

getQueryArguments

public String getQueryArguments(int pageNum)
Parameters:
pageNum -
Returns:
String hex-encoded GET CGI arguments which will duplicate the same request, but for page 'pageNum' of the results

clone

public WaybackRequest clone()
Overrides:
clone in class Object

keySet

public Set<String> keySet()
Deprecated. 

Returns:


Copyright © 2005-2011 Internet Archive. All Rights Reserved.