From: <bra...@us...> - 2007-04-17 21:49:43
|
Revision: 1725 http://archive-access.svn.sourceforge.net/archive-access/?rev=1725&view=rev Author: bradtofel Date: 2007-04-17 14:49:40 -0700 (Tue, 17 Apr 2007) Log Message: ----------- FEATURE: exposed underlying ResultURIConverter via public accessor Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2007-04-17 21:48:18 UTC (rev 1724) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2007-04-17 21:49:40 UTC (rev 1725) @@ -170,6 +170,13 @@ } /** + * @return the ResultURIConverter + */ + public ResultURIConverter getURIConverter() { + return uriConverter; + } + + /** * @param result * @return Date representing captureDate of SearchResult result */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2007-07-16 23:39:54
|
Revision: 1797 http://archive-access.svn.sourceforge.net/archive-access/?rev=1797&view=rev Author: bradtofel Date: 2007-07-16 16:39:55 -0700 (Mon, 16 Jul 2007) Log Message: ----------- TWEAK: now aware of CaptureSearchResults + URLSearchResults TWEAK: type-safety FEATURE: added a couple jsp-friendly methods for converting data types, and constructing various types of query and replay URLs. Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2007-07-16 23:35:59 UTC (rev 1796) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2007-07-16 23:39:55 UTC (rev 1797) @@ -30,12 +30,15 @@ import javax.servlet.http.HttpServletRequest; +import org.apache.commons.httpclient.URIException; import org.archive.wayback.WaybackConstants; import org.archive.wayback.ResultURIConverter; +import org.archive.wayback.core.CaptureSearchResults; import org.archive.wayback.core.SearchResult; import org.archive.wayback.core.SearchResults; import org.archive.wayback.core.Timestamp; import org.archive.wayback.core.UIResults; +import org.archive.wayback.core.UrlSearchResults; import org.archive.wayback.core.WaybackRequest; /** @@ -72,7 +75,6 @@ private int curPage; private SearchResults results; - private HttpServletRequest httpRequest; private ResultURIConverter uriConverter; /** @@ -116,10 +118,25 @@ this.results = results; this.uriConverter = uriConverter; - this.httpRequest = httpRequest; } /** + * @return true if the underlying SearchResult objects contain Capture level + * data + */ + public boolean isCaptureResults() { + return (results instanceof CaptureSearchResults); + } + + /** + * @return true if the underlying SearchResult objects contain Url level + * data + */ + public boolean isUrlResults() { + return (results instanceof UrlSearchResults); + } + + /** * @return Timestamp end cutoff requested by user */ public Timestamp getEndTimestamp() { @@ -157,7 +174,7 @@ /** * @return Iterator of ResourceResults */ - public Iterator resultsIterator() { + public Iterator<SearchResult> resultsIterator() { return results.iterator(); } @@ -166,7 +183,9 @@ * @return URL string that will replay the specified Resource Result. */ public String resultToReplayUrl(SearchResult result) { - return uriConverter.makeReplayURI(result); + String url = result.getAbsoluteUrl(); + String captureDate = result.getCaptureDate(); + return uriConverter.makeReplayURI(captureDate,url); } /** @@ -177,6 +196,42 @@ } /** + * @param url + * @param timestamp + * @return String url that will replay the url at timestamp + */ + public String makeReplayUrl(String url, String timestamp) { + return uriConverter.makeReplayURI(timestamp, url); + } + + /** + * @param url + * @return String url that will make a query for all captures of an URL. + */ + public String makeCaptureQueryUrl(String url) { + WaybackRequest newWBR = wbRequest.clone(); + + newWBR.put(WaybackConstants.REQUEST_TYPE, + WaybackConstants.REQUEST_URL_QUERY); + try { + newWBR.setRequestUrl(url); + } catch (URIException e) { + // should not happen... + e.printStackTrace(); + } + return newWBR.getContextPrefix() + "query?" + + newWBR.getQueryArguments(1); + } + + /** + * @param timestamp + * @return Date for the timestamp string + */ + public Date timestampToDate(String timestamp) { + return new Timestamp(timestamp).getDate(); + } + + /** * @param result * @return Date representing captureDate of SearchResult result */ @@ -234,8 +289,7 @@ * different page of results for the same query */ public String urlForPage(int pageNum) { - //http://localhost:8080/wayback/query?q=url:peagreenboat.com%20type:urlprefixquery&count=20&start_page=4 - return httpRequest.getContextPath() + "/query?" + + return wbRequest.getContextPrefix() + "query?" + wbRequest.getQueryArguments(pageNum); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2007-08-18 00:53:22
|
Revision: 1905 http://archive-access.svn.sourceforge.net/archive-access/?rev=1905&view=rev Author: bradtofel Date: 2007-08-17 17:53:24 -0700 (Fri, 17 Aug 2007) Log Message: ----------- TWEAK: Constructor no longer throws ParseException. Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2007-08-18 00:52:02 UTC (rev 1904) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2007-08-18 00:53:24 UTC (rev 1905) @@ -87,8 +87,9 @@ * @param uriConverter * @throws ParseException */ - public UIQueryResults(HttpServletRequest httpRequest, WaybackRequest wbRequest, SearchResults results, - ResultURIConverter uriConverter) throws ParseException { + public UIQueryResults(HttpServletRequest httpRequest, + WaybackRequest wbRequest, SearchResults results, + ResultURIConverter uriConverter) { super(wbRequest); this.searchUrl = wbRequest.get(WaybackConstants.RESULT_URL); this.startTimestamp = Timestamp.parseBefore(results. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2007-08-18 00:54:12
|
Revision: 1906 http://archive-access.svn.sourceforge.net/archive-access/?rev=1906&view=rev Author: bradtofel Date: 2007-08-17 17:54:08 -0700 (Fri, 17 Aug 2007) Log Message: ----------- TWEAK: cleanup doc and import of ParseException. Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2007-08-18 00:53:24 UTC (rev 1905) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2007-08-18 00:54:08 UTC (rev 1906) @@ -24,7 +24,6 @@ */ package org.archive.wayback.query; -import java.text.ParseException; import java.util.Date; import java.util.Iterator; @@ -85,7 +84,6 @@ * @param wbRequest * @param results * @param uriConverter - * @throws ParseException */ public UIQueryResults(HttpServletRequest httpRequest, WaybackRequest wbRequest, SearchResults results, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2007-11-06 03:50:06
|
Revision: 2074 http://archive-access.svn.sourceforge.net/archive-access/?rev=2074&view=rev Author: bradtofel Date: 2007-11-05 19:50:11 -0800 (Mon, 05 Nov 2007) Log Message: ----------- BUGFIX: (unreported) parsing endTimestamp as latest possible value, instead of earliest possible value given a prefix. Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2007-11-06 03:48:56 UTC (rev 2073) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2007-11-06 03:50:11 UTC (rev 2074) @@ -92,7 +92,7 @@ this.searchUrl = wbRequest.get(WaybackConstants.RESULT_URL); this.startTimestamp = Timestamp.parseBefore(results. getFilter(WaybackConstants.REQUEST_START_DATE)); - this.endTimestamp = Timestamp.parseBefore(results.getFilter( + this.endTimestamp = Timestamp.parseAfter(results.getFilter( WaybackConstants.REQUEST_END_DATE)); this.firstResultTimestamp = Timestamp.parseBefore(results This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |