public class SelectorReplayDispatcher extends Object implements ReplayDispatcher
Optionally it can be configured with MimeTypeDetectors used for
 overriding unknown ("unk") or often-misused ("text/html")
 value of CaptureSearchResult.getMimeType().
| Modifier and Type | Field and Description | 
|---|---|
static String | 
DEFAULT_MISSING_MIMETYPE  | 
static String[] | 
DEFAULT_UNTRUSTFUL_MIMETYPES
default value for  
untrustfulMimeTypes | 
| Constructor and Description | 
|---|
SelectorReplayDispatcher()  | 
| Modifier and Type | Method and Description | 
|---|---|
CaptureSearchResult | 
getClosest(WaybackRequest wbRequest,
          CaptureSearchResults results)  | 
ClosestResultSelector | 
getClosestSelector()  | 
List<MimeTypeDetector> | 
getMimeTypeDetectors()  | 
String | 
getMissingMimeType()  | 
ReplayRenderer | 
getRenderer(WaybackRequest wbRequest,
           CaptureSearchResult result,
           Resource resource)
Return a ReplayRenderer appropriate for the Resource. 
 | 
ReplayRenderer | 
getRenderer(WaybackRequest wbRequest,
           CaptureSearchResult result,
           Resource httpHeadersResource,
           Resource payloadResource)
Return a ReplayRenderer appropriate for the replaying the http headers
 from  
httpHeadersResource and the payload from
 payloadResource. | 
List<ReplayRendererSelector> | 
getSelectors()  | 
void | 
setClosestSelector(ClosestResultSelector closestSelector)  | 
void | 
setMimeTypeDetectors(List<MimeTypeDetector> sniffers)  | 
void | 
setMissingMimeType(String missingMimeType)
Value of  
mimetype field indicating Content-Type
 is unavailable in the response. | 
void | 
setSelectors(List<ReplayRendererSelector> selectors)  | 
void | 
setUntrustfulMimeTypes(List<String> untrustfulMimeTypes)
A list of  
mimetype values that cannot be fully trusted. | 
protected boolean | 
shouldDetectMimeType(String mimeType)
check if mime-type detection is suggested for mimeType. 
 | 
public static final String DEFAULT_MISSING_MIMETYPE
public static final String[] DEFAULT_UNTRUSTFUL_MIMETYPES
untrustfulMimeTypespublic void setUntrustfulMimeTypes(List<String> untrustfulMimeTypes)
mimetype values that cannot be fully trusted.
 For captures whose mimetype prefix-matches any of these,
 SelectorReplayDispatcher will attempt to detect actual mime-type
 with mimeTypeDetector (if configured).
 Value set to missingMimeType is always considered
 untrustful. You don't need to include it in this list.
If passed null, default DEFAULT_UNTRUSTFUL_MIMETYPES
 will be used. If set to an empty array, detection is applied only to
 captures without Content-Type header.
untrustfulMimeTypes - list of mime-type prefixespublic void setMissingMimeType(String missingMimeType)
mimetype field indicating Content-Type
 is unavailable in the response.
 Default is unk (compatible with CDX-Writer).
 IndexWorker puts application/http, apparently.missingMimeType - public String getMissingMimeType()
protected boolean shouldDetectMimeType(String mimeType)
mimeType - mime-type to test (must not be null/empty/"unk")true if mime-type should be determined
 by looking into Resource.public ReplayRenderer getRenderer(WaybackRequest wbRequest, CaptureSearchResult result, Resource resource)
ReplayDispatchergetRenderer in interface ReplayDispatcherwbRequest - WaybackRequest being handled.result - CapturSearchResult from the ResourceIndex which is
                                 being returned.resource - Resource as returned by ResourceStore which should
               be returned to the user.public ReplayRenderer getRenderer(WaybackRequest wbRequest, CaptureSearchResult result, Resource httpHeadersResource, Resource payloadResource)
ReplayDispatcherhttpHeadersResource and the payload from
 payloadResource.getRenderer in interface ReplayDispatcherwbRequest - WaybackRequest being handled.result - CapturSearchResult from the ResourceIndex which is
                                 being returned.public CaptureSearchResult getClosest(WaybackRequest wbRequest, CaptureSearchResults results)
getClosest in interface ReplayDispatcherwbRequest - the Request being handledresults - the CaptureSearchResults from the ResourceIndexpublic List<ReplayRendererSelector> getSelectors()
public void setSelectors(List<ReplayRendererSelector> selectors)
selectors - the List of ReplayRendererSelector to usepublic List<MimeTypeDetector> getMimeTypeDetectors()
public void setMimeTypeDetectors(List<MimeTypeDetector> sniffers)
public void setClosestSelector(ClosestResultSelector closestSelector)
closestSelector - the closestSelector to setpublic ClosestResultSelector getClosestSelector()
Copyright © 2005–2015 IIPC. All rights reserved.