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

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

本文整理了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

  1. @Override
  2. public JerseyRequest setConnectionTimeout(final int i) {
  3. delegateRequest.setConnectionTimeout(i);
  4. return this;
  5. }

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

  1. public ApplicationLinkRequest setConnectionTimeout(final int connectionTimeout)
  2. {
  3. return setDelegate(request.setConnectionTimeout(connectionTimeout));
  4. }

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

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

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

  1. @Override
  2. public ApplicationStatus getStatus(URI url) {
  3. try {
  4. LOGGER.debug("Querying " + url + " for its online status.");
  5. final Request<Request<?, Response>, Response> request = requestFactory.createRequest(Request.MethodType.GET, url.toString());
  6. request.setConnectionTimeout(CONNECTION_TIMEOUT).setSoTimeout(CONNECTION_TIMEOUT);
  7. return request.executeAndReturn(new ReturningResponseHandler<Response, ApplicationStatus>() {
  8. @Override
  9. public ApplicationStatus handle(final Response response) throws ResponseException {
  10. return response.isSuccessful() || (response.getStatusCode() == HttpStatus.SC_FORBIDDEN) || (response.getStatusCode()
  11. == HttpStatus.SC_UNAUTHORIZED) ? ApplicationStatus.AVAILABLE : ApplicationStatus.UNAVAILABLE;
  12. }
  13. });
  14. } catch (ResponseException re) {
  15. return ApplicationStatus.UNAVAILABLE;
  16. }
  17. }

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

  1. @Override
  2. public ApplicationStatus getStatus(URI url) {
  3. try {
  4. LOGGER.debug("Querying " + url + " for its online status.");
  5. final Request<Request<?, Response>, Response> request =
  6. requestFactory.createRequest(Request.MethodType.GET, url.toString());
  7. request.setConnectionTimeout(CONNECTION_TIMEOUT).setSoTimeout(CONNECTION_TIMEOUT);
  8. return request.executeAndReturn(new ReturningResponseHandler<Response, ApplicationStatus>() {
  9. @Override
  10. public ApplicationStatus handle(final Response response) throws ResponseException {
  11. return response.isSuccessful() || (response.getStatusCode() == HttpStatus.SC_FORBIDDEN) ?
  12. ApplicationStatus.AVAILABLE : ApplicationStatus.UNAVAILABLE;
  13. }
  14. });
  15. } catch (ResponseException re) {
  16. return ApplicationStatus.UNAVAILABLE;
  17. }
  18. }

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

  1. /**
  2. * Does a GET on the baseurl and expects a 200 status code.
  3. *
  4. * @param url baseUrl of the peer.
  5. * @return
  6. */
  7. public ApplicationStatus getStatus(final URI url)
  8. {
  9. try
  10. {
  11. LOG.debug("Querying " + url + " for its online status.");
  12. final Request<Request<?, Response>,Response> request = requestFactory
  13. .createRequest(Request.MethodType.GET, url.toString());
  14. request.setConnectionTimeout(CONNECTION_TIMEOUT).setSoTimeout(CONNECTION_TIMEOUT);
  15. return request.executeAndReturn(new ReturningResponseHandler<Response,ApplicationStatus>()
  16. {
  17. public ApplicationStatus handle(final Response response) throws ResponseException
  18. {
  19. return response.isSuccessful() ?
  20. ApplicationStatus.AVAILABLE :
  21. ApplicationStatus.UNAVAILABLE;
  22. }
  23. });
  24. }
  25. catch (ResponseException re)
  26. {
  27. return ApplicationStatus.UNAVAILABLE;
  28. }
  29. }
  30. }

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

  1. /**
  2. * Does a GET on the baseurl and expects a 200 status code.
  3. *
  4. * @param url baseUrl of the peer.
  5. * @return ApplicationStatus for the url
  6. */
  7. public ApplicationStatus getStatus(final URI url) {
  8. try {
  9. LOG.debug("Querying " + url + " for its online status.");
  10. final Request<Request<?, Response>, Response> request = requestFactory
  11. .createRequest(Request.MethodType.GET, url.toString());
  12. request.setConnectionTimeout(CONNECTION_TIMEOUT).setSoTimeout(CONNECTION_TIMEOUT);
  13. return request.executeAndReturn(response -> response.isSuccessful() ?
  14. ApplicationStatus.AVAILABLE :
  15. ApplicationStatus.UNAVAILABLE);
  16. } catch (ResponseException re) {
  17. return ApplicationStatus.UNAVAILABLE;
  18. }
  19. }
  20. }

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

  1. public Iterable<ExternalActivityItem> getItems(ApplicationLink appLink, ExternalActivityItemSearchParams params) throws Exception
  2. {
  3. final String uri = remoteStreamsFeedUriBuilder.buildUri(appLink, params).toASCIIString();
  4. try
  5. {
  6. final Request<?, ?> request = appLink.createAuthenticatedRequestFactory().createRequest(Request.MethodType.GET, uri);
  7. request.setConnectionTimeout(CONNECTION_TIMEOUT);
  8. request.setSoTimeout(SO_TIMEOUT);
  9. return itemFactory.getItems(request.execute());
  10. }
  11. catch (Exception e)
  12. {
  13. log.warn("Cannot fetch remote feed from: " + uri);
  14. throw e;
  15. }
  16. }
  17. }

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

  1. .setConnectionTimeout(CONNECTION_TIMEOUT)
  2. .setSoTimeout(CONNECTION_TIMEOUT)
  3. .setFollowRedirects(false)

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

  1. .setConnectionTimeout(CONNECTION_TIMEOUT)
  2. .setSoTimeout(CONNECTION_TIMEOUT)
  3. .setFollowRedirects(false)

相关文章