com.atlassian.sal.api.net.Request.setConnectionTimeout()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(257)

本文整理了Java中com.atlassian.sal.api.net.Request.setConnectionTimeout方法的一些代码示例,展示了Request.setConnectionTimeout的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setConnectionTimeout方法的具体详情如下:
包路径:com.atlassian.sal.api.net.Request
类名称:Request
方法名:setConnectionTimeout

Request.setConnectionTimeout介绍

暂无

代码示例

代码示例来源:origin: com.atlassian.plugins.rest/atlassian-rest-module

@Override
public JerseyRequest setConnectionTimeout(final int i) {
  delegateRequest.setConnectionTimeout(i);
  return this;
}

代码示例来源:origin: com.atlassian.applinks/applinks-plugin-core

public ApplicationLinkRequest setConnectionTimeout(final int connectionTimeout)
{
  return setDelegate(request.setConnectionTimeout(connectionTimeout));
}

代码示例来源:origin: com.atlassian.applinks/applinks-common

public ApplicationLinkRequest setConnectionTimeout(final int connectionTimeout) {
  return setDelegate(request.setConnectionTimeout(connectionTimeout));
}

代码示例来源:origin: com.marvelution.jira.plugins/jira-jenkins-plugin

@Override
public ApplicationStatus getStatus(URI url) {
  try {
    LOGGER.debug("Querying " + url + " for its online status.");
    final Request<Request<?, Response>, Response> request = requestFactory.createRequest(Request.MethodType.GET, url.toString());
    request.setConnectionTimeout(CONNECTION_TIMEOUT).setSoTimeout(CONNECTION_TIMEOUT);
    return request.executeAndReturn(new ReturningResponseHandler<Response, ApplicationStatus>() {
      @Override
      public ApplicationStatus handle(final Response response) throws ResponseException {
        return response.isSuccessful() || (response.getStatusCode() == HttpStatus.SC_FORBIDDEN) || (response.getStatusCode()
            == HttpStatus.SC_UNAUTHORIZED) ? ApplicationStatus.AVAILABLE : ApplicationStatus.UNAVAILABLE;
      }
    });
  } catch (ResponseException re) {
    return ApplicationStatus.UNAVAILABLE;
  }
}

代码示例来源:origin: com.marvelution.atlassian.suite.plugins/atlassian-sonarqube-common

@Override
public ApplicationStatus getStatus(URI url) {
  try {
    LOGGER.debug("Querying " + url + " for its online status.");
    final Request<Request<?, Response>, Response> request =
        requestFactory.createRequest(Request.MethodType.GET, url.toString());
    request.setConnectionTimeout(CONNECTION_TIMEOUT).setSoTimeout(CONNECTION_TIMEOUT);
    return request.executeAndReturn(new ReturningResponseHandler<Response, ApplicationStatus>() {
      @Override
      public ApplicationStatus handle(final Response response) throws ResponseException {
        return response.isSuccessful() || (response.getStatusCode() == HttpStatus.SC_FORBIDDEN) ?
            ApplicationStatus.AVAILABLE : ApplicationStatus.UNAVAILABLE;
      }
    });
  } catch (ResponseException re) {
    return ApplicationStatus.UNAVAILABLE;
  }
}

代码示例来源:origin: com.atlassian.applinks/applinks-plugin-core

/**
   * Does a GET on the baseurl and expects a 200 status code.
   *
   * @param url   baseUrl of the peer.
   * @return
   */
  public ApplicationStatus getStatus(final URI url)
  {
    try
    {
      LOG.debug("Querying " + url + " for its online status.");
      final Request<Request<?, Response>,Response> request = requestFactory
        .createRequest(Request.MethodType.GET, url.toString());
      request.setConnectionTimeout(CONNECTION_TIMEOUT).setSoTimeout(CONNECTION_TIMEOUT);
      return request.executeAndReturn(new ReturningResponseHandler<Response,ApplicationStatus>()
        {
          public ApplicationStatus handle(final Response response) throws ResponseException
          {
            return response.isSuccessful() ?
                ApplicationStatus.AVAILABLE :
                ApplicationStatus.UNAVAILABLE;
          }
        });
    }
    catch (ResponseException re)
    {
      return ApplicationStatus.UNAVAILABLE;
    }
  }
}

代码示例来源:origin: com.atlassian.applinks/applinks-common

/**
   * Does a GET on the baseurl and expects a 200 status code.
   *
   * @param url baseUrl of the peer.
   * @return ApplicationStatus for the url
   */
  public ApplicationStatus getStatus(final URI url) {
    try {
      LOG.debug("Querying " + url + " for its online status.");
      final Request<Request<?, Response>, Response> request = requestFactory
          .createRequest(Request.MethodType.GET, url.toString());
      request.setConnectionTimeout(CONNECTION_TIMEOUT).setSoTimeout(CONNECTION_TIMEOUT);
      return request.executeAndReturn(response -> response.isSuccessful() ?
          ApplicationStatus.AVAILABLE :
          ApplicationStatus.UNAVAILABLE);
    } catch (ResponseException re) {
      return ApplicationStatus.UNAVAILABLE;
    }
  }
}

代码示例来源:origin: com.atlassian.streams/streams-fisheye-plugin

public Iterable<ExternalActivityItem> getItems(ApplicationLink appLink, ExternalActivityItemSearchParams params) throws Exception
  {
    final String uri = remoteStreamsFeedUriBuilder.buildUri(appLink, params).toASCIIString();

    try
    {
      final Request<?, ?> request = appLink.createAuthenticatedRequestFactory().createRequest(Request.MethodType.GET, uri);
      request.setConnectionTimeout(CONNECTION_TIMEOUT);
      request.setSoTimeout(SO_TIMEOUT);
      return itemFactory.getItems(request.execute());
    }
    catch (Exception e)
    {
      log.warn("Cannot fetch remote feed from: " + uri);
      throw e;
    }
  }
}

代码示例来源:origin: com.atlassian.applinks/applinks-plugin-core

.setConnectionTimeout(CONNECTION_TIMEOUT)
.setSoTimeout(CONNECTION_TIMEOUT)
.setFollowRedirects(false)

代码示例来源:origin: com.atlassian.applinks/applinks-common

.setConnectionTimeout(CONNECTION_TIMEOUT)
.setSoTimeout(CONNECTION_TIMEOUT)
.setFollowRedirects(false)

相关文章