當前位置: 首頁>>代碼示例>>Java>>正文


Java ResponseEntity.getStatusCodeValue方法代碼示例

本文整理匯總了Java中org.springframework.http.ResponseEntity.getStatusCodeValue方法的典型用法代碼示例。如果您正苦於以下問題:Java ResponseEntity.getStatusCodeValue方法的具體用法?Java ResponseEntity.getStatusCodeValue怎麽用?Java ResponseEntity.getStatusCodeValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.http.ResponseEntity的用法示例。


在下文中一共展示了ResponseEntity.getStatusCodeValue方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: RestTemplateResponse

import org.springframework.http.ResponseEntity; //導入方法依賴的package包/類
public RestTemplateResponse(ResponseEntity<String> response) {
	this.body = response.getBody();
	this.status = response.getStatusCodeValue();
	this.message = response.getStatusCode().getReasonPhrase();
	this.headers = response.getHeaders();
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:7,代碼來源:RestTemplateResponse.java

示例2: save

import org.springframework.http.ResponseEntity; //導入方法依賴的package包/類
@Override
public void save(final String userName, final String secretKey, final int validationCode, final List<Integer> scratchCodes) {
    final MultifactorAuthenticationProperties.GAuth.Rest rest = gauth.getRest();
    final HttpHeaders headers = new HttpHeaders();
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
    headers.put("username", Arrays.asList(userName));
    headers.put("validationCode", Arrays.asList(String.valueOf(validationCode)));
    headers.put("secretKey", Arrays.asList(secretKey));
    headers.put("scratchCodes", scratchCodes.stream().map(String::valueOf).collect(Collectors.toList()));

    final HttpEntity<String> entity = new HttpEntity<>(headers);
    final ResponseEntity<Boolean> result = restTemplate.exchange(rest.getEndpointUrl(), HttpMethod.POST, entity, Boolean.class);
    if (result.getStatusCodeValue() == HttpStatus.OK.value()) {
        LOGGER.debug("Posted google authenticator account successfully");
    }
    LOGGER.warn("Failed to save google authenticator account successfully");
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:18,代碼來源:RestGoogleAuthenticatorTokenCredentialRepository.java

示例3: change

import org.springframework.http.ResponseEntity; //導入方法依賴的package包/類
@Override
public boolean change(final Credential c, final PasswordChangeBean bean) {
    final PasswordManagementProperties.Rest rest = passwordManagementProperties.getRest();
    if (StringUtils.isBlank(rest.getEndpointUrlChange())) {
        return false;
    }

    final UsernamePasswordCredential upc = (UsernamePasswordCredential) c;

    final HttpHeaders headers = new HttpHeaders();
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
    headers.put("username", Arrays.asList(upc.getUsername()));
    headers.put("password", Arrays.asList(bean.getPassword()));
    headers.put("oldPassword", Arrays.asList(upc.getPassword()));

    final HttpEntity<String> entity = new HttpEntity<>(headers);
    final ResponseEntity<Boolean> result = restTemplate.exchange(rest.getEndpointUrlEmail(), HttpMethod.POST, entity, Boolean.class);
    if (result.getStatusCodeValue() == HttpStatus.OK.value()) {
        return result.getBody();
    }
    return false;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:23,代碼來源:RestPasswordManagementService.java

示例4: findEmail

import org.springframework.http.ResponseEntity; //導入方法依賴的package包/類
@Override
public String findEmail(final String username) {
    final PasswordManagementProperties.Rest rest = passwordManagementProperties.getRest();
    if (StringUtils.isBlank(rest.getEndpointUrlEmail())) {
        return null;
    }

    final HttpHeaders headers = new HttpHeaders();
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
    headers.put("username", Arrays.asList(username));
    final HttpEntity<String> entity = new HttpEntity<>(headers);
    final ResponseEntity<String> result = restTemplate.exchange(rest.getEndpointUrlEmail(), HttpMethod.GET, entity, String.class);

    if (result.getStatusCodeValue() == HttpStatus.OK.value() && result.hasBody()) {
        return result.getBody();
    }
    return null;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:19,代碼來源:RestPasswordManagementService.java

示例5: getSecurityQuestions

import org.springframework.http.ResponseEntity; //導入方法依賴的package包/類
@Override
public Map<String, String> getSecurityQuestions(final String username) {
    final PasswordManagementProperties.Rest rest = passwordManagementProperties.getRest();
    if (StringUtils.isBlank(rest.getEndpointUrlSecurityQuestions())) {
        return null;
    }
    final HttpHeaders headers = new HttpHeaders();
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
    headers.put("username", Arrays.asList(username));
    final HttpEntity<String> entity = new HttpEntity<>(headers);
    final ResponseEntity<Map> result = restTemplate.exchange(rest.getEndpointUrlSecurityQuestions(),
            HttpMethod.GET, entity, Map.class);

    if (result.getStatusCodeValue() == HttpStatus.OK.value() && result.hasBody()) {
        return result.getBody();
    }
    return null;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:19,代碼來源:RestPasswordManagementService.java

示例6: placeOrder

import org.springframework.http.ResponseEntity; //導入方法依賴的package包/類
/**
 * Purchase something
 *
 * @param currencyMarketId the market on which to purchase
 * @param amount           the amount to buy
 * @param ppc              the price expected
 * @param category         trade-kind purchase or sale
 * @return the order confirmation
 */
public OrderData placeOrder(long currencyMarketId, double amount, double ppc, PurchaseCategory category) throws HashnestServiceException {
    NumberFormat nmbrFmt = new DecimalFormat("0.########", DecimalFormatSymbols.getInstance(Locale.US));

    Map<String, String> signature = keyGen.signature();
    signature.put("currency_market_id", String.valueOf(currencyMarketId));
    signature.put("amount", nmbrFmt.format(amount));
    signature.put("ppc", nmbrFmt.format(ppc));
    signature.put("category", category.code);

    ResponseEntity<String> response = callHashnestWithRetry(signature, String.class, API_GET_ORDERS_EXECUTE, "execute order");

    if (response == null) return null;

    OrderData orderData = null;

    if (response.getBody() != null && response.getStatusCodeValue() == 201) {
        log.debug("received order execution body as response: {}", response.getBody());

        ObjectMapper mapper = new ObjectMapper();
        try {
            orderData = mapper.readValue(response.getBody(), OrderData.class);
            log.debug("OrderData received, order has been placed {}", orderData);
        } catch (Exception e) {
            throw new HashnestServiceException(format("order failed to execute %s", response.getBody()));
        }
    }

    return orderData;
}
 
開發者ID:asciimo71,項目名稱:hashnest,代碼行數:39,代碼來源:HashnestServiceClient.java

示例7: getSecret

import org.springframework.http.ResponseEntity; //導入方法依賴的package包/類
@Override
public String getSecret(final String username) {
    final MultifactorAuthenticationProperties.GAuth.Rest rest = gauth.getRest();
    final HttpHeaders headers = new HttpHeaders();
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
    headers.put("username", Arrays.asList(username));

    final HttpEntity<String> entity = new HttpEntity<>(headers);
    final ResponseEntity<String> result = restTemplate.exchange(rest.getEndpointUrl(), HttpMethod.GET, entity, String.class);
    if (result.getStatusCodeValue() == HttpStatus.OK.value()) {
        return result.getBody();
    }
    return null;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:15,代碼來源:RestGoogleAuthenticatorTokenCredentialRepository.java


注:本文中的org.springframework.http.ResponseEntity.getStatusCodeValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。