/** * @return the defined replayPrefix for the AccessPoint */ public String getReplayPrefix() { if (wbRequest != null) { if (wbRequest.getAccessPoint() != null) { return wbRequest.getAccessPoint().getReplayPrefix(); } } return ""; }
/** * @return the defined replayPrefix for the AccessPoint */ public String getReplayPrefix() { if (wbRequest != null) { if (wbRequest.getAccessPoint() != null) { return wbRequest.getAccessPoint().getReplayPrefix(); } } return ""; }
/** * @return the defined staticPrefix for the AccessPoint%><%@ page import="org.archive.wayback.webapp.PerfWritingHttpServletResponse" */ public String getStaticPrefix() { if (wbRequest != null) { if (wbRequest.getAccessPoint() != null) { return wbRequest.getAccessPoint().getStaticPrefix(); } } return ""; }
/** * @return the defined staticPrefix for the AccessPoint%><%@ page import="org.archive.wayback.webapp.PerfWritingHttpServletResponse" */ public String getStaticPrefix() { if (wbRequest != null) { if (wbRequest.getAccessPoint() != null) { return wbRequest.getAccessPoint().getStaticPrefix(); } } return ""; }
/** * @return the defined queryPrefix for the AccessPoint */ public String getQueryPrefix() { if (wbRequest != null) { if (wbRequest.getAccessPoint() != null) { return wbRequest.getAccessPoint().getQueryPrefix(); } } return ""; }
/** * @return the defined queryPrefix for the AccessPoint */ public String getQueryPrefix() { if (wbRequest != null) { if (wbRequest.getAccessPoint() != null) { return wbRequest.getAccessPoint().getQueryPrefix(); } } return ""; }
public void generateResponse(HttpServletResponse response, WaybackRequest wbRequest) { response.setStatus(status); String redirectURI = betterURI; if ((wbRequest != null) && betterURI.startsWith("/") && wbRequest.hasMementoAcceptDatetime()) { redirectURI = MementoUtils.getMementoPrefix(wbRequest .getAccessPoint()) + betterURI; } response.setHeader("Location", redirectURI); if (extraHeaders.size() > 0) { for (Map.Entry<String, String> entry : extraHeaders.entrySet()) { response.setHeader(entry.getKey(), entry.getValue()); } } }
public void generateResponse(HttpServletResponse response, WaybackRequest wbRequest) { response.setStatus(status); String redirectURI = betterURI; if ((wbRequest != null) && betterURI.startsWith("/") && wbRequest.hasMementoAcceptDatetime()) { redirectURI = MementoUtils.getMementoPrefix(wbRequest .getAccessPoint()) + betterURI; } response.setHeader("Location", redirectURI); if (extraHeaders.size() > 0) { for (Map.Entry<String, String> entry : extraHeaders.entrySet()) { response.setHeader(entry.getKey(), entry.getValue()); } } }
@Override public boolean isTrue(WaybackRequest value) { AccessPoint ap = value.getAccessPoint(); String path = ap.getAccessPointPath(); if (path == null) { return noMatchesDefault; } BooleanOperator<WaybackRequest> op = pathMap.get(path); if (op == null) { return noMatchesDefault; } return op.isTrue(value); }
@Override public boolean isTrue(WaybackRequest value) { AccessPoint ap = value.getAccessPoint(); String path = ap.getAccessPointPath(); if (path == null) { return noMatchesDefault; } BooleanOperator<WaybackRequest> op = pathMap.get(path); if (op == null) { return noMatchesDefault; } return op.isTrue(value); }
@Override public boolean renderMementoTimemap(WaybackRequest wbRequest, HttpServletRequest request, HttpServletResponse response) throws WaybackException, IOException { SearchResults cResults = wbRequest.getAccessPoint().queryIndex(wbRequest); MementoUtils.printTimemapResponse((CaptureSearchResults)cResults, wbRequest, response); return true; }
@Override public boolean renderMementoTimemap(WaybackRequest wbRequest, HttpServletRequest request, HttpServletResponse response) throws WaybackException, IOException { SearchResults cResults = wbRequest.getAccessPoint().queryIndex(wbRequest); MementoUtils.printTimemapResponse((CaptureSearchResults)cResults, wbRequest, response); return true; }
/** * Build a self-referencing URL that will perform a query for all copies * of the given URL (plain, clean URL version). * @param url URL to search for copies of * @return String URL for querying captures of * @version 1.8.1 */ public String makePlainCaptureQueryUrl(String url) { // TOOD: want "2014*" instead of "20140101000000-20141231115959*" return wbRequest.getAccessPoint().makeCaptureQueryUrl(url, wbRequest.getStartTimestamp(), wbRequest.getEndTimestamp()); }
/** * Build a self-referencing URL that will perform a query for all copies * of the given URL (plain, clean URL version). * @param url URL to search for copies of * @return String URL for querying captures of * @version 1.8.1 */ public String makePlainCaptureQueryUrl(String url) { // TOOD: want "2014*" instead of "20140101000000-20141231115959*" return wbRequest.getAccessPoint().makeCaptureQueryUrl(url, wbRequest.getStartTimestamp(), wbRequest.getEndTimestamp()); }
/** * Create a self-referencing URL that will drive to the given page, * simplifying rendering pagination * @param pageNum page number of results to link to. * @return String URL which will drive browser to search results for a * different page of results for the same query */ public String urlForPage(int pageNum) { WaybackRequest wbRequest = getWbRequest(); return wbRequest.getAccessPoint().getQueryPrefix() + "query?" + wbRequest.getQueryArguments(pageNum); }
/** * Create a self-referencing URL that will drive to the given page, * simplifying rendering pagination * @param pageNum page number of results to link to. * @return String URL which will drive browser to search results for a * different page of results for the same query */ public String urlForPage(int pageNum) { WaybackRequest wbRequest = getWbRequest(); return wbRequest.getAccessPoint().getQueryPrefix() + "query?" + wbRequest.getQueryArguments(pageNum); }
@Override public SearchResults answer() throws Throwable { WaybackRequest wbRequest = (WaybackRequest)EasyMock .getCurrentArguments()[0]; // This emulates key ResourceIndex behavior wbRequest.getAccessPoint().createExclusionFilter(); return results; } });
protected void doRedirection(WaybackRequest wbRequest, CaptureSearchResult closest) throws BetterRequestException { // redirect to the better version: ArchivalUrl aUrl = new ArchivalUrl(wbRequest); String betterUrl = wbRequest.getAccessPoint().getReplayPrefix() + aUrl.toString(closest.getCaptureTimestamp(), closest.getOriginalUrl()); throw new BetterRequestException(betterUrl); } }
/** * Create a self-referencing URL that will perform a query for all copies * of the given URL. * <p>This method builds URL that passes target URL in CGI parameter, * along with other parameters unnecessary for making simple capture * query request. It is not suitable for simple links. * {@link #makePlainCaptureQueryUrl(String)} generates clean and * plain URL.</p> * @param url to search for copies of * @return String url that will make a query for all captures of an URL. */ public String makeCaptureQueryUrl(String url) { WaybackRequest newWBR = wbRequest.clone(); newWBR.setCaptureQueryRequest(); newWBR.setRequestUrl(url); return newWBR.getAccessPoint().getQueryPrefix() + "query?" + newWBR.getQueryArguments(1); }
protected void doRedirection(WaybackRequest wbRequest, CaptureSearchResult closest) throws BetterRequestException { // redirect to the better version: ArchivalUrl aUrl = new ArchivalUrl(wbRequest); String betterUrl = wbRequest.getAccessPoint().getReplayPrefix() + aUrl.toString(closest.getCaptureTimestamp(), closest.getOriginalUrl()); throw new BetterRequestException(betterUrl); } }