Package org.archive.wayback.exception

Examples of org.archive.wayback.exception.LiveDocumentNotAvailableException


    SearchResult result = results.getClosest(wbRequest);
    if(result != null) {
      if(isForgedFailedSearchResult(result)) {
        if(isForgedFailRecentEnough(result)) {
          LOGGER.info(url.toString() + " has failed recently");
          throw new LiveDocumentNotAvailableException("failed prev");
        } else {
          LOGGER.info(url.toString() + " failed a while ago");
          throw new ResourceNotInArchiveException("Nope");
        }
      }
View Full Code Here


    try {
      int code = http.executeMethod(method);
      os.close();
      // TODO: Constant 200
      if(code != 200) {
        throw new LiveDocumentNotAvailableException(urlString);
      }
    } catch (HttpException e) {
      e.printStackTrace();
      throw new LiveDocumentNotAvailableException(urlString);
    } catch(UnknownHostException e) {
      LOGGER.info("Unknown host for URL " + urlString);
      throw new LiveDocumentNotAvailableException(urlString);
    } catch(ConnectTimeoutException e) {
      LOGGER.info("Connection Timeout for URL " + urlString);
      throw new LiveDocumentNotAvailableException(urlString);     
    } catch(NoRouteToHostException e) {
      LOGGER.info("No route to host for URL " + urlString);
      throw new LiveDocumentNotAvailableException(urlString);           
    } catch(ConnectException e) {
      LOGGER.info("ConnectException URL " + urlString);
      throw new LiveDocumentNotAvailableException(urlString);           
    }
    LOGGER.info("Stored " + urlString + " in " + file.getAbsolutePath());
    return method;
  }
View Full Code Here

          //long elapsed = System.currentTimeMillis() - start;
          //PerformanceLogger.noteElapsed("RobotRequest", elapsed, urlString);

          if(resource.getStatusCode() != 200) {
            LOGGER.info("ROBOT: NotAvailable("+urlString+")");
            throw new LiveDocumentNotAvailableException(urlString);
          }
          tmpRules.parse(resource);         
          rulesCache.put(firstUrlString,tmpRules);
          rules = tmpRules;
         
View Full Code Here

      PerfStats.timeStart(PerfStat.RobotsRedis);
      this.updateCache(result.robots, url, null, result.status, true);
      PerfStats.timeEnd(PerfStat.RobotsRedis);
     
      if (result == null || result.status != STATUS_OK) {
        throw new LiveDocumentNotAvailableException("Error Loading Live Robots")
      }
     
      return new RobotsTxtResource(result.robots);
     
    } else {
     
      if (isExpired(value, url, 0)) {
        PerfStats.timeStart(PerfStat.RobotsRedis);       
        redisCmds.pushKey(UPDATE_QUEUE_KEY, url, MAX_UPDATE_QUEUE_SIZE);
        PerfStats.timeEnd(PerfStat.RobotsRedis);
      }
     
      String currentRobots = value.value;
     
      if (currentRobots.startsWith(ROBOTS_TOKEN_ERROR)) {
        throw new LiveDocumentNotAvailableException("Robots Error: " + currentRobots)
      } else if (value.equals(ROBOTS_TOKEN_EMPTY)) {
        currentRobots = "";
      }
     
      return new RobotsTxtResource(currentRobots)
View Full Code Here

    HttpMethod method = null;
    try {
      method = new GetMethod(urlString);
    } catch(IllegalArgumentException e) {
      LOGGER.warning("Bad URL for live web fetch:" + urlString);
      throw new LiveDocumentNotAvailableException("Url:" + urlString +
          "does not look like an URL?");
    }
    boolean success = false;
      try {
        int status = http.executeMethod(method);
        if(status == 200) {

          ByteArrayInputStream bais = new ByteArrayInputStream(method.getResponseBody());
          ARCRecord r = new ARCRecord(
              new GZIPInputStream(bais),
              "id",0L,false,false,true);
          ArcResource ar = (ArcResource)
            ResourceFactory.ARCArchiveRecordToResource(r, null);
          if(ar.getStatusCode() == 502) {
            throw new LiveDocumentNotAvailableException(urlString);
          } else if(ar.getStatusCode() == 504) {
            throw new LiveWebTimeoutException("Timeout:" + urlString);
          }
          success = true;
          return ar;
         
        } else {
          throw new LiveWebCacheUnavailableException(urlString);
        }

      } catch (ResourceNotAvailableException e) {
        throw new LiveDocumentNotAvailableException(urlString);

      } catch (NoHttpResponseException e) {

        throw new LiveWebCacheUnavailableException("No Http Response for "
            + urlString);
View Full Code Here

          inner.queryIndex(wbRequest);
          // Succeeded, so send redirect to query
          httpResponse.sendRedirect(inner.getReplayPrefix() + urlString);
          return true;
        } catch (ResourceIndexNotAvailableException e) {
          throw new LiveDocumentNotAvailableException(e.toString());
        } catch (ResourceNotInArchiveException e) {
          //Continue
        } catch (BadQueryException e) {
          throw new LiveDocumentNotAvailableException(e.toString());
        } catch (AccessControlException e) {
          //Continue
          //throw new LiveDocumentNotAvailableException(e.toString());
        } catch (ConfigurationException e) {
          throw new LiveDocumentNotAvailableException(e.toString());
        }
      }
     
      wbRequest.setLiveWebRequest(true);
     
      if (inner.isEnablePerfStatsHeader()) {
        PerfStats.timeStart(AccessPoint.PerfStat.Total);
        httpResponse = new PerfWritingHttpServletResponse(httpRequest, httpResponse, AccessPoint.PerfStat.Total, inner.getPerfStatsHeader());
      }
     
      Thread.currentThread().setName("Thread " +
          Thread.currentThread().getId() + " " + getBeanName() +
          " handling: " + urlString);
     
      CaptureSearchResult result = new FastCaptureSearchResult();
     
      r = this.getLiveWebResource(result, urlString);
     
      if (r != null) {       
        CaptureSearchResults results = new CaptureSearchResults();
        results.addSearchResult(result);
     
        wbRequest.setReplayTimestamp(result.getCaptureTimestamp());
         
        inner.getReplay().getRenderer(wbRequest, result, r).renderResource(httpRequest, httpResponse, wbRequest, result, r,
            inner.getUriConverter(), results)
      } else {
        throw new LiveDocumentNotAvailableException(urlString);
      }

    } catch(WaybackException e) {
      inner.logError(httpResponse, LIVEWEB_RUNTIME_ERROR_HEADER, e, wbRequest);
      inner.getException().renderException(httpRequest, httpResponse, wbRequest, e, inner.getUriConverter());
View Full Code Here

    try {
      int responseStatus = http.executeMethod(method);
     
      if (responseStatus >= 400 || responseStatus < 200) {
        throw new LiveDocumentNotAvailableException("Invalid Status: " + responseStatus);
      }   
     
      in = ByteStreams.limit(method.getResponseBodyAsStream(), maxRobotsSize);
      return new RobotsTxtResource(IOUtils.toString(in));
     
    } catch (IOException io) {
      throw new LiveDocumentNotAvailableException(io.toString());
    } finally {
      if (in != null) {
        in.close();
      }
     
View Full Code Here

      connectionManager.getParams().setSoTimeout(socketTimeoutMS);
      connectionManager.getParams().setConnectionTimeout(connectTimeoutMS);
    try {
      method = new GetMethod(urlString);
    } catch(IllegalArgumentException e) {
      throw new LiveDocumentNotAvailableException("Url:" + urlString +
          "does not look like an URL?");
    }
      try {
        int status = http.executeMethod(method);
        System.out.println("Got response code: " + status);
View Full Code Here

TOP

Related Classes of org.archive.wayback.exception.LiveDocumentNotAvailableException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.