org.archive.wayback.requestparser
Class BaseRequestParser

java.lang.Object
  extended by org.archive.wayback.requestparser.BaseRequestParser
All Implemented Interfaces:
RequestParser
Direct Known Subclasses:
CompositeRequestParser, DomainPrefixRequestParser, FormRequestParser, OpenSearchRequestParser, PathRequestParser, ProxyReplayRequestParser

public abstract class BaseRequestParser
extends java.lang.Object
implements RequestParser

Class that implements the RequestParser interface, and also understands how to: This class will attempt to use the overridable parseCustom() method to create the WaybackRequest object, but if that fails (returns null), it will fall back to: A) attempting to parse out an incoming OpenSearch format query B) attempting to parse out any and all incoming form elements submitted as either GET or POST arguments This class also contains the functionality to extract HTTP header information into WaybackRequest objects, including Http auth info, referer, remote IPs, etc.

Version:
$Date$, $Revision$
Author:
brad

Field Summary
protected static int DEFAULT_MAX_RECORDS
           
protected  java.lang.String earliestTimestamp
           
protected  java.lang.String latestTimestamp
           
protected  int maxRecords
           
protected static java.lang.String QUERY_BASE
           
protected static java.lang.String REPLAY_BASE
           
protected static java.lang.String XQUERY_BASE
           
 
Constructor Summary
BaseRequestParser()
           
 
Method Summary
 java.lang.String getEarliestTimestamp()
           
 java.lang.String getLatestTimestamp()
           
protected static java.lang.String getMapParam(java.util.Map<java.lang.String,java.lang.String[]> queryMap, java.lang.String field)
           
protected static java.lang.String getMapParamOrEmpty(java.util.Map<java.lang.String,java.lang.String[]> map, java.lang.String param)
           
 int getMaxRecords()
           
protected static java.lang.String getRequiredMapParam(java.util.Map<java.lang.String,java.lang.String[]> queryMap, java.lang.String field)
           
abstract  WaybackRequest parse(javax.servlet.http.HttpServletRequest httpRequest, AccessPoint wbContext)
          attempt to transform an incoming HttpServletRequest into a WaybackRequest object.
 void setEarliestTimestamp(java.lang.String timestamp)
           
 void setLatestTimestamp(java.lang.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

protected static final java.lang.String QUERY_BASE
See Also:
Constant Field Values

XQUERY_BASE

protected static final java.lang.String XQUERY_BASE
See Also:
Constant Field Values

REPLAY_BASE

protected static final java.lang.String REPLAY_BASE
See Also:
Constant Field Values

DEFAULT_MAX_RECORDS

protected static final int DEFAULT_MAX_RECORDS
See Also:
Constant Field Values

maxRecords

protected int maxRecords

earliestTimestamp

protected java.lang.String earliestTimestamp

latestTimestamp

protected java.lang.String latestTimestamp
Constructor Detail

BaseRequestParser

public BaseRequestParser()
Method Detail

getMapParam

protected static java.lang.String getMapParam(java.util.Map<java.lang.String,java.lang.String[]> queryMap,
                                              java.lang.String field)

getRequiredMapParam

protected static java.lang.String getRequiredMapParam(java.util.Map<java.lang.String,java.lang.String[]> queryMap,
                                                      java.lang.String field)
                                               throws BadQueryException
Throws:
BadQueryException

getMapParamOrEmpty

protected static java.lang.String getMapParamOrEmpty(java.util.Map<java.lang.String,java.lang.String[]> map,
                                                     java.lang.String param)

parse

public abstract WaybackRequest parse(javax.servlet.http.HttpServletRequest httpRequest,
                                     AccessPoint wbContext)
                              throws BadQueryException
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
Returns:
populated WaybackRequest object if successful, null otherwise.
Throws:
BadQueryException

getMaxRecords

public int getMaxRecords()
Returns:
the maxRecords

setMaxRecords

public void setMaxRecords(int maxRecords)
Specified by:
setMaxRecords in interface RequestParser
Parameters:
maxRecords - the maxRecords to set

setEarliestTimestamp

public void setEarliestTimestamp(java.lang.String timestamp)
Specified by:
setEarliestTimestamp in interface RequestParser
Parameters:
timestamp -

getEarliestTimestamp

public java.lang.String getEarliestTimestamp()
Returns:

getLatestTimestamp

public java.lang.String getLatestTimestamp()

setLatestTimestamp

public void setLatestTimestamp(java.lang.String timestamp)
Specified by:
setLatestTimestamp in interface RequestParser


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