Returns <code>true</code> is request should be retried.

@param responseCode - HTTP response code for the request
961032
@Override
	public boolean shouldRetryRequest(int responseCode, int retryAttempt) {
		if (responseCode >= 400 && responseCode < 500) {
			return false; // don't retry if request was rejected permanently
		}

		if (maxRetryCount == RETRY_COUNT_INFINITE) {
			return true; // keep retrying indefinitely
		}

		return retryAttempt <= maxRetryCount; // retry if we still can
	}
494574
@Override
    public void setStatusCode(StatusCodes code) {

        if (!code.equals(this.myStatusCode)) {
            this.myStatusCode = code;
            // no matter what, empty out the reason phrase information so that it
            // will default to match this new status code
            this.myReason = null;
            this.myReasonBytes = null;
            super.setFirstLineChanged();
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "setStatusCode(sc): " + code);
        }
    }
1094264
public boolean requestShouldBeHandledByTAI(HttpServletRequest request, MicroProfileJwtTaiRequest mpJwtTaiRequest, boolean defaultConfig) {
        String methodName = "requestShouldBeHandledByTAI";
        if (tc.isDebugEnabled()) {
            Tr.entry(tc, methodName, request, mpJwtTaiRequest);
        }

        mpJwtTaiRequest = setTaiRequestConfigInfo(request, mpJwtTaiRequest, defaultConfig);
        boolean result = false;
        boolean ignoreAppAuthMethod = true;

        MicroProfileJwtConfig mpJwtConfig = null;
        try {
            mpJwtConfig = mpJwtTaiRequest.getOnlyMatchingConfig();
        } catch (MpJwtProcessingException e) {

        }
        if (mpJwtConfig != null) {
            if (shouldDeferToJwtSso(request, mpJwtConfig, mpJwtTaiRequest.getJwtSsoConfig())) {
                return false;
            }
            ignoreAppAuthMethod = mpJwtConfig.ignoreApplicationAuthMethod(); // true by default
            if (ignoreAppAuthMethod) {
                result = mpJwtTaiRequest.hasServices();
            } else {
                result = isMpJwtSpecifiedInLoginConfig(request);
            }
        }

        if (tc.isDebugEnabled()) {
            Tr.exit(tc, methodName, result);
        }
        return result;
    }
14527
public static boolean isRetryableServiceException(SdkBaseException exception) {
        return isAse(exception) && RETRYABLE_STATUS_CODES.contains(toAse(exception).getStatusCode());
    }
490271
public void checkResponse(RpcRequest request) throws IOException {
        if (getResponse().getRejectStatus() == RejectStatus.AUTH_ERROR.getValue()) {
            request.setUsePrivilegedPort(true);
        }
        if (getResponse().getState() != NfsStatus.NFS3_OK.getValue()) {
            int responseState = getResponse().getState();
            if (responseState == NfsStatus.NFS3ERR_NOENT.getValue()) {
                throw new FileNotFoundException(request.getErrorMessage());
            }
            NfsStatus status = NfsStatus.fromValue(responseState);
            throw new NfsException(status, request.getErrorMessage() + " error code:" + status.toString());
        }
    }
1045453
def respond(self, code):
        

        # TODO: respect encodings etc. in the request
        resp = HttpResponse(code, self.connection)
        resp.request = self
        if hasattr(self, 'version'):
            resp.version = self.version
        return resp
879808
static boolean isErrorStatus(HttpResponse httpResponse, HttpResponseDecodeData decodeData) {
        final int[] expectedStatuses = decodeData.expectedStatusCodes();
        if (expectedStatuses != null) {
            return !contains(expectedStatuses, httpResponse.statusCode());
        } else {
            return httpResponse.statusCode() / 100 != 2;
        }
    }
1022258
private function checkResponseCode($responseCode)
    {
        switch ($responseCode) {
            case self::REQUEST_HAS_SUCCEED_CODE:
                break;

            case self::MALFORMED_NOTIFICATION_CODE:
                throw new MalformedNotificationException(
                    "The request could not be parsed as JSON, or it contained invalid fields",
                    self::MALFORMED_NOTIFICATION_CODE
                );

            case self::AUTHENTICATION_ERROR_CODE:
                throw new DispatchMessageException(
                    "There was an error authenticating the sender account.",
                    self::AUTHENTICATION_ERROR_CODE
                );

            default:
                throw new RuntimeException(
                    "Unknown error occurred while sending notification."
                );
        }
    }
296933
protected boolean isAccessTokenRequest(final HttpServletRequest request, final HttpServletResponse response) {
        val requestPath = request.getRequestURI();
        val pattern = String.format("(%s|%s)", OAuth20Constants.ACCESS_TOKEN_URL, OAuth20Constants.TOKEN_URL);
        return doesUriMatchPattern(requestPath, pattern);
    }
64818
def is_redirect(self):
        ''''''
        if self._response:
            status_code = self._response.status_code
            return status_code in self._codes \
                or status_code in self._repeat_codes
543120
def _should_retry(resp):
  """"""
  return (resp.status_code == httplib.REQUEST_TIMEOUT or
          (resp.status_code >= 500 and
           resp.status_code < 600))
1065950
@SuppressWarnings("unchecked")
  protected <T extends RaftRequest> void retryRequest(Throwable cause, T request, BiFunction sender, int count, int selectionId, CompletableFuture future) {
    // If the connection has not changed, reset it and connect to the next server.
    if (this.selectionId == selectionId) {
      log.trace("Resetting connection. Reason: {}", cause.getMessage());
      this.currentNode = null;
    }

    // Attempt to send the request again.
    sendRequest(request, sender, count, future);
  }
348692
public boolean isValid(HttpServletRequest request, String challenge, String response) {
    String remoteAddr = request.getRemoteAddr();
    log.info("Challenge Field Name = [{}]", challenge);
    log.info("Response Field Name = [{}]", response);
    if(challenge != null && response != null && challenge.trim().length() > 0) {
      return reCaptcha.checkAnswer(remoteAddr, challenge, response).isValid();
    } else {
      return false;
    }
  }
644695
boolean performRemoteCheck(MnoHttpClient httpClient) {
		// Prepare request
		String url = sso.getSessionCheckUrl(this.uid, this.sessionToken);
		String respStr;
		try {
			respStr = httpClient.get(url);
		} catch (AuthenticationException e1) {
			// TODO log error
			e1.printStackTrace();
			return false;
		} catch (ApiException e1) {
			// TODO log error
			e1.printStackTrace();
			return false;
		}

		// Parse response
		Gson gson = new Gson();
		Type type = new TypeToken<Map<String, String>>() {
		}.getType();
		Map<String, String> respObj = gson.fromJson(respStr, type);
		Boolean isValid = (respObj.get("valid") != null && respObj.get("valid").equals("true"));

		if (isValid) {
			try {
				this.recheck = MnoDateHelper.fromIso8601(respObj.get("recheck"));
			} catch (Exception e) {
				return false;
			}

			return true;
		}
		return false;
	}
620914
def check_response_code(resp):
    
    if resp["status"] == "OK" or resp["status"] == "ZERO_RESULTS":
        return

    if resp["status"] == "REQUEST_DENIED":
        raise Exception("Google Places " + resp["status"],
                        "Request was denied, the API key is invalid.")

    if resp["status"] == "OVER_QUERY_LIMIT":
        raise Exception("Google Places " + resp["status"],
                        "You exceeded your Query Limit for Google Places API Web Service, "
                        "check https://developers.google.com/places/web-service/usage "
                        "to upgrade your quota.")

    if resp["status"] == "INVALID_REQUEST":
        raise Exception("Google Places " + resp["status"],
                        "The query string is malformed, "
                        "check if your formatting for lat/lng and radius is correct.")

    raise Exception("Google Places " + resp["status"],
                    "Unidentified error with the Places API, please check the response code")
1163586
public Response reliableRequest(final Request request, final int[] retryCodes, int retries,
                                    final long delayMillis) {
        lastRequest = request;
        Response response = null;
        while (retries > 0) {
            response = makeRequest(request);

            if (!shouldRetry(response, retryCodes)) {
                break;
            }

            try {
                Thread.sleep(delayMillis);
            } catch (final InterruptedException e) {
                // Delay failed, continue
            }

            // Decrement retries
            retries--;
        }

        lastResponse = response;

        return response;
    }
1308351
def response(code, **kwargs):
        
        _ret_json = jsonify(kwargs)
        resp = make_response(_ret_json, code)
        resp.headers["Content-Type"] = "application/json; charset=utf-8"
        return resp