You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(10) |
Sep
(36) |
Oct
(339) |
Nov
(103) |
Dec
(152) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(141) |
Feb
(102) |
Mar
(125) |
Apr
(203) |
May
(57) |
Jun
(30) |
Jul
(139) |
Aug
(46) |
Sep
(64) |
Oct
(105) |
Nov
(34) |
Dec
(162) |
2007 |
Jan
(81) |
Feb
(57) |
Mar
(141) |
Apr
(72) |
May
(9) |
Jun
(1) |
Jul
(144) |
Aug
(88) |
Sep
(40) |
Oct
(43) |
Nov
(34) |
Dec
(20) |
2008 |
Jan
(44) |
Feb
(45) |
Mar
(16) |
Apr
(36) |
May
(8) |
Jun
(77) |
Jul
(177) |
Aug
(66) |
Sep
(8) |
Oct
(33) |
Nov
(13) |
Dec
(37) |
2009 |
Jan
(2) |
Feb
(5) |
Mar
(8) |
Apr
|
May
(36) |
Jun
(19) |
Jul
(46) |
Aug
(8) |
Sep
(1) |
Oct
(66) |
Nov
(61) |
Dec
(10) |
2010 |
Jan
(13) |
Feb
(16) |
Mar
(38) |
Apr
(76) |
May
(47) |
Jun
(32) |
Jul
(35) |
Aug
(45) |
Sep
(20) |
Oct
(61) |
Nov
(24) |
Dec
(16) |
2011 |
Jan
(22) |
Feb
(34) |
Mar
(11) |
Apr
(8) |
May
(24) |
Jun
(23) |
Jul
(11) |
Aug
(42) |
Sep
(81) |
Oct
(48) |
Nov
(21) |
Dec
(20) |
2012 |
Jan
(30) |
Feb
(25) |
Mar
(4) |
Apr
(6) |
May
(1) |
Jun
(5) |
Jul
(5) |
Aug
(8) |
Sep
(6) |
Oct
(6) |
Nov
|
Dec
|
From: <bra...@us...> - 2010-08-16 23:00:43
|
Revision: 3230 http://archive-access.svn.sourceforge.net/archive-access/?rev=3230&view=rev Author: bradtofel Date: 2010-08-16 23:00:36 +0000 (Mon, 16 Aug 2010) Log Message: ----------- REFACTOR: changing names of RequestParser subclasses Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoRequestParser.java Added Paths: ----------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleRequestParser.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeGateRequestParser.java Removed Paths: ------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoParser.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleParser.java Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoParser.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoParser.java 2010-08-16 22:57:47 UTC (rev 3229) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoParser.java 2010-08-16 23:00:36 UTC (rev 3230) @@ -1,157 +0,0 @@ -package org.archive.wayback.memento; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.log4j.Logger; -import org.archive.wayback.core.WaybackRequest; -import org.archive.wayback.exception.BadQueryException; -import org.archive.wayback.exception.BetterRequestException; -import org.archive.wayback.requestparser.BaseRequestParser; -import org.archive.wayback.requestparser.WrappedRequestParser; -import org.archive.wayback.webapp.AccessPoint; - -/** - * RequestParser subclass which matches ".../timegate/URL" requests, and parses - * the Accept-Datetime header - * - * @author Lyudmila Balakireva - * - */ -public class MementoParser extends WrappedRequestParser { - private static final Logger LOGGER = - Logger.getLogger(MementoParser.class.getName()); - - String DTHEADER = "Accept-Datetime"; - - List<SimpleDateFormat> dtsupportedformats = - new ArrayList<SimpleDateFormat>(); - - String MEMENTO_BASE = "timegate"; - - /** - * @param wrapped - * BaseRequestParser with configuration - */ - public MementoParser(BaseRequestParser wrapped) { - super(wrapped); - - dtsupportedformats - .add(new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z")); - dtsupportedformats.add(new SimpleDateFormat("E, dd MMM yyyy Z")); - dtsupportedformats.add(new SimpleDateFormat("E, dd MMM yyyy")); - } - - @Override - public WaybackRequest parse(HttpServletRequest httpRequest, - AccessPoint accessPoint) throws BadQueryException, - BetterRequestException { - - String base = accessPoint.translateRequestPath(httpRequest); - String requestPath = accessPoint.translateRequestPathQuery(httpRequest); - - LOGGER.trace("requestPath:" + requestPath); - if (base.startsWith(MEMENTO_BASE)) { - - // strip leading "timegate/": - String urlStr = base.substring(requestPath.indexOf("/") + 1); - - // get the "Accept-Datetime" header: - String httpdate = getHttpDate(httpRequest); - Date dtconnegdate = null; - if (httpdate != null) { - dtconnegdate = checkDateValidity(httpdate, dtsupportedformats); - if (dtconnegdate == null) { - return null; - } - } else { - // TODO: should this return null her? no header.. - } - - WaybackRequest wbRequest = new WaybackRequest(); - if (wbRequest.getStartTimestamp() == null) { - wbRequest.setStartTimestamp(getEarliestTimestamp()); - } - if (dtconnegdate != null) { - wbRequest.setAnchorDate(dtconnegdate); - } else { - wbRequest.setAnchorTimestamp(getLatestTimestamp()); - } - - wbRequest.put("dtconneg", httpdate); - - if (wbRequest.getEndTimestamp() == null) { - wbRequest.setEndTimestamp(getLatestTimestamp()); - } - wbRequest.setCaptureQueryRequest(); - wbRequest.setRequestUrl(urlStr); - if (wbRequest != null) { - wbRequest.setResultsPerPage(getMaxRecords()); - } - return wbRequest; - } - return null; - } - - /** - * Extract the value of the "Accept-Datetime" HTTP request header, if - * present, and further strips the date value from any surrounding "{","}" - * @param req HttpServletRequest for this request - * @return the raw String containing the date information, or null if no - * such HTTP header exists. - */ - public String getHttpDate(HttpServletRequest req) { - String httpdate = req.getHeader(DTHEADER); - - if (httpdate != null) { - int j = httpdate.indexOf("{", 0); - - if (j >= 0) { - - httpdate = httpdate.substring(httpdate.indexOf("{", 0) + 1); - - } - - if (httpdate.indexOf("}") > 0) { - httpdate = httpdate.substring(0, httpdate.indexOf("}")); - - } - } - return httpdate; - } - - /** - * Attempt to parse the String httpdate argument using one of the - * SimpleDateFormats provided. - * - * @param httpdate - * String version of a Date - * @param list - * of SimpleDateFormats to parse the httpdate - * @return Date object set to the time parsed, or null if not parsed - */ - public Date checkDateValidity(String httpdate, List<SimpleDateFormat> list) { - - Date d = null; - Iterator<SimpleDateFormat> it = list.iterator(); - while (it.hasNext()) { - SimpleDateFormat formatter = it.next(); - try { - - d = formatter.parse(httpdate); - break; - - } catch (Exception e) { - e.printStackTrace(); - } - - } - - return d; - } -} Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoRequestParser.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoRequestParser.java 2010-08-16 22:57:47 UTC (rev 3229) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoRequestParser.java 2010-08-16 23:00:36 UTC (rev 3230) @@ -44,8 +44,8 @@ protected RequestParser[] getRequestParsers() { RequestParser[] theParsers = { new ReplayRequestParser(this), - new MementoParser(this), - new TimeBundleParser(this), + new TimeGateRequestParser(this), + new TimeBundleRequestParser(this), new PathDatePrefixQueryRequestParser(this), new PathDateRangeQueryRequestParser(this), new PathPrefixDatePrefixQueryRequestParser(this), Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleParser.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleParser.java 2010-08-16 22:57:47 UTC (rev 3229) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleParser.java 2010-08-16 23:00:36 UTC (rev 3230) @@ -1,90 +0,0 @@ -package org.archive.wayback.memento; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.log4j.Logger; -import org.archive.wayback.core.WaybackRequest; -import org.archive.wayback.exception.BadQueryException; -import org.archive.wayback.exception.BetterRequestException; -import org.archive.wayback.requestparser.BaseRequestParser; -import org.archive.wayback.requestparser.WrappedRequestParser; -import org.archive.wayback.webapp.AccessPoint; - -/** - * RequestParser subclass which parses "timebundle/URL" and - * "timemap/FORMAT/URL" requests - * - * @author Lyudmila Balakireva - * - */ -public class TimeBundleParser extends WrappedRequestParser { - private static final Logger LOGGER = - Logger.getLogger(TimeBundleParser.class.getName()); - - String MEMENTO_BASE = "timegate"; - - /** - * @param wrapped BaseRequestParser holding config - */ - public TimeBundleParser(BaseRequestParser wrapped) { - super(wrapped); - } - - @Override - public WaybackRequest parse(HttpServletRequest httpRequest, - AccessPoint accessPoint) throws BadQueryException, - BetterRequestException { - - String requestPath = accessPoint.translateRequestPathQuery(httpRequest); - LOGGER.trace("requestpath:" + requestPath); - - if (requestPath.startsWith("timebundle")) { - - WaybackRequest wbRequest = new WaybackRequest(); - String urlStr = requestPath.substring(requestPath.indexOf("/") + 1); - if (wbRequest.getStartTimestamp() == null) { - wbRequest.setStartTimestamp(getEarliestTimestamp()); - } - if (wbRequest.getEndTimestamp() == null) { - wbRequest.setEndTimestamp(getLatestTimestamp()); - } - wbRequest.setCaptureQueryRequest(); - wbRequest.setRequestUrl(urlStr); - - // TODO: is it critical to return a 303 code, or will a 302 do? - // if so, this and ORE.jsp can be simplified by throwing a - // BetterRequestException here. - wbRequest.put("redirect", "true"); - return wbRequest; - } - - if (requestPath.startsWith("timemap")) { - - String urlStrplus = requestPath - .substring(requestPath.indexOf("/") + 1); - String format = urlStrplus.substring(0, urlStrplus.indexOf("/")); - - LOGGER.trace("format:" + format); - String urlStr = urlStrplus.substring(urlStrplus.indexOf("/") + 1); - LOGGER.trace("id:" + urlStr); - WaybackRequest wbRequest = new WaybackRequest(); - if (wbRequest.getStartTimestamp() == null) { - wbRequest.setStartTimestamp(getEarliestTimestamp()); - } - wbRequest.setAnchorTimestamp(getLatestTimestamp()); - wbRequest.put("format", format); - if (wbRequest.getEndTimestamp() == null) { - wbRequest.setEndTimestamp(getLatestTimestamp()); - } - wbRequest.setCaptureQueryRequest(); - wbRequest.setRequestUrl(urlStr); - if (wbRequest != null) { - wbRequest.setResultsPerPage(getMaxRecords()); - } - return wbRequest; - - } - return null; - } - -} Copied: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleRequestParser.java (from rev 3229, trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleParser.java) =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleRequestParser.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleRequestParser.java 2010-08-16 23:00:36 UTC (rev 3230) @@ -0,0 +1,90 @@ +package org.archive.wayback.memento; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.log4j.Logger; +import org.archive.wayback.core.WaybackRequest; +import org.archive.wayback.exception.BadQueryException; +import org.archive.wayback.exception.BetterRequestException; +import org.archive.wayback.requestparser.BaseRequestParser; +import org.archive.wayback.requestparser.WrappedRequestParser; +import org.archive.wayback.webapp.AccessPoint; + +/** + * RequestParser subclass which parses "timebundle/URL" and + * "timemap/FORMAT/URL" requests + * + * @author Lyudmila Balakireva + * + */ +public class TimeBundleRequestParser extends WrappedRequestParser { + private static final Logger LOGGER = + Logger.getLogger(TimeBundleRequestParser.class.getName()); + + String MEMENTO_BASE = "timegate"; + + /** + * @param wrapped BaseRequestParser holding config + */ + public TimeBundleRequestParser(BaseRequestParser wrapped) { + super(wrapped); + } + + @Override + public WaybackRequest parse(HttpServletRequest httpRequest, + AccessPoint accessPoint) throws BadQueryException, + BetterRequestException { + + String requestPath = accessPoint.translateRequestPathQuery(httpRequest); + LOGGER.trace("requestpath:" + requestPath); + + if (requestPath.startsWith("timebundle")) { + + WaybackRequest wbRequest = new WaybackRequest(); + String urlStr = requestPath.substring(requestPath.indexOf("/") + 1); + if (wbRequest.getStartTimestamp() == null) { + wbRequest.setStartTimestamp(getEarliestTimestamp()); + } + if (wbRequest.getEndTimestamp() == null) { + wbRequest.setEndTimestamp(getLatestTimestamp()); + } + wbRequest.setCaptureQueryRequest(); + wbRequest.setRequestUrl(urlStr); + + // TODO: is it critical to return a 303 code, or will a 302 do? + // if so, this and ORE.jsp can be simplified by throwing a + // BetterRequestException here. + wbRequest.put("redirect", "true"); + return wbRequest; + } + + if (requestPath.startsWith("timemap")) { + + String urlStrplus = requestPath + .substring(requestPath.indexOf("/") + 1); + String format = urlStrplus.substring(0, urlStrplus.indexOf("/")); + + LOGGER.trace("format:" + format); + String urlStr = urlStrplus.substring(urlStrplus.indexOf("/") + 1); + LOGGER.trace("id:" + urlStr); + WaybackRequest wbRequest = new WaybackRequest(); + if (wbRequest.getStartTimestamp() == null) { + wbRequest.setStartTimestamp(getEarliestTimestamp()); + } + wbRequest.setAnchorTimestamp(getLatestTimestamp()); + wbRequest.put("format", format); + if (wbRequest.getEndTimestamp() == null) { + wbRequest.setEndTimestamp(getLatestTimestamp()); + } + wbRequest.setCaptureQueryRequest(); + wbRequest.setRequestUrl(urlStr); + if (wbRequest != null) { + wbRequest.setResultsPerPage(getMaxRecords()); + } + return wbRequest; + + } + return null; + } + +} Copied: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeGateRequestParser.java (from rev 3229, trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoParser.java) =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeGateRequestParser.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeGateRequestParser.java 2010-08-16 23:00:36 UTC (rev 3230) @@ -0,0 +1,157 @@ +package org.archive.wayback.memento; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.log4j.Logger; +import org.archive.wayback.core.WaybackRequest; +import org.archive.wayback.exception.BadQueryException; +import org.archive.wayback.exception.BetterRequestException; +import org.archive.wayback.requestparser.BaseRequestParser; +import org.archive.wayback.requestparser.WrappedRequestParser; +import org.archive.wayback.webapp.AccessPoint; + +/** + * RequestParser subclass which matches ".../timegate/URL" requests, and parses + * the Accept-Datetime header + * + * @author Lyudmila Balakireva + * + */ +public class TimeGateRequestParser extends WrappedRequestParser { + private static final Logger LOGGER = + Logger.getLogger(TimeGateRequestParser.class.getName()); + + String DTHEADER = "Accept-Datetime"; + + List<SimpleDateFormat> dtsupportedformats = + new ArrayList<SimpleDateFormat>(); + + String MEMENTO_BASE = "timegate"; + + /** + * @param wrapped + * BaseRequestParser with configuration + */ + public TimeGateRequestParser(BaseRequestParser wrapped) { + super(wrapped); + + dtsupportedformats + .add(new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z")); + dtsupportedformats.add(new SimpleDateFormat("E, dd MMM yyyy Z")); + dtsupportedformats.add(new SimpleDateFormat("E, dd MMM yyyy")); + } + + @Override + public WaybackRequest parse(HttpServletRequest httpRequest, + AccessPoint accessPoint) throws BadQueryException, + BetterRequestException { + + String base = accessPoint.translateRequestPath(httpRequest); + String requestPath = accessPoint.translateRequestPathQuery(httpRequest); + + LOGGER.trace("requestPath:" + requestPath); + if (base.startsWith(MEMENTO_BASE)) { + + // strip leading "timegate/": + String urlStr = base.substring(requestPath.indexOf("/") + 1); + + // get the "Accept-Datetime" header: + String httpdate = getHttpDate(httpRequest); + Date dtconnegdate = null; + if (httpdate != null) { + dtconnegdate = checkDateValidity(httpdate, dtsupportedformats); + if (dtconnegdate == null) { + return null; + } + } else { + // TODO: should this return null her? no header.. + } + + WaybackRequest wbRequest = new WaybackRequest(); + if (wbRequest.getStartTimestamp() == null) { + wbRequest.setStartTimestamp(getEarliestTimestamp()); + } + if (dtconnegdate != null) { + wbRequest.setAnchorDate(dtconnegdate); + } else { + wbRequest.setAnchorTimestamp(getLatestTimestamp()); + } + + wbRequest.put("dtconneg", httpdate); + + if (wbRequest.getEndTimestamp() == null) { + wbRequest.setEndTimestamp(getLatestTimestamp()); + } + wbRequest.setCaptureQueryRequest(); + wbRequest.setRequestUrl(urlStr); + if (wbRequest != null) { + wbRequest.setResultsPerPage(getMaxRecords()); + } + return wbRequest; + } + return null; + } + + /** + * Extract the value of the "Accept-Datetime" HTTP request header, if + * present, and further strips the date value from any surrounding "{","}" + * @param req HttpServletRequest for this request + * @return the raw String containing the date information, or null if no + * such HTTP header exists. + */ + public String getHttpDate(HttpServletRequest req) { + String httpdate = req.getHeader(DTHEADER); + + if (httpdate != null) { + int j = httpdate.indexOf("{", 0); + + if (j >= 0) { + + httpdate = httpdate.substring(httpdate.indexOf("{", 0) + 1); + + } + + if (httpdate.indexOf("}") > 0) { + httpdate = httpdate.substring(0, httpdate.indexOf("}")); + + } + } + return httpdate; + } + + /** + * Attempt to parse the String httpdate argument using one of the + * SimpleDateFormats provided. + * + * @param httpdate + * String version of a Date + * @param list + * of SimpleDateFormats to parse the httpdate + * @return Date object set to the time parsed, or null if not parsed + */ + public Date checkDateValidity(String httpdate, List<SimpleDateFormat> list) { + + Date d = null; + Iterator<SimpleDateFormat> it = list.iterator(); + while (it.hasNext()) { + SimpleDateFormat formatter = it.next(); + try { + + d = formatter.parse(httpdate); + break; + + } catch (Exception e) { + e.printStackTrace(); + } + + } + + return d; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-16 22:57:56
|
Revision: 3229 http://archive-access.svn.sourceforge.net/archive-access/?rev=3229&view=rev Author: bradtofel Date: 2010-08-16 22:57:47 +0000 (Mon, 16 Aug 2010) Log Message: ----------- REFACTOR: moving Memento stuff into it's own package -- it's really a new Replay format, so like archivalurl and proxy mode, should have it's own package. Added Paths: ----------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoHTMLReplayRenderer.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoParser.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoRequestParser.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleParser.java Removed Paths: ------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/requestparser/MementoParser.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/requestparser/TimeBundleParser.java Added: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoHTMLReplayRenderer.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoHTMLReplayRenderer.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoHTMLReplayRenderer.java 2010-08-16 22:57:47 UTC (rev 3229) @@ -0,0 +1,97 @@ +/* MementoHTMLReplayRenderer + * + * $Id$ + * + * Created on 2:23:03 PM Jul 18, 2008. + * + * Copyright (C) 2008 Internet Archive. + * + * This file is part of wayback. + * + * wayback is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * wayback is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with wayback; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package org.archive.wayback.memento; + +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.archive.wayback.ResultURIConverter; +import org.archive.wayback.core.CaptureSearchResult; +import org.archive.wayback.core.CaptureSearchResults; +import org.archive.wayback.core.Resource; +import org.archive.wayback.core.WaybackRequest; +import org.archive.wayback.replay.TextDocument; +import org.archive.wayback.replay.TextReplayRenderer; +import org.archive.wayback.replay.HttpHeaderProcessor; + +/** + * + * + * @author brad + * @version $Date$, $Revision$ + */ +public class MementoHTMLReplayRenderer extends TextReplayRenderer { + /** + * @param httpHeaderProcessor + */ + public MementoHTMLReplayRenderer(HttpHeaderProcessor httpHeaderProcessor) { + super(httpHeaderProcessor); + } + + /* (non-Javadoc) + * @see org.archive.wayback.replay.HTMLReplayRenderer#updatePage(org.archive.wayback.replay.HTMLPage, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.archive.wayback.core.WaybackRequest, org.archive.wayback.core.CaptureSearchResult, org.archive.wayback.core.Resource, org.archive.wayback.ResultURIConverter, org.archive.wayback.core.CaptureSearchResults) + */ + @Override + protected void updatePage(TextDocument page, HttpServletRequest httpRequest, + HttpServletResponse httpResponse, WaybackRequest wbRequest, + CaptureSearchResult result, Resource resource, + ResultURIConverter uriConverter, CaptureSearchResults results) + throws ServletException, IOException { + + List<String> jspInserts = getJspInserts(); + + StringBuilder toInsert = new StringBuilder(300); + + /* + * URLs have to resolve as they did originally: + * + * * absolute URLs are fine as-is + * + * * page-relative and server-relative URLs have to resolve against + * the page's original URL, not where ever it is being served from + * now. Hopefully, this can be accomplished by adding a + * <BASE href="XXX"> + * with the original page URL unless the page contains one + * already.. + */ + page.addBase(); + + if(jspInserts != null) { + Iterator<String> itr = jspInserts.iterator(); + while(itr.hasNext()) { + toInsert.append(page.includeJspString(itr.next(), httpRequest, + httpResponse, wbRequest, results, result, resource)); + } + } + + // insert the new content: + page.insertAtEndOfBody(toInsert.toString()); + } +} Property changes on: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoHTMLReplayRenderer.java ___________________________________________________________________ Added: svn:keywords + Author Date Revision Id Copied: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoParser.java (from rev 3191, trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/requestparser/MementoParser.java) =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoParser.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoParser.java 2010-08-16 22:57:47 UTC (rev 3229) @@ -0,0 +1,157 @@ +package org.archive.wayback.memento; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.log4j.Logger; +import org.archive.wayback.core.WaybackRequest; +import org.archive.wayback.exception.BadQueryException; +import org.archive.wayback.exception.BetterRequestException; +import org.archive.wayback.requestparser.BaseRequestParser; +import org.archive.wayback.requestparser.WrappedRequestParser; +import org.archive.wayback.webapp.AccessPoint; + +/** + * RequestParser subclass which matches ".../timegate/URL" requests, and parses + * the Accept-Datetime header + * + * @author Lyudmila Balakireva + * + */ +public class MementoParser extends WrappedRequestParser { + private static final Logger LOGGER = + Logger.getLogger(MementoParser.class.getName()); + + String DTHEADER = "Accept-Datetime"; + + List<SimpleDateFormat> dtsupportedformats = + new ArrayList<SimpleDateFormat>(); + + String MEMENTO_BASE = "timegate"; + + /** + * @param wrapped + * BaseRequestParser with configuration + */ + public MementoParser(BaseRequestParser wrapped) { + super(wrapped); + + dtsupportedformats + .add(new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z")); + dtsupportedformats.add(new SimpleDateFormat("E, dd MMM yyyy Z")); + dtsupportedformats.add(new SimpleDateFormat("E, dd MMM yyyy")); + } + + @Override + public WaybackRequest parse(HttpServletRequest httpRequest, + AccessPoint accessPoint) throws BadQueryException, + BetterRequestException { + + String base = accessPoint.translateRequestPath(httpRequest); + String requestPath = accessPoint.translateRequestPathQuery(httpRequest); + + LOGGER.trace("requestPath:" + requestPath); + if (base.startsWith(MEMENTO_BASE)) { + + // strip leading "timegate/": + String urlStr = base.substring(requestPath.indexOf("/") + 1); + + // get the "Accept-Datetime" header: + String httpdate = getHttpDate(httpRequest); + Date dtconnegdate = null; + if (httpdate != null) { + dtconnegdate = checkDateValidity(httpdate, dtsupportedformats); + if (dtconnegdate == null) { + return null; + } + } else { + // TODO: should this return null her? no header.. + } + + WaybackRequest wbRequest = new WaybackRequest(); + if (wbRequest.getStartTimestamp() == null) { + wbRequest.setStartTimestamp(getEarliestTimestamp()); + } + if (dtconnegdate != null) { + wbRequest.setAnchorDate(dtconnegdate); + } else { + wbRequest.setAnchorTimestamp(getLatestTimestamp()); + } + + wbRequest.put("dtconneg", httpdate); + + if (wbRequest.getEndTimestamp() == null) { + wbRequest.setEndTimestamp(getLatestTimestamp()); + } + wbRequest.setCaptureQueryRequest(); + wbRequest.setRequestUrl(urlStr); + if (wbRequest != null) { + wbRequest.setResultsPerPage(getMaxRecords()); + } + return wbRequest; + } + return null; + } + + /** + * Extract the value of the "Accept-Datetime" HTTP request header, if + * present, and further strips the date value from any surrounding "{","}" + * @param req HttpServletRequest for this request + * @return the raw String containing the date information, or null if no + * such HTTP header exists. + */ + public String getHttpDate(HttpServletRequest req) { + String httpdate = req.getHeader(DTHEADER); + + if (httpdate != null) { + int j = httpdate.indexOf("{", 0); + + if (j >= 0) { + + httpdate = httpdate.substring(httpdate.indexOf("{", 0) + 1); + + } + + if (httpdate.indexOf("}") > 0) { + httpdate = httpdate.substring(0, httpdate.indexOf("}")); + + } + } + return httpdate; + } + + /** + * Attempt to parse the String httpdate argument using one of the + * SimpleDateFormats provided. + * + * @param httpdate + * String version of a Date + * @param list + * of SimpleDateFormats to parse the httpdate + * @return Date object set to the time parsed, or null if not parsed + */ + public Date checkDateValidity(String httpdate, List<SimpleDateFormat> list) { + + Date d = null; + Iterator<SimpleDateFormat> it = list.iterator(); + while (it.hasNext()) { + SimpleDateFormat formatter = it.next(); + try { + + d = formatter.parse(httpdate); + break; + + } catch (Exception e) { + e.printStackTrace(); + } + + } + + return d; + } +} Added: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoRequestParser.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoRequestParser.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoRequestParser.java 2010-08-16 22:57:47 UTC (rev 3229) @@ -0,0 +1,59 @@ +/* MementoRequestParser + * + * $Id$: + * + * Created on Aug 16, 2010. + * + * Copyright (C) 2006 Internet Archive. + * + * This file is part of Wayback. + * + * Wayback is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * Wayback is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with Wayback; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package org.archive.wayback.memento; + +import org.archive.wayback.RequestParser; +import org.archive.wayback.archivalurl.ArchivalUrlRequestParser; +import org.archive.wayback.archivalurl.requestparser.ArchivalUrlFormRequestParser; +import org.archive.wayback.archivalurl.requestparser.DatelessReplayRequestParser; +import org.archive.wayback.archivalurl.requestparser.PathDatePrefixQueryRequestParser; +import org.archive.wayback.archivalurl.requestparser.PathDateRangeQueryRequestParser; +import org.archive.wayback.archivalurl.requestparser.PathPrefixDatePrefixQueryRequestParser; +import org.archive.wayback.archivalurl.requestparser.PathPrefixDateRangeQueryRequestParser; +import org.archive.wayback.archivalurl.requestparser.ReplayRequestParser; +import org.archive.wayback.requestparser.OpenSearchRequestParser; + +/** + * @author brad + * + */ +public class MementoRequestParser extends ArchivalUrlRequestParser { + protected RequestParser[] getRequestParsers() { + RequestParser[] theParsers = { + new ReplayRequestParser(this), + new MementoParser(this), + new TimeBundleParser(this), + new PathDatePrefixQueryRequestParser(this), + new PathDateRangeQueryRequestParser(this), + new PathPrefixDatePrefixQueryRequestParser(this), + new PathPrefixDateRangeQueryRequestParser(this), + new OpenSearchRequestParser(this), + new ArchivalUrlFormRequestParser(this), + new DatelessReplayRequestParser(this) + }; + return theParsers; + } +} Property changes on: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/MementoRequestParser.java ___________________________________________________________________ Added: svn:keywords + Author Date Revision Id Copied: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleParser.java (from rev 3191, trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/requestparser/TimeBundleParser.java) =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleParser.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/memento/TimeBundleParser.java 2010-08-16 22:57:47 UTC (rev 3229) @@ -0,0 +1,90 @@ +package org.archive.wayback.memento; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.log4j.Logger; +import org.archive.wayback.core.WaybackRequest; +import org.archive.wayback.exception.BadQueryException; +import org.archive.wayback.exception.BetterRequestException; +import org.archive.wayback.requestparser.BaseRequestParser; +import org.archive.wayback.requestparser.WrappedRequestParser; +import org.archive.wayback.webapp.AccessPoint; + +/** + * RequestParser subclass which parses "timebundle/URL" and + * "timemap/FORMAT/URL" requests + * + * @author Lyudmila Balakireva + * + */ +public class TimeBundleParser extends WrappedRequestParser { + private static final Logger LOGGER = + Logger.getLogger(TimeBundleParser.class.getName()); + + String MEMENTO_BASE = "timegate"; + + /** + * @param wrapped BaseRequestParser holding config + */ + public TimeBundleParser(BaseRequestParser wrapped) { + super(wrapped); + } + + @Override + public WaybackRequest parse(HttpServletRequest httpRequest, + AccessPoint accessPoint) throws BadQueryException, + BetterRequestException { + + String requestPath = accessPoint.translateRequestPathQuery(httpRequest); + LOGGER.trace("requestpath:" + requestPath); + + if (requestPath.startsWith("timebundle")) { + + WaybackRequest wbRequest = new WaybackRequest(); + String urlStr = requestPath.substring(requestPath.indexOf("/") + 1); + if (wbRequest.getStartTimestamp() == null) { + wbRequest.setStartTimestamp(getEarliestTimestamp()); + } + if (wbRequest.getEndTimestamp() == null) { + wbRequest.setEndTimestamp(getLatestTimestamp()); + } + wbRequest.setCaptureQueryRequest(); + wbRequest.setRequestUrl(urlStr); + + // TODO: is it critical to return a 303 code, or will a 302 do? + // if so, this and ORE.jsp can be simplified by throwing a + // BetterRequestException here. + wbRequest.put("redirect", "true"); + return wbRequest; + } + + if (requestPath.startsWith("timemap")) { + + String urlStrplus = requestPath + .substring(requestPath.indexOf("/") + 1); + String format = urlStrplus.substring(0, urlStrplus.indexOf("/")); + + LOGGER.trace("format:" + format); + String urlStr = urlStrplus.substring(urlStrplus.indexOf("/") + 1); + LOGGER.trace("id:" + urlStr); + WaybackRequest wbRequest = new WaybackRequest(); + if (wbRequest.getStartTimestamp() == null) { + wbRequest.setStartTimestamp(getEarliestTimestamp()); + } + wbRequest.setAnchorTimestamp(getLatestTimestamp()); + wbRequest.put("format", format); + if (wbRequest.getEndTimestamp() == null) { + wbRequest.setEndTimestamp(getLatestTimestamp()); + } + wbRequest.setCaptureQueryRequest(); + wbRequest.setRequestUrl(urlStr); + if (wbRequest != null) { + wbRequest.setResultsPerPage(getMaxRecords()); + } + return wbRequest; + + } + return null; + } + +} Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/requestparser/MementoParser.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/requestparser/MementoParser.java 2010-08-10 23:27:47 UTC (rev 3228) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/requestparser/MementoParser.java 2010-08-16 22:57:47 UTC (rev 3229) @@ -1,155 +0,0 @@ -package org.archive.wayback.requestparser; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.log4j.Logger; -import org.archive.wayback.core.WaybackRequest; -import org.archive.wayback.exception.BadQueryException; -import org.archive.wayback.exception.BetterRequestException; -import org.archive.wayback.webapp.AccessPoint; - -/** - * RequestParser subclass which matches ".../timegate/URL" requests, and parses - * the Accept-Datetime header - * - * @author Lyudmila Balakireva - * - */ -public class MementoParser extends WrappedRequestParser { - private static final Logger LOGGER = - Logger.getLogger(MementoParser.class.getName()); - - String DTHEADER = "Accept-Datetime"; - - List<SimpleDateFormat> dtsupportedformats = - new ArrayList<SimpleDateFormat>(); - - String MEMENTO_BASE = "timegate"; - - /** - * @param wrapped - * BaseRequestParser with configuration - */ - public MementoParser(BaseRequestParser wrapped) { - super(wrapped); - - dtsupportedformats - .add(new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z")); - dtsupportedformats.add(new SimpleDateFormat("E, dd MMM yyyy Z")); - dtsupportedformats.add(new SimpleDateFormat("E, dd MMM yyyy")); - } - - @Override - public WaybackRequest parse(HttpServletRequest httpRequest, - AccessPoint accessPoint) throws BadQueryException, - BetterRequestException { - - String base = accessPoint.translateRequestPath(httpRequest); - String requestPath = accessPoint.translateRequestPathQuery(httpRequest); - - LOGGER.trace("requestPath:" + requestPath); - if (base.startsWith(MEMENTO_BASE)) { - - // strip leading "timegate/": - String urlStr = base.substring(requestPath.indexOf("/") + 1); - - // get the "Accept-Datetime" header: - String httpdate = getHttpDate(httpRequest); - Date dtconnegdate = null; - if (httpdate != null) { - dtconnegdate = checkDateValidity(httpdate, dtsupportedformats); - if (dtconnegdate == null) { - return null; - } - } else { - // TODO: should this return null her? no header.. - } - - WaybackRequest wbRequest = new WaybackRequest(); - if (wbRequest.getStartTimestamp() == null) { - wbRequest.setStartTimestamp(getEarliestTimestamp()); - } - if (dtconnegdate != null) { - wbRequest.setAnchorDate(dtconnegdate); - } else { - wbRequest.setAnchorTimestamp(getLatestTimestamp()); - } - - wbRequest.put("dtconneg", httpdate); - - if (wbRequest.getEndTimestamp() == null) { - wbRequest.setEndTimestamp(getLatestTimestamp()); - } - wbRequest.setCaptureQueryRequest(); - wbRequest.setRequestUrl(urlStr); - if (wbRequest != null) { - wbRequest.setResultsPerPage(getMaxRecords()); - } - return wbRequest; - } - return null; - } - - /** - * Extract the value of the "Accept-Datetime" HTTP request header, if - * present, and further strips the date value from any surrounding "{","}" - * @param req HttpServletRequest for this request - * @return the raw String containing the date information, or null if no - * such HTTP header exists. - */ - public String getHttpDate(HttpServletRequest req) { - String httpdate = req.getHeader(DTHEADER); - - if (httpdate != null) { - int j = httpdate.indexOf("{", 0); - - if (j >= 0) { - - httpdate = httpdate.substring(httpdate.indexOf("{", 0) + 1); - - } - - if (httpdate.indexOf("}") > 0) { - httpdate = httpdate.substring(0, httpdate.indexOf("}")); - - } - } - return httpdate; - } - - /** - * Attempt to parse the String httpdate argument using one of the - * SimpleDateFormats provided. - * - * @param httpdate - * String version of a Date - * @param list - * of SimpleDateFormats to parse the httpdate - * @return Date object set to the time parsed, or null if not parsed - */ - public Date checkDateValidity(String httpdate, List<SimpleDateFormat> list) { - - Date d = null; - Iterator<SimpleDateFormat> it = list.iterator(); - while (it.hasNext()) { - SimpleDateFormat formatter = it.next(); - try { - - d = formatter.parse(httpdate); - break; - - } catch (Exception e) { - e.printStackTrace(); - } - - } - - return d; - } -} Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/requestparser/TimeBundleParser.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/requestparser/TimeBundleParser.java 2010-08-10 23:27:47 UTC (rev 3228) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/requestparser/TimeBundleParser.java 2010-08-16 22:57:47 UTC (rev 3229) @@ -1,88 +0,0 @@ -package org.archive.wayback.requestparser; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.log4j.Logger; -import org.archive.wayback.core.WaybackRequest; -import org.archive.wayback.exception.BadQueryException; -import org.archive.wayback.exception.BetterRequestException; -import org.archive.wayback.webapp.AccessPoint; - -/** - * RequestParser subclass which parses "timebundle/URL" and - * "timemap/FORMAT/URL" requests - * - * @author Lyudmila Balakireva - * - */ -public class TimeBundleParser extends WrappedRequestParser { - private static final Logger LOGGER = - Logger.getLogger(TimeBundleParser.class.getName()); - - String MEMENTO_BASE = "timegate"; - - /** - * @param wrapped BaseRequestParser holding config - */ - public TimeBundleParser(BaseRequestParser wrapped) { - super(wrapped); - } - - @Override - public WaybackRequest parse(HttpServletRequest httpRequest, - AccessPoint accessPoint) throws BadQueryException, - BetterRequestException { - - String requestPath = accessPoint.translateRequestPathQuery(httpRequest); - LOGGER.trace("requestpath:" + requestPath); - - if (requestPath.startsWith("timebundle")) { - - WaybackRequest wbRequest = new WaybackRequest(); - String urlStr = requestPath.substring(requestPath.indexOf("/") + 1); - if (wbRequest.getStartTimestamp() == null) { - wbRequest.setStartTimestamp(getEarliestTimestamp()); - } - if (wbRequest.getEndTimestamp() == null) { - wbRequest.setEndTimestamp(getLatestTimestamp()); - } - wbRequest.setCaptureQueryRequest(); - wbRequest.setRequestUrl(urlStr); - - // TODO: is it critical to return a 303 code, or will a 302 do? - // if so, this and ORE.jsp can be simplified by throwing a - // BetterRequestException here. - wbRequest.put("redirect", "true"); - return wbRequest; - } - - if (requestPath.startsWith("timemap")) { - - String urlStrplus = requestPath - .substring(requestPath.indexOf("/") + 1); - String format = urlStrplus.substring(0, urlStrplus.indexOf("/")); - - LOGGER.trace("format:" + format); - String urlStr = urlStrplus.substring(urlStrplus.indexOf("/") + 1); - LOGGER.trace("id:" + urlStr); - WaybackRequest wbRequest = new WaybackRequest(); - if (wbRequest.getStartTimestamp() == null) { - wbRequest.setStartTimestamp(getEarliestTimestamp()); - } - wbRequest.setAnchorTimestamp(getLatestTimestamp()); - wbRequest.put("format", format); - if (wbRequest.getEndTimestamp() == null) { - wbRequest.setEndTimestamp(getLatestTimestamp()); - } - wbRequest.setCaptureQueryRequest(); - wbRequest.setRequestUrl(urlStr); - if (wbRequest != null) { - wbRequest.setResultsPerPage(getMaxRecords()); - } - return wbRequest; - - } - return null; - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-10 23:27:53
|
Revision: 3228 http://archive-access.svn.sourceforge.net/archive-access/?rev=3228&view=rev Author: bradtofel Date: 2010-08-10 23:27:47 +0000 (Tue, 10 Aug 2010) Log Message: ----------- TWEAK: added "nomonth=1" to graph CGI args TWEAK: set HREF on graph Anchor, to prevent occasional graph image alignment problems on some browsers. Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/BubbleCalendar.jsp Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/BubbleCalendar.jsp =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/BubbleCalendar.jsp 2010-08-10 23:26:30 UTC (rev 3227) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/BubbleCalendar.jsp 2010-08-10 23:27:47 UTC (rev 3228) @@ -41,7 +41,7 @@ BubbleCalendarData data = new BubbleCalendarData(results); String yearEncoded = data.getYearsGraphString(imgWidth,imgHeight); -String yearImgUrl = graphJspPrefix + "jsp/graph.jsp?graphdata=" + yearEncoded; +String yearImgUrl = graphJspPrefix + "jsp/graph.jsp?nomonth=1&graphdata=" + yearEncoded; // a Calendar object for doing days-in-week, day-of-week,days-in-month math: Calendar cal = BubbleCalendarData.getUTCCalendar(); @@ -228,7 +228,7 @@ <div id="wbChart" onmouseout="showTrackers('none'); setActiveYear(startYear);"> <div id="wbChartThis"> - <a style="position:relative; white-space:nowrap; width:<%= imgWidth %>px;height:<%= imgHeight %>px;" href="" id="wm-graph-anchor"> + <a style="position:relative; white-space:nowrap; width:<%= imgWidth %>px;height:<%= imgHeight %>px;" href="<%= queryPrefix %>" id="wm-graph-anchor"> <div id="wm-ipp-sparkline" style="position:relative; white-space:nowrap; width:<%= imgWidth %>px;height:<%= imgHeight %>px;background: #f3f3f3 -moz-linear-gradient(top,#ffffff,#f3f3f3);background: #f3f3f3 -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f3f3f3), color-stop(1.0, #f3f3f3));background-color: #f3f3f3;filter: progid:DXImageTransform.Microsoft.Gradient(enabled='true',startColorstr=#FFFFFFFF, endColorstr=#FFF3F3F3);cursor:pointer;border: 1px solid #ccc;border-left:none;" title="<%= fmt.format("ToolBar.sparklineTitle") %>"> <img id="sparklineImgId" style="position:absolute;z-index:9012;top:0;left:0;" onmouseover="showTrackers('inline');" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-10 23:26:36
|
Revision: 3227 http://archive-access.svn.sourceforge.net/archive-access/?rev=3227&view=rev Author: bradtofel Date: 2010-08-10 23:26:30 +0000 (Tue, 10 Aug 2010) Log Message: ----------- backed out to something closer to the original Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp 2010-08-10 23:15:22 UTC (rev 3226) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp 2010-08-10 23:26:30 UTC (rev 3227) @@ -35,23 +35,6 @@ <div id="positionHome"> <section> - <div id="logoHome"> - <a href="/index.jsp"><h1><span>Internet Archive's Wayback Machine</span></h1></a> - </div> - </section> - <section> - <div id="searchHome"> - <form name="form1" method="get" action="<%= queryPrefix %>query"> - <input type="hidden" name="<%= WaybackRequest.REQUEST_TYPE %>" value="<%= WaybackRequest.REQUEST_CAPTURE_QUERY %>"> - <input type="text" name="<%= WaybackRequest.REQUEST_URL %>" value="http://" size="40"> - <button type="submit" name="Submit">Go Wayback!</button> - </form> - <div id="searchAdvHome"> - <a href="[ADVANCED SEARCH]">Advanced Search</a> - </div> - </div> - </section> - <section> <div id="error"> <h2><%= fmt.format(e.getTitleKey()) %></h2> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 3226 http://archive-access.svn.sourceforge.net/archive-access/?rev=3226&view=rev Author: bradtofel Date: 2010-08-10 23:15:22 +0000 (Tue, 10 Aug 2010) Log Message: ----------- sanity tests Added Paths: ----------- trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/archivalurl/ArchivalUrlTest.java Added: trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/archivalurl/ArchivalUrlTest.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/archivalurl/ArchivalUrlTest.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/archivalurl/ArchivalUrlTest.java 2010-08-10 23:15:22 UTC (rev 3226) @@ -0,0 +1,154 @@ +/* ArchivalUrlTest + * + * $Id$: + * + * Created on Jun 4, 2010. + * + * Copyright (C) 2006 Internet Archive. + * + * This file is part of Wayback. + * + * Wayback is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * Wayback is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with Wayback; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package org.archive.wayback.archivalurl; + +import javax.servlet.http.HttpServletRequest; + +import org.archive.wayback.archivalurl.requestparser.PathDatePrefixQueryRequestParser; +import org.archive.wayback.archivalurl.requestparser.PathDateRangeQueryRequestParser; +import org.archive.wayback.archivalurl.requestparser.PathPrefixDatePrefixQueryRequestParser; +import org.archive.wayback.archivalurl.requestparser.PathPrefixDateRangeQueryRequestParser; +import org.archive.wayback.archivalurl.requestparser.ReplayRequestParser; +import org.archive.wayback.core.WaybackRequest; +import org.archive.wayback.exception.BadQueryException; +import org.archive.wayback.exception.BetterRequestException; +import org.archive.wayback.requestparser.BaseRequestParser; +import org.archive.wayback.requestparser.PathRequestParser; +import org.archive.wayback.webapp.AccessPoint; + +import junit.framework.TestCase; + +/** + * @author brad + * + */ +public class ArchivalUrlTest extends TestCase { + ArchivalUrlRequestParser parser = new ArchivalUrlRequestParser(); + WaybackRequest wbr; + ArchivalUrl au; + BaseRequestParser brp = new BaseRequestParser() { + public int getMaxRecords() { return 10; } + @Override + public WaybackRequest parse(HttpServletRequest httpRequest, + AccessPoint wbContext) throws BadQueryException, + BetterRequestException { + return null; + } + }; + PathRequestParser parsers[] = new PathRequestParser[] { + new ReplayRequestParser(brp), + new PathDatePrefixQueryRequestParser(brp), + new PathDateRangeQueryRequestParser(brp), + new PathPrefixDatePrefixQueryRequestParser(brp), + new PathPrefixDateRangeQueryRequestParser(brp), + }; + + private WaybackRequest parse(String path) + throws BetterRequestException, BadQueryException { + + WaybackRequest wbRequest = null; + + for(int i = 0; i < parsers.length; i++) { + wbRequest = parsers[i].parse(path, null); + if(wbRequest != null) { + break; + } + } + return wbRequest; + } + private ArchivalUrl parseAU(String path) + throws BetterRequestException, BadQueryException { + return new ArchivalUrl(parse(path)); + } + + public void trt(String want, String src) throws BetterRequestException, BadQueryException { + assertEquals(want,parseAU(src).toString()); + } + + /** + * Test method for {@link org.archive.wayback.archivalurl.ArchivalUrl#toString()}. + * @throws BadQueryException + * @throws BetterRequestException + */ + public void testToString() throws BetterRequestException, BadQueryException { + trt( + "20010101000000/http://yahoo.com/", + "20010101000000/http://yahoo.com/"); + + trt( + "20010101000000/http://yahoo.com/", + "20010101000000/http://yahoo.com:80/"); + + trt( + "20010101000000/http://www.yahoo.com/", + "20010101000000/http://www.yahoo.com:80/"); + trt( + "20010101000000/http://www.yahoo.com/", + "20010101000000/www.yahoo.com/"); + trt( + "20010101000000/http://www.yahoo.com/", + "20010101000000/www.yahoo.com:80/"); + + trt( + "20010101000000im_/http://www.yahoo.com/", + "20010101000000im_/www.yahoo.com:80/"); + } + + /** + * Test method for {@link org.archive.wayback.archivalurl.ArchivalUrl#toPrefixQueryString(java.lang.String)}. + */ + public void testToPrefixQueryString() { + WaybackRequest wbr = new WaybackRequest(); + wbr.setUrlQueryRequest(); + wbr.setRequestUrl("http://www.yahoo.com/"); + ArchivalUrl au = new ArchivalUrl(wbr); + + assertEquals("*/http://www.yahoo.com/*",au.toString()); + } + + /** + * Test method for {@link org.archive.wayback.archivalurl.ArchivalUrl#toQueryString(java.lang.String)}. + */ + public void testToQueryString() { + WaybackRequest wbr = new WaybackRequest(); + wbr.setCaptureQueryRequest(); + wbr.setRequestUrl("http://www.yahoo.com/"); + ArchivalUrl au = new ArchivalUrl(wbr); + assertEquals("*/http://www.yahoo.com/",au.toString()); + } + + /** + * Test method for {@link org.archive.wayback.archivalurl.ArchivalUrl#toReplayString(java.lang.String)}. + */ + public void testToReplayString() { + WaybackRequest wbr = new WaybackRequest(); + wbr.setReplayRequest(); + wbr.setReplayTimestamp("20010101000000"); + wbr.setRequestUrl("http://www.yahoo.com/"); + ArchivalUrl au = new ArchivalUrl(wbr); + assertEquals("20010101000000/http://www.yahoo.com/",au.toString()); + } +} Property changes on: trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/archivalurl/ArchivalUrlTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Revision Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-10 22:44:58
|
Revision: 3225 http://archive-access.svn.sourceforge.net/archive-access/?rev=3225&view=rev Author: bradtofel Date: 2010-08-10 22:44:51 +0000 (Tue, 10 Aug 2010) Log Message: ----------- TWEAK: Quieted down stacktrace Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/StringFormatter.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/StringFormatter.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/StringFormatter.java 2010-08-10 21:24:46 UTC (rev 3224) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/StringFormatter.java 2010-08-10 22:44:51 UTC (rev 3225) @@ -104,8 +104,8 @@ try { return getFormat(getLocalized(key)).format(objects); } catch (Exception e) { - e.printStackTrace(); - + // TODO: log message + //e.printStackTrace(); } return key; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-10 21:24:53
|
Revision: 3224 http://archive-access.svn.sourceforge.net/archive-access/?rev=3224&view=rev Author: bradtofel Date: 2010-08-10 21:24:46 +0000 (Tue, 10 Aug 2010) Log Message: ----------- BUGFIX(ARI-2473): fixed parse bug extracting userinfo from an url. TWEAK: replaced "dns:" with reference to existing static variable Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/url/AggressiveUrlCanonicalizerTest.java trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/url/UrlOperationsTest.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java 2010-08-10 20:41:33 UTC (rev 3223) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java 2010-08-10 21:24:46 UTC (rev 3224) @@ -131,7 +131,7 @@ private static final Pattern HOST_REGEX_SIMPLE = Pattern.compile("(?:[0-9a-z_.:-]+@)?([0-9a-z_.-]++)"); private static final Pattern USERINFO_REGEX_SIMPLE = - Pattern.compile("([0-9a-z_.:-]+)(?:@[0-9a-z_.-]++)"); + Pattern.compile("^([0-9a-z_.:-]+)(?:@[0-9a-z_.-]++)"); /** * Tests if the String argument looks like it could be a legitimate @@ -292,8 +292,8 @@ */ public static String urlToHost(String url) { String lcUrl = url.toLowerCase(); - if(lcUrl.startsWith("dns:")) { - return lcUrl.substring(4); + if(lcUrl.startsWith(DNS_SCHEME)) { + return lcUrl.substring(DNS_SCHEME.length()); } for(String scheme : ALL_SCHEMES) { if(lcUrl.startsWith(scheme)) { @@ -318,7 +318,7 @@ */ public static String urlToUserInfo(String url) { String lcUrl = url.toLowerCase(); - if(lcUrl.startsWith("dns:")) { + if(lcUrl.startsWith(DNS_SCHEME)) { return null; } for(String scheme : ALL_SCHEMES) { Modified: trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/url/AggressiveUrlCanonicalizerTest.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/url/AggressiveUrlCanonicalizerTest.java 2010-08-10 20:41:33 UTC (rev 3223) +++ trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/url/AggressiveUrlCanonicalizerTest.java 2010-08-10 21:24:46 UTC (rev 3224) @@ -181,6 +181,10 @@ "http://legislature.mi.gov/(a(4hqa0555fwsecu455xqckv45)S(4hqa0555fwsecu455xqckv45)f(4hqa0555fwsecu455xqckv45))/mileg.aspx?page=sessionschedules", "legislature.mi.gov/mileg.aspx?page=sessionschedules"); + // '@' in path: + checkCanonicalization( + "http://www.flickr.com/photos/36050182@N05/", + "flickr.com/photos/36050182@n05/"); Modified: trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/url/UrlOperationsTest.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/url/UrlOperationsTest.java 2010-08-10 20:41:33 UTC (rev 3223) +++ trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/url/UrlOperationsTest.java 2010-08-10 21:24:46 UTC (rev 3224) @@ -91,7 +91,9 @@ assertEquals(null,UrlOperations.urlToUserInfo("http://foo.com:80/")); assertEquals(null,UrlOperations.urlToUserInfo("http://foo.com:80")); assertEquals(null,UrlOperations.urlToUserInfo("http://www.foo.com:80\\")); + assertEquals(null,UrlOperations.urlToUserInfo("http://www.flickr.com/photos/36050182@N05/")); + assertEquals("user",UrlOperations.urlToUserInfo("http://us...@fo...")); assertEquals("user",UrlOperations.urlToUserInfo("http://us...@ww...")); assertEquals("user:pass",UrlOperations.urlToUserInfo("http://user:pa...@ww...")); @@ -190,6 +192,8 @@ assertSDP("http://b:80...@fo.../bar","http://b:80...@fo.../bar"); assertSDP("http://b:80...@fo.../bar","http://b:80...@fo...:80/bar"); assertSDP("http://b:80...@fo...:8080/ba","http://b:80...@fo...:8080/ba"); + assertSDP("http://www.flickr.com/photos/36050182@N05/","http://www.flickr.com/photos/36050182@N05/"); + } private void assertSDP(String want, String orig) { String got = UrlOperations.stripDefaultPortFromUrl(orig); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-10 20:41:39
|
Revision: 3223 http://archive-access.svn.sourceforge.net/archive-access/?rev=3223&view=rev Author: bradtofel Date: 2010-08-10 20:41:33 +0000 (Tue, 10 Aug 2010) Log Message: ----------- BUGFIX: somehow literal String "url" was used instead of the actual url... Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/archivalurl/ArchivalUrl.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/archivalurl/ArchivalUrl.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/archivalurl/ArchivalUrl.java 2010-08-10 20:06:04 UTC (rev 3222) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/archivalurl/ArchivalUrl.java 2010-08-10 20:41:33 UTC (rev 3223) @@ -51,7 +51,7 @@ return toPrefixQueryString(wbRequest.getRequestUrl()); } public String toPrefixQueryString(String url) { - return toQueryString("url" + STAR); + return toQueryString(url) + STAR; } public String toQueryString(String url) { String datespec = STAR; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-10 20:06:10
|
Revision: 3222 http://archive-access.svn.sourceforge.net/archive-access/?rev=3222&view=rev Author: bradtofel Date: 2010-08-10 20:06:04 +0000 (Tue, 10 Aug 2010) Log Message: ----------- backing out all wrapper changes Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/ArchivalUrlReplay.xml Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/ArchivalUrlReplay.xml =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/ArchivalUrlReplay.xml 2010-08-10 20:03:38 UTC (rev 3221) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/ArchivalUrlReplay.xml 2010-08-10 20:06:04 UTC (rev 3222) @@ -138,7 +138,6 @@ <property name="renderer"> <bean class="org.archive.wayback.replay.JSPReplayRenderer"> <property name="targetJsp" value="/WEB-INF/replay/UrlRedirectNotice.jsp" /> - <property name="wrap" value="true" /> </bean> </property> </bean> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-10 20:03:45
|
Revision: 3221 http://archive-access.svn.sourceforge.net/archive-access/?rev=3221&view=rev Author: bradtofel Date: 2010-08-10 20:03:38 +0000 (Tue, 10 Aug 2010) Log Message: ----------- backing out all wrapper changes Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/exception/BaseExceptionRenderer.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/Renderer.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/replay/JSPReplayRenderer.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java 2010-08-10 19:55:56 UTC (rev 3220) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java 2010-08-10 20:03:38 UTC (rev 3221) @@ -349,34 +349,6 @@ /** * Store this UIResults object in the given HttpServletRequest, then - * forward the request to wrapper, which *should* subsequently forward the - * request to target. - * - * @param request the HttpServletRequest - * @param response the HttpServletResponse - * @param target the String path to the .jsp to handle drawing the data, - * relative to the contextRoot (ex. "/WEB-INF/query/foo.jsp") - * @param wrapper the wrapper page which should generate the header, - * forward control to 'target' and then generate the footer. - * @throws ServletException for usual reasons... - * @throws IOException for usual reasons... - */ - public void forwardWrapped(HttpServletRequest request, - HttpServletResponse response, final String target, String wrapper) - throws ServletException, IOException { - - this.contentJsp = target; - this.originalRequestURL = request.getRequestURL().toString(); - request.setAttribute(FERRET_NAME, this); - RequestDispatcher dispatcher = request.getRequestDispatcher(wrapper); - if(dispatcher == null) { - throw new IOException("No dispatcher for " + target); - } - dispatcher.forward(request, response); - } - - /** - * Store this UIResults object in the given HttpServletRequest, then * forward the request to target, in this case, an image, html file, .jsp, * any file which can return a complete document. Specifically, this means * that if target is a .jsp, it must render it's own header and footer. Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/exception/BaseExceptionRenderer.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/exception/BaseExceptionRenderer.java 2010-08-10 19:55:56 UTC (rev 3220) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/exception/BaseExceptionRenderer.java 2010-08-10 20:03:38 UTC (rev 3221) @@ -142,13 +142,7 @@ } } if(!handled) { - String wrapperJsp = wbRequest.getAccessPoint().getWrapperJsp(); - if(wrapperJsp != null) { - uiResults.forwardWrapped(httpRequest, httpResponse, - errorJsp, wrapperJsp); - } else { - uiResults.forward(httpRequest, httpResponse, errorJsp); - } + uiResults.forward(httpRequest, httpResponse, errorJsp); } } Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/Renderer.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/Renderer.java 2010-08-10 19:55:56 UTC (rev 3220) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/Renderer.java 2010-08-10 20:03:38 UTC (rev 3221) @@ -61,13 +61,7 @@ if(wbRequest.isXMLMode()) { uiResults.forward(httpRequest, httpResponse, xmlCaptureJsp); } else { - String wrapperJsp = wbRequest.getAccessPoint().getWrapperJsp(); - if(wrapperJsp != null) { - uiResults.forwardWrapped(httpRequest, httpResponse, - captureJsp, wrapperJsp); - } else { - uiResults.forward(httpRequest, httpResponse, captureJsp); - } + uiResults.forward(httpRequest, httpResponse, captureJsp); } } @@ -83,14 +77,7 @@ if(wbRequest.isXMLMode()) { uiResults.forward(httpRequest, httpResponse, xmlUrlJsp); } else { - String wrapperJsp = wbRequest.getAccessPoint().getWrapperJsp(); - if(wrapperJsp != null) { - - uiResults.forwardWrapped(httpRequest, httpResponse, - urlJsp,wbRequest.getAccessPoint().getWrapperJsp()); - } else { - uiResults.forward(httpRequest, httpResponse, urlJsp); - } + uiResults.forward(httpRequest, httpResponse, urlJsp); } } Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/replay/JSPReplayRenderer.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/replay/JSPReplayRenderer.java 2010-08-10 19:55:56 UTC (rev 3220) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/replay/JSPReplayRenderer.java 2010-08-10 20:03:38 UTC (rev 3221) @@ -49,7 +49,6 @@ */ public class JSPReplayRenderer implements ReplayRenderer { private String targetJsp = null; - private boolean wrap = true; public void renderResource(HttpServletRequest httpRequest, HttpServletResponse httpResponse, WaybackRequest wbRequest, @@ -58,13 +57,8 @@ throws ServletException, IOException, WaybackException { UIResults uiResults = new UIResults(wbRequest, uriConverter, results, result, resource); - if(wrap) { - uiResults.forwardWrapped(httpRequest, httpResponse, - targetJsp, wbRequest.getAccessPoint().getWrapperJsp()); - } else { - uiResults.forward(httpRequest, httpResponse, - targetJsp); - } + uiResults.forward(httpRequest, httpResponse, + targetJsp); } /** @@ -82,23 +76,4 @@ public void setTargetJsp(String targetJsp) { this.targetJsp = targetJsp; } - - /** - * @return true if the jsp should be wrapped in the stardard UI template - * wrapper jsp for the AccessPoint. - */ - public boolean isWrap() { - return wrap; - } - - /** - * @param wrap if true then the jsp configured for this page will be - * wrapped in the standard template used for the current AccessPoint, if - * false then the jsp configured is responsible for rendering the entire - * content. - */ - public void setWrap(boolean wrap) { - this.wrap = wrap; - } - } Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java 2010-08-10 19:55:56 UTC (rev 3220) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java 2010-08-10 20:03:38 UTC (rev 3221) @@ -105,8 +105,6 @@ private String queryPrefix = null; private String replayPrefix = null; -// private String wrapperJsp = "/WEB-INF/template/UI-wrapper.jsp"; - private String wrapperJsp = null; private String interstitialJsp = INTERSTITIAL_JSP; private String refererAuth = null; @@ -149,14 +147,7 @@ wbRequest.fixup(httpRequest); UIResults uiResults = new UIResults(wbRequest,uriConverter); try { - if(wrapperJsp != null && - translatedNoQuery.endsWith("-wrap.jsp")) { - - uiResults.forwardWrapped(httpRequest, httpResponse, - translatedQ, wrapperJsp); - } else { - uiResults.forward(httpRequest, httpResponse, translatedQ); - } + uiResults.forward(httpRequest, httpResponse, translatedQ); return true; } catch(IOException e) { // TODO: figure out if we got IO because of a missing dispatcher @@ -559,23 +550,8 @@ public String getQueryPrefix() { return getBestPrefix(queryPrefix,staticPrefix,replayPrefix); } - /** - * @return the String url prefix to use when generating self referencing - * replay URLs - */ - public String getWrapperJsp() { - return wrapperJsp; - } /** - * @param wrapperJsp the .jsp file responsible for generating the HTML - * wrapper for content. - */ - public void setWrapperJsp(String wrapperJsp) { - this.wrapperJsp = wrapperJsp; - } - - /** * @param interstitialJsp the interstitialJsp to set */ public void setInterstitialJsp(String interstitialJsp) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 3220 http://archive-access.svn.sourceforge.net/archive-access/?rev=3220&view=rev Author: bradtofel Date: 2010-08-10 19:55:56 +0000 (Tue, 10 Aug 2010) Log Message: ----------- simple example of Translate.decode() not doing what I think it should do... no assertions as yet Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/htmllex/ParseContextTest.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/htmllex/ParseContextTest.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/htmllex/ParseContextTest.java 2010-08-10 19:53:24 UTC (rev 3219) +++ trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/util/htmllex/ParseContextTest.java 2010-08-10 19:55:56 UTC (rev 3220) @@ -28,6 +28,8 @@ import java.net.URI; import java.net.URL; +import org.htmlparser.util.Translate; + import junit.framework.TestCase; /** @@ -37,6 +39,19 @@ public class ParseContextTest extends TestCase { /** + * + */ + public void testTranslate() { + String orig = "http://foo.com/main?arg1=1&lang=2"; + String xlated = Translate.decode(orig); + System.out.format("Orig(%s) xlated(%s)\n",orig,xlated); + String orig2 = "  gaz.cgi?foo=bar&lang=2"; + String xlated2 = Translate.decode(orig2); + System.out.format("Orig2(%s) xlated2(%s)\n",orig2,xlated2); + + } + + /** * Test method for {@link org.archive.wayback.util.htmllex.ParseContext#contextualizeUrl(java.lang.String)}. */ public void testContextualizeUrl() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 3219 http://archive-access.svn.sourceforge.net/archive-access/?rev=3219&view=rev Author: bradtofel Date: 2010-08-10 19:53:24 +0000 (Tue, 10 Aug 2010) Log Message: ----------- really simple sanity test Added Paths: ----------- trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/RemoteResourceIndexTest.java Added: trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/RemoteResourceIndexTest.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/RemoteResourceIndexTest.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/RemoteResourceIndexTest.java 2010-08-10 19:53:24 UTC (rev 3219) @@ -0,0 +1,108 @@ +/* RemoteResourceIndexTest + * + * $Id$: + * + * Created on Aug 10, 2010. + * + * Copyright (C) 2006 Internet Archive. + * + * This file is part of Wayback. + * + * Wayback is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * Wayback is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with Wayback; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package org.archive.wayback.resourceindex; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.archive.wayback.core.CaptureSearchResult; +import org.archive.wayback.core.CaptureSearchResults; +import org.archive.wayback.core.SearchResults; +import org.archive.wayback.util.ObjectFilter; +import org.archive.wayback.util.ObjectFilterChain; +import org.w3c.dom.Document; + +import junit.framework.TestCase; + +/** + * @author brad + * + */ +public class RemoteResourceIndexTest extends TestCase { + private DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + + /** + * Test method for {@link org.archive.wayback.resourceindex.RemoteResourceIndex#documentToSearchResults(org.w3c.dom.Document, org.archive.wayback.util.ObjectFilter)}. + */ + public void testDocumentToSearchResults() { + RemoteResourceIndex r = new RemoteResourceIndex(); + DocumentBuilder db; + try { + db = factory.newDocumentBuilder(); + + String testXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + + "<wayback>" + + "<request>" + + "<startdate>20090101000000</startdate>" + + "<numreturned>1</numreturned>" + + "<type>urlquery</type>" + + "<enddate>20100810191351</enddate>" + + "<numresults>1</numresults>" + + "<firstreturned>0</firstreturned>" + + "<url>dixienet.org/</url>" + + "<resultsrequested>1000</resultsrequested>" + + "<resultstype>resultstypecapture</resultstype>" + + "</request>" + + "<results>" + + "<result>" + + "<compressedoffset>36717460</compressedoffset>" + + "<mimetype>text/html</mimetype>" + + "<file>LOC-TRANSITION-001-20090204213039-00004-crawling108.us.archive.org.warc.gz</file>" + + "<redirecturl>http://dixienet.org/New%20Site/index.shtml</redirecturl>" + + "<urlkey>dixienet.org/</urlkey>" + + "<digest>3I42H3S6NNFQ2MSVX7XZKYAYSCX5QBYJ</digest>" + + "<httpresponsecode>302</httpresponsecode>" + + "<url>http://dixienet.org/</url>" + + "<capturedate>20090204213443</capturedate>" + + "</result>" + + "</results>" + + "</wayback>"; + ByteArrayInputStream bais = new ByteArrayInputStream(testXML.getBytes()); + Document document = db.parse(bais); + + ObjectFilterChain<CaptureSearchResult> filter = new ObjectFilterChain<CaptureSearchResult>(); + filter.addFilter(new ObjectFilter<CaptureSearchResult>() { + + public int filterObject(CaptureSearchResult o) { + return ObjectFilter.FILTER_INCLUDE; + } + }); + CaptureSearchResults sr = (CaptureSearchResults) r.documentToSearchResults(document, filter); + assertEquals(1,sr.getResults().size()); + assertEquals("20090204213443",sr.getResults().get(0).getCaptureTimestamp()); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } + } + +} Property changes on: trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/RemoteResourceIndexTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Revision Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-10 19:52:46
|
Revision: 3218 http://archive-access.svn.sourceforge.net/archive-access/?rev=3218&view=rev Author: bradtofel Date: 2010-08-10 19:52:40 +0000 (Tue, 10 Aug 2010) Log Message: ----------- removed getTextContent() methods... Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/NutchResourceIndex.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/RemoteResourceIndex.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/NutchResourceIndex.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/NutchResourceIndex.java 2010-08-10 19:00:31 UTC (rev 3217) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/NutchResourceIndex.java 2010-08-10 19:52:40 UTC (rev 3218) @@ -49,6 +49,7 @@ import org.archive.wayback.util.Timestamp; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; @@ -215,7 +216,7 @@ results = new ArrayList<CaptureSearchResult>(); for(int i = 0; i < numDates; i++) { - String captureDate = nodes.item(i).getTextContent(); + String captureDate = getNodeTextValue(nodes.item(i)); CaptureSearchResult result = new CaptureSearchResult(); result.setFile(fileName); result.setCaptureTimestamp(captureDate); @@ -313,7 +314,7 @@ NodeList nodes = e.getElementsByTagNameNS(NUTCH_NS, key); String result = null; if (nodes != null && nodes.getLength() > 0) { - result = nodes.item(0).getTextContent(); + result = getNodeTextValue(nodes.item(0)); } return (result == null || result.length() == 0)? null: result; } @@ -323,10 +324,18 @@ NodeList nodes = e.getElementsByTagName(key); String result = null; if (nodes != null && nodes.getLength() > 0) { - result = nodes.item(0).getTextContent(); + result = getNodeTextValue(nodes.item(0)); } return (result == null || result.length() == 0)? null: result; } + private String getNodeTextValue(Node n) { + if(n.hasChildNodes()) { + if(n.getFirstChild().getNodeName().equals("#text")) { + return n.getFirstChild().getNodeValue(); + } + } + return ""; + } // do an HTTP request, plus parse the result into an XML DOM protected synchronized Document getHttpDocument(String url) Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/RemoteResourceIndex.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/RemoteResourceIndex.java 2010-08-10 19:00:31 UTC (rev 3217) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/RemoteResourceIndex.java 2010-08-10 19:52:40 UTC (rev 3218) @@ -190,11 +190,19 @@ NodeList list = document.getElementsByTagName( SearchResults.RESULTS_TYPE); if(list.getLength() == 1) { - return list.item(0).getTextContent(); + return getNodeTextValue(list.item(0)); } else { return SearchResults.RESULTS_TYPE_CAPTURE; } } + private String getNodeTextValue(Node n) { + if(n.hasChildNodes()) { + if(n.getFirstChild().getNodeName().equals("#text")) { + return n.getFirstChild().getNodeValue(); + } + } + return ""; + } protected ObjectFilter<CaptureSearchResult> getSearchResultFilters( WaybackRequest wbRequest) { @@ -224,7 +232,7 @@ } for(int i = 0; i < filters.getLength(); i++) { String key = filters.item(i).getNodeName(); - String value = filters.item(i).getTextContent(); + String value = getNodeTextValue(filters.item(i)); if(!key.equals("#text")) { results.putFilter(key,value); } @@ -288,7 +296,7 @@ NodeList chitlens = e.getChildNodes(); for(int i = 0; i < chitlens.getLength(); i++) { String key = chitlens.item(i).getNodeName(); - String value = chitlens.item(i).getTextContent(); + String value = getNodeTextValue(chitlens.item(i)); if(!key.equals("#text")) { result.put(key,value); } @@ -330,7 +338,7 @@ NodeList nodes = e.getElementsByTagName(key); String result = null; if (nodes != null && nodes.getLength() > 0) { - result = nodes.item(0).getTextContent(); + result = getNodeTextValue(nodes.item(0)); } return (result == null || result.length() == 0) ? null : result; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-10 19:00:37
|
Revision: 3217 http://archive-access.svn.sourceforge.net/archive-access/?rev=3217&view=rev Author: bradtofel Date: 2010-08-10 19:00:31 +0000 (Tue, 10 Aug 2010) Log Message: ----------- backing out all wrapper changes Removed Paths: ------------- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/template/UI-wrapper.jsp Deleted: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/template/UI-wrapper.jsp =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/template/UI-wrapper.jsp 2010-08-10 18:56:07 UTC (rev 3216) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/template/UI-wrapper.jsp 2010-08-10 19:00:31 UTC (rev 3217) @@ -1,139 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<%@ page import="org.archive.wayback.core.WaybackRequest" %> -<%@ page import="org.archive.wayback.core.UIResults" %> -<%@ page import="org.archive.wayback.util.StringFormatter" %> -<%@ page language="java" pageEncoding="utf-8" contentType="text/html;charset=utf-8"%> -<% -UIResults results = UIResults.getGeneric(request); -WaybackRequest wbRequest = results.getWbRequest(); -StringFormatter fmt = wbRequest.getFormatter(); -String contentJsp = results.getContentJsp(); -String staticPrefix = results.getStaticPrefix(); -String queryPrefix = results.getQueryPrefix(); -String replayPrefix = results.getReplayPrefix(); - -%><html xmlns="http://www.w3.org/1999/xhtml"> - - <head> - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - - <link rel="stylesheet" type="text/css" - href="<%= staticPrefix %>css/styles.css" - src="<%= staticPrefix %>css/styles.css" /> - <title><%= fmt.format("UIGlobal.pageTitle") %></title> - <base target="_top" /> - </head> - - <body bgcolor="white" alink="red" vlink="#0000aa" link="blue" - style="font-family: Arial; font-size: 10pt"> - - <table width="100%" border="0" cellpadding="0" cellspacing="5"> - - <tr> - - <!-- WAYBACK LOGO --> - - <td width="26%"><a href="<%= staticPrefix %>"><img src="<%= staticPrefix %>images/wayback_logo_tr.gif" width="153" height="54" border="0"></a></td> - - <!-- /WAYBACK LOGO --> - - <!-- COLLECTION-EMPTYLOGO --> - - <td width="70%" align="right"></td> - - <!-- /COLLECTION-EMPTY LOGO --> - - </tr> - - <!-- GREEN BANNER --> - <tr> - <td colspan="2" height="30" align="center" class="mainSecHeadW"> - <table width="100%" border="0" cellspacing="0" cellpadding="0"> - - <tr class="mainBColor"> - <td colspan="2"> - <table border="0" width="80%" align="center"> - - - <!-- URL FORM --> - <form action="<%= queryPrefix %>query" method="get"> - - - <tr> - <td nowrap align="center"><img src="<%= staticPrefix %>images/shim.gif" width="1" height="20"> - - <b class="mainBodyW"> - <font size="2" color="#FFFFFF" face="Arial, Helvetica, sans-serif"> - <%= fmt.format("UIGlobal.enterWebAddress") %> - </font> - <input type="hidden" name="<%= WaybackRequest.REQUEST_TYPE %>" value="<%= WaybackRequest.REQUEST_CAPTURE_QUERY %>"> - <input type="text" name="<%= WaybackRequest.REQUEST_URL %>" value="http://" size="24" maxlength="256"> - - </b> - <select name="<%= WaybackRequest.REQUEST_DATE %>" size="1"> - <option value="" selected><%= fmt.format("UIGlobal.selectYearAll") %></option> - <option>2008</option> - <option>2007</option> - <option>2006</option> - <option>2005</option> - <option>2004</option> - <option>2003</option> - <option>2002</option> - <option>2001</option> - <option>2000</option> - <option>1999</option> - <option>1998</option> - <option>1997</option> - <option>1996</option> - </select> - - <input type="submit" name="Submit" value="<%= fmt.format("UIGlobal.urlSearchButton") %>" align="absMiddle"> - - <a href="<%= staticPrefix %>advanced_search.jsp" style="color:white;font-size:11px"> - <%= fmt.format("UIGlobal.advancedSearchLink") %> - </a> - - </td> - </tr> - - - </form> - <!-- /URL FORM --> - - </table> - </td> - </tr> - </table> - </td> - </tr> - <!-- /GREEN BANNER --> - </table> -<!-- PAGE CONTENTS --> -<% -if((contentJsp == null) || (contentJsp.length() == 0)) { - %> - No content here... - <% -} else { - %> - <jsp:include page="<%= contentJsp %>" flush="true"></jsp:include> - <% -} -%> -<!-- /PAGE CONTENTS --> - <div align="center"> - <hr noshade size="1" align="center" /> - - <p> - <a href="<%= staticPrefix %>"> - <%= fmt.format("UIGlobal.homeLink") %> - </a> | - <a href="<%= staticPrefix %>help.jsp"> - <%= fmt.format("UIGlobal.helpLink") %> - </a> - </p> - </div> - </body> -</html> - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-10 18:56:13
|
Revision: 3216 http://archive-access.svn.sourceforge.net/archive-access/?rev=3216&view=rev Author: bradtofel Date: 2010-08-10 18:56:07 +0000 (Tue, 10 Aug 2010) Log Message: ----------- TWEAK: added extra field for new Prefix query results Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/classes/WaybackUI.properties Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/classes/WaybackUI.properties =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/classes/WaybackUI.properties 2010-08-10 18:49:52 UTC (rev 3215) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/classes/WaybackUI.properties 2010-08-10 18:56:07 UTC (rev 3216) @@ -91,6 +91,7 @@ # shown when only a single capture of an URL is found in the index: # 0 = Date of capture PathPrefixQuery.singleCaptureDate=1 page from {0,date,MMM d, yyyy} +PathPrefixQuery.captureDate={0,date,MMM d, yyyy} # shown when multiple captures of an URL are found in the index: # 0 = number of captures This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-10 18:49:58
|
Revision: 3215 http://archive-access.svn.sourceforge.net/archive-access/?rev=3215&view=rev Author: bradtofel Date: 2010-08-10 18:49:52 +0000 (Tue, 10 Aug 2010) Log Message: ----------- HACK: extra flag argument now available to disable the highlighting of the active month Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/graph/RegionData.java trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/jsp/graph.jsp Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java 2010-08-09 23:53:22 UTC (rev 3214) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java 2010-08-10 18:49:52 UTC (rev 3215) @@ -37,13 +37,18 @@ * convert a String-encoded graph into a usable Graph object, using * default GraphConfiguration * @param encodedGraph String encoded graph, as returned by getEncoded() + * @param noMonth if true, disable the month highlight color * @return a Graph, ready to use * @throws GraphEncodingException if there were problems with the encoded * data */ - public static Graph decode(String encodedGraph) + public static Graph decode(String encodedGraph, boolean noMonth) throws GraphEncodingException { - return decode(encodedGraph, new GraphConfiguration()); + GraphConfiguration config = new GraphConfiguration(); + if(noMonth) { + config.valueHighlightColor = config.valueColor; + } + return decode(encodedGraph, config); } /** * convert a String-encoded graph into a usable Graph object, using Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/graph/RegionData.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/graph/RegionData.java 2010-08-09 23:53:22 UTC (rev 3214) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/util/graph/RegionData.java 2010-08-10 18:49:52 UTC (rev 3215) @@ -67,6 +67,7 @@ } /** * sets the highlighted value index, or removes highlight if -1 is used + * @param highlightedValue the index of the bar to highlight. */ public void setHighlightedValue(int highlightedValue) { this.highlightedValue = highlightedValue; Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/jsp/graph.jsp =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/jsp/graph.jsp 2010-08-09 23:53:22 UTC (rev 3214) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/jsp/graph.jsp 2010-08-10 18:49:52 UTC (rev 3215) @@ -9,12 +9,14 @@ %><% Date now = new Date(); String arg = request.getParameter("graphdata"); +String noMonthArg = request.getParameter("nomonth"); +boolean noMonth = (noMonthArg != null); if(arg == null) { arg = "(No Data specified)"; } GraphRenderer r = new GraphRenderer(); response.setContentType(GraphRenderer.RENDERED_IMAGE_MIME); -Graph graph = GraphEncoder.decode(arg); +Graph graph = GraphEncoder.decode(arg,noMonth); try { r.render(response.getOutputStream(),graph); } catch(Exception e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bi...@us...> - 2010-08-09 23:53:28
|
Revision: 3214 http://archive-access.svn.sourceforge.net/archive-access/?rev=3214&view=rev Author: binzino Date: 2010-08-09 23:53:22 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Remove date from ConfigurableIndexingFilter as it is now handled by the DateIndexer. Modified Paths: -------------- tags/nutchwax-0_13-JIRA-WAX-75/archive/src/nutch/conf/nutch-site.xml Modified: tags/nutchwax-0_13-JIRA-WAX-75/archive/src/nutch/conf/nutch-site.xml =================================================================== --- tags/nutchwax-0_13-JIRA-WAX-75/archive/src/nutch/conf/nutch-site.xml 2010-08-09 23:52:32 UTC (rev 3213) +++ tags/nutchwax-0_13-JIRA-WAX-75/archive/src/nutch/conf/nutch-site.xml 2010-08-09 23:53:22 UTC (rev 3214) @@ -42,30 +42,14 @@ dest-key = src-key --> <name>nutchwax.filter.index</name> -<!-- <value> title:false:true:tokenized content:false:compress:tokenized site:false:false:untokenized - url:false:true:tokenized - digest:false:true:no - - collection:true:true:no_norms - date:true:true:no_norms type:true:true:no_norms length:false:true:no </value> ---> - <value> - title:false:true:tokenized - content:false:compress:tokenized - site:false:false:untokenized - url:false:true:tokenized - type:true:true:no_norms - date:false:true:no - length:false:true:no - </value> </property> <property> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bi...@us...> - 2010-08-09 23:52:38
|
Revision: 3213 http://archive-access.svn.sourceforge.net/archive-access/?rev=3213&view=rev Author: binzino Date: 2010-08-09 23:52:32 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Added date merging hacks. Modified Paths: -------------- tags/nutchwax-0_13-JIRA-WAX-75/archive/src/java/org/archive/nutchwax/IndexerMapReduce.java Modified: tags/nutchwax-0_13-JIRA-WAX-75/archive/src/java/org/archive/nutchwax/IndexerMapReduce.java =================================================================== --- tags/nutchwax-0_13-JIRA-WAX-75/archive/src/java/org/archive/nutchwax/IndexerMapReduce.java 2010-08-09 23:52:07 UTC (rev 3212) +++ tags/nutchwax-0_13-JIRA-WAX-75/archive/src/java/org/archive/nutchwax/IndexerMapReduce.java 2010-08-09 23:52:32 UTC (rev 3213) @@ -73,7 +73,15 @@ final Writable value = values.next().get(); // unwrap if (value instanceof ParseData) { - parseData = (ParseData)value; + if ( parseData != null ) + { + // HACK: Merge dates + parseData = mergeDates( key, parseData, (ParseData) value ); + } + else + { + parseData = (ParseData)value; + } } else if (value instanceof ParseText) { parseText = (ParseText)value; } else if (LOG.isWarnEnabled()) { @@ -118,6 +126,25 @@ output.collect(key, doc); } + private ParseData mergeDates( Text key, ParseData d, ParseData s ) + { + Metadata dest = d.getContentMeta(); + Metadata src = s.getContentMeta(); + + if ( dest == null ) return s; + if ( src == null ) return d; + + // HACK: All we care about right now are the dates. + String[] sourceDates = src.getValues( "date" ); + for ( String date : sourceDates ) + { + LOG.warn( "Merging: " + key + " : " + date ); + dest.add( "date", date ); + } + + return d; + } + public void close() throws IOException { } public static void initMRJob(Collection<Path> segments, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bi...@us...> - 2010-08-09 23:52:13
|
Revision: 3212 http://archive-access.svn.sourceforge.net/archive-access/?rev=3212&view=rev Author: binzino Date: 2010-08-09 23:52:07 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Added DateIndexer. Modified Paths: -------------- tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/plugin.xml Modified: tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/plugin.xml =================================================================== --- tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/plugin.xml 2010-08-09 23:51:25 UTC (rev 3211) +++ tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/plugin.xml 2010-08-09 23:52:07 UTC (rev 3212) @@ -49,4 +49,11 @@ class="org.archive.nutchwax.index.FieldSetter" /> </extension> + <extension id="org.archive.nutchwax.index" + name="Date Indexer" + point="org.apache.nutch.indexer.IndexingFilter"> + <implementation id="DateIndexer" + class="org.archive.nutchwax.index.DateIndexer" /> + </extension> + </plugin> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 3211 http://archive-access.svn.sourceforge.net/archive-access/?rev=3211&view=rev Author: binzino Date: 2010-08-09 23:51:25 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Added some comments. Modified Paths: -------------- tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/DateIndexer.java Modified: tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/DateIndexer.java =================================================================== --- tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/DateIndexer.java 2010-08-09 16:04:53 UTC (rev 3210) +++ tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/DateIndexer.java 2010-08-09 23:51:25 UTC (rev 3211) @@ -36,7 +36,16 @@ import org.apache.nutch.parse.Parse; /** + * Add fields to NutchDocument related to dates. * + * All of the crawl dates are taken from the Parse object, reduced to + * a set of unique dates (in case of redundancies), then the dates + * are added to the NutchDocument in multiple fields: + * <ul> + * <li><code>date</code> stored for later retrieval.</li> + * <li><code>year</code> only the year (YYYY), indexed not stored.</l> + * <li><code>yearmonth</code> year and month (YYYYMM), indexed not stored.</li> + * </ul> */ public class DateIndexer implements IndexingFilter { @@ -55,16 +64,14 @@ } /** - * <p>Set Lucene document field to fixed value.</p> - * <p> - * Remove field if specified value is <code>null</code>. - * </p> + * */ public NutchDocument filter( NutchDocument doc, Parse parse, Text url, CrawlDatum datum, Inlinks inlinks ) throws IndexingException { Metadata meta = parse.getData().getContentMeta(); + // Use a Set to reduce list of dates to just unique values. Set<String> dates = new HashSet<String>( Arrays.asList( meta.getValues( "date" ) ) ); for ( String date : dates ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 3210 http://archive-access.svn.sourceforge.net/archive-access/?rev=3210&view=rev Author: binzino Date: 2010-08-09 16:04:53 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Initial revision. Added Paths: ----------- tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/DateIndexer.java Added: tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/DateIndexer.java =================================================================== --- tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/DateIndexer.java (rev 0) +++ tags/nutchwax-0_13-JIRA-WAX-75/archive/src/plugin/index-nutchwax/src/java/org/archive/nutchwax/index/DateIndexer.java 2010-08-09 16:04:53 UTC (rev 3210) @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2008 Internet Archive. + * + * This file is part of the archive-access tools project + * (http://sourceforge.net/projects/archive-access). + * + * The archive-access tools are free software; you can redistribute them and/or + * modify them under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or any + * later version. + * + * The archive-access tools are distributed in the hope that they will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser + * Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License along with + * the archive-access tools; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package org.archive.nutchwax.index; + +import java.util.*; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.Text; +import org.apache.nutch.crawl.CrawlDatum; +import org.apache.nutch.crawl.Inlinks; +import org.apache.nutch.indexer.IndexingException; +import org.apache.nutch.indexer.IndexingFilter; +import org.apache.nutch.indexer.NutchDocument; +import org.apache.nutch.indexer.lucene.LuceneWriter; +import org.apache.nutch.metadata.Metadata; +import org.apache.nutch.parse.Parse; + +/** + * + */ +public class DateIndexer implements IndexingFilter +{ + public static final Log LOG = LogFactory.getLog( DateIndexer.class ); + + private Configuration conf; + + public void setConf( Configuration conf ) + { + this.conf = conf; + } + + public Configuration getConf() + { + return this.conf; + } + + /** + * <p>Set Lucene document field to fixed value.</p> + * <p> + * Remove field if specified value is <code>null</code>. + * </p> + */ + public NutchDocument filter( NutchDocument doc, Parse parse, Text url, CrawlDatum datum, Inlinks inlinks ) + throws IndexingException + { + Metadata meta = parse.getData().getContentMeta(); + + Set<String> dates = new HashSet<String>( Arrays.asList( meta.getValues( "date" ) ) ); + + for ( String date : dates ) + { + doc.add( "date", date ); + doc.add( "year", date.substring( 0, 4 ) ); + doc.add( "yearmonth", date.substring( 0, 6 ) ); + } + + return doc; + } + + public void addIndexBackendOptions( Configuration conf ) + { + LuceneWriter.addFieldOptions( "date", LuceneWriter.STORE.YES, LuceneWriter.INDEX.NO, conf ); + LuceneWriter.addFieldOptions( "year", LuceneWriter.STORE.NO, LuceneWriter.INDEX.UNTOKENIZED, conf ); + LuceneWriter.addFieldOptions( "yearmonth", LuceneWriter.STORE.NO, LuceneWriter.INDEX.UNTOKENIZED, conf ); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-04 01:13:04
|
Revision: 3209 http://archive-access.svn.sourceforge.net/archive-access/?rev=3209&view=rev Author: bradtofel Date: 2010-08-04 01:12:58 +0000 (Wed, 04 Aug 2010) Log Message: ----------- TWEAK: replaced template header/footer with standards Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/jsp/Interstitial.jsp Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/jsp/Interstitial.jsp =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/jsp/Interstitial.jsp 2010-08-04 01:09:30 UTC (rev 3208) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/jsp/Interstitial.jsp 2010-08-04 01:12:58 UTC (rev 3209) @@ -22,7 +22,7 @@ String safeTargetUrl = f.escapeHtml(toUrl); String safeTargetUrlJS = f.escapeJavaScript(toUrl); %> - <jsp:include page="/WEB-INF/global-template/UI-header.jsp" flush="true" /> + <jsp:include page="/WEB-INF/template/UI-header.jsp" flush="true" /> <div id="positionHome"> <section> @@ -52,4 +52,4 @@ </section> <div id="errorBorder"></div> -<jsp:include page="/WEB-INF/global-template/UI-footer.jsp" flush="true" /> \ No newline at end of file +<jsp:include page="/WEB-INF/template/UI-footer.jsp" flush="true" /> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-04 01:09:37
|
Revision: 3208 http://archive-access.svn.sourceforge.net/archive-access/?rev=3208&view=rev Author: bradtofel Date: 2010-08-04 01:09:30 +0000 (Wed, 04 Aug 2010) Log Message: ----------- TWEAK: replaced template header/footer with standards Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/BubbleCalendar.jsp trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/HTMLUrlResults.jsp trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/replay/UrlRedirectNotice.jsp Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp 2010-08-03 00:37:53 UTC (rev 3207) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/exception/HTMLError.jsp 2010-08-04 01:09:30 UTC (rev 3208) @@ -31,7 +31,7 @@ StringFormatter fmt = results.getWbRequest().getFormatter(); %> -<jsp:include page="/WEB-INF/global-template/UI-header.jsp" flush="true" /> +<jsp:include page="/WEB-INF/template/UI-header.jsp" flush="true" /> <div id="positionHome"> <section> @@ -139,4 +139,4 @@ </section> <div id="errorBorder"></div> -<jsp:include page="/WEB-INF/global-template/UI-footer.jsp" flush="true" /> \ No newline at end of file +<jsp:include page="/WEB-INF/template/UI-footer.jsp" flush="true" /> \ No newline at end of file Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/BubbleCalendar.jsp =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/BubbleCalendar.jsp 2010-08-03 00:37:53 UTC (rev 3207) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/BubbleCalendar.jsp 2010-08-04 01:09:30 UTC (rev 3208) @@ -13,7 +13,7 @@ <%@ page import="org.archive.wayback.partition.BubbleCalendarData" %> <%@ page import="org.archive.wayback.util.partition.Partition" %> <%@ page import="org.archive.wayback.util.StringFormatter" %> -<jsp:include page="/WEB-INF/global-template/UI-header.jsp" flush="true" /> +<jsp:include page="/WEB-INF/template/UI-header.jsp" flush="true" /> <jsp:include page="/WEB-INF/template/CookieJS.jsp" flush="true" /> <% UIResults results = UIResults.extractCaptureQuery(request); @@ -466,4 +466,4 @@ </div> </div> -<jsp:include page="/WEB-INF/global-template/UI-footer.jsp" flush="true" /> \ No newline at end of file +<jsp:include page="/WEB-INF/template/UI-footer.jsp" flush="true" /> \ No newline at end of file Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/HTMLUrlResults.jsp =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/HTMLUrlResults.jsp 2010-08-03 00:37:53 UTC (rev 3207) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/query/HTMLUrlResults.jsp 2010-08-04 01:09:30 UTC (rev 3208) @@ -10,7 +10,7 @@ %><%@ page import="org.archive.wayback.core.WaybackRequest" %><%@ page import="org.archive.wayback.util.StringFormatter" %> -<jsp:include page="/WEB-INF/global-template/UI-header.jsp" flush="true" /> +<jsp:include page="/WEB-INF/template/UI-header.jsp" flush="true" /> <% UIResults results = UIResults.extractUrlQuery(request); WaybackRequest wbRequest = results.getWbRequest(); @@ -214,4 +214,4 @@ </table> -<jsp:include page="/WEB-INF/global-template/UI-footer.jsp" flush="true" /> \ No newline at end of file +<jsp:include page="/WEB-INF/template/UI-footer.jsp" flush="true" /> \ No newline at end of file Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/replay/UrlRedirectNotice.jsp =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/replay/UrlRedirectNotice.jsp 2010-08-03 00:37:53 UTC (rev 3207) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/replay/UrlRedirectNotice.jsp 2010-08-04 01:09:30 UTC (rev 3208) @@ -35,7 +35,7 @@ int secs = 5; %> - <jsp:include page="/WEB-INF/global-template/UI-header.jsp" flush="true" /> + <jsp:include page="/WEB-INF/template/UI-header.jsp" flush="true" /> <div id="positionHome"> <section> @@ -61,4 +61,4 @@ </section> <div id="errorBorder"></div> - <jsp:include page="/WEB-INF/global-template/UI-footer.jsp" flush="true" /> \ No newline at end of file + <jsp:include page="/WEB-INF/template/UI-footer.jsp" flush="true" /> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-03 00:37:59
|
Revision: 3207 http://archive-access.svn.sourceforge.net/archive-access/?rev=3207&view=rev Author: bradtofel Date: 2010-08-03 00:37:53 +0000 (Tue, 03 Aug 2010) Log Message: ----------- TWEAK: now uses interpolated wayback.basedir Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/BDBCollection.xml Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/BDBCollection.xml =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/BDBCollection.xml 2010-08-03 00:36:06 UTC (rev 3206) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/BDBCollection.xml 2010-08-03 00:37:53 UTC (rev 3207) @@ -41,11 +41,11 @@ <list> <bean class="org.archive.wayback.resourcestore.resourcefile.DirectoryResourceFileSource"> <property name="name" value="files1" /> - <property name="prefix" value="/tmp/wayback/files1/" /> + <property name="prefix" value="${wayback.basedir}/files1/" /> </bean> <bean class="org.archive.wayback.resourcestore.resourcefile.DirectoryResourceFileSource"> <property name="name" value="files2" /> - <property name="prefix" value="/tmp/wayback/files2/" /> + <property name="prefix" value="${wayback.basedir}/files2/" /> </bean> </list> </property> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2010-08-03 00:36:12
|
Revision: 3206 http://archive-access.svn.sourceforge.net/archive-access/?rev=3206&view=rev Author: bradtofel Date: 2010-08-03 00:36:06 +0000 (Tue, 03 Aug 2010) Log Message: ----------- Added 2009, 2010 to year selection Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/template/UI-header.jsp Modified: trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/template/UI-header.jsp =================================================================== --- trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/template/UI-header.jsp 2010-08-03 00:34:47 UTC (rev 3205) +++ trunk/archive-access/projects/wayback/wayback-webapp/src/main/webapp/WEB-INF/template/UI-header.jsp 2010-08-03 00:36:06 UTC (rev 3206) @@ -75,8 +75,10 @@ </b> <select name="<%= WaybackRequest.REQUEST_DATE %>" size="1"> <option value="" selected><%= fmt.format("UIGlobal.selectYearAll") %></option> - <option>2008</option> - <option>2007</option> + <option>2010</option> + <option>2009</option> + <option>2008</option> + <option>2007</option> <option>2006</option> <option>2005</option> <option>2004</option> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |