/**
  * Resynchronizes calls performed from the thread where this instance has been created.
  *
  * <p>{@inheritDoc}
  */
 @Override
 public boolean processSynchron(
     final HtmlPage page, final WebRequest settings, final boolean async) {
   if (async && isInOriginalThread()) {
     LOG.info("Re-synchronized call to " + settings.getUrl());
     return true;
   }
   return !async;
 }
Beispiel #2
0
  /** {@inheritDoc} */
  public WebResponse getResponse(final WebRequest request) throws IOException {
    final URL url = request.getUrl();

    if (LOG.isDebugEnabled()) {
      LOG.debug("Getting response for " + url.toExternalForm());
    }

    lastRequest_ = request;
    requestCount_++;
    requestedUrls_.add(url);

    WebResponseData response = responseMap_.get(url.toExternalForm());
    if (response == null) {
      response = defaultResponse_;
      if (response == null) {
        throw new IllegalStateException(
            "No response specified that can handle URL [" + url.toExternalForm() + "]");
      }
    }

    return new WebResponse(response, request, 0);
  }