org.archive.wayback.requestparser
Class BaseRequestParser

java.lang.Object
  extended by org.archive.wayback.requestparser.BaseRequestParser
All Implemented Interfaces:
RequestParser
Direct Known Subclasses:
CompositeRequestParser, WrappedRequestParser

public abstract class BaseRequestParser
extends Object
implements RequestParser

Abstract implementation of the RequestParser interface, which provides some convenience methods for accessing data in Map's, and also allows for configuring maxRecords, and earliest and latest timestamp strings. Subclasses must still implement parse().

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

Field Summary
static int DEFAULT_MAX_RECORDS
          Default maximum number of records to assume, overridden by configuration, when not specified in the client request
static String QUERY_BASE
          String path matching a query request, by form or OpenSearch
static String REPLAY_BASE
          String path matching a replay request, by form or OpenSearch
static String XQUERY_BASE
          String path matching a query request, by form or OpenSearch, indicating user requests XML data in response
 
Constructor Summary
BaseRequestParser()
           
 
Method Summary
 String getEarliestTimestamp()
           
 String getLatestTimestamp()
           
 int getMaxRecords()
           
abstract  WaybackRequest parse(javax.servlet.http.HttpServletRequest httpRequest, AccessPoint wbContext)
          attempt to transform an incoming HttpServletRequest into a WaybackRequest object.
 void setEarliestTimestamp(String timestamp)
           
 void setLatestTimestamp(String timestamp)
           
 void setMaxRecords(int maxRecords)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUERY_BASE

public static final String QUERY_BASE
String path matching a query request, by form or OpenSearch

See Also:
Constant Field Values

XQUERY_BASE

public static final String XQUERY_BASE
String path matching a query request, by form or OpenSearch, indicating user requests XML data in response

See Also:
Constant Field Values

REPLAY_BASE

public static final String REPLAY_BASE
String path matching a replay request, by form or OpenSearch

See Also:
Constant Field Values

DEFAULT_MAX_RECORDS

public static final int DEFAULT_MAX_RECORDS
Default maximum number of records to assume, overridden by configuration, when not specified in the client request

See Also:
Constant Field Values
Constructor Detail

BaseRequestParser

public BaseRequestParser()
Method Detail

parse

public abstract WaybackRequest parse(javax.servlet.http.HttpServletRequest httpRequest,
                                     AccessPoint wbContext)
                              throws BadQueryException,
                                     BetterRequestException
Description copied from interface: RequestParser
attempt to transform an incoming HttpServletRequest into a WaybackRequest object. returns null if there is missing information.

Specified by:
parse in interface RequestParser
Parameters:
httpRequest - ServletHttpRequest being handled
wbContext - AccessPoint which is attempting to parse the request
Returns:
populated WaybackRequest object if successful, null otherwise.
Throws:
BadQueryException - if the request could match this AccessPoint, but is malformed: invalid datespec, URL, or flags
BetterRequestException - if the request should be redirected to provide better user feedback (corrected URL/date in address bar)

getMaxRecords

public int getMaxRecords()
Returns:
the maxRecords to use with this RequestParser, when not specified by the client request

setMaxRecords

public void setMaxRecords(int maxRecords)
Parameters:
maxRecords - the maxRecords to use with this RequestParser, when not specified by the client request

setEarliestTimestamp

public void setEarliestTimestamp(String timestamp)
Parameters:
timestamp - the earliest timestamp to use with this RequestParser when none is supplied by the user request

getEarliestTimestamp

public String getEarliestTimestamp()
Returns:
the default earliest timestamp to use with this RequestParser

getLatestTimestamp

public String getLatestTimestamp()
Returns:
default latest timestamp for this RequestParser

setLatestTimestamp

public void setLatestTimestamp(String timestamp)
Parameters:
timestamp - the default latest timestamp to use with this RequestParser


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