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


Java MediaType.ALL_VALUE屬性代碼示例

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


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

示例1: plantain

@RequestMapping(value = "dummy/plantain", method = RequestMethod.POST, produces = {"text/xml"}, consumes = MediaType.ALL_VALUE)
    String plantain(HttpServletRequest request) throws IOException, NoSuchAlgorithmException {
        testData = initTestData();
//        Получаем данные из request
        Map<String, String> headers = getHeadersInfo(request);
        String body = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
        LOG.info("Request body:\n " + body);
//        Создаем экземпляры запроса и ответа
        if (checkHeader(headers, OPERATION_CHECK_CARD)) {
            CheckCardRequest checkCardRequest = new CheckCardRequest(body);
            CheckCardResponse checkCardResponse = new CheckCardResponse();
//          Составляем ответ
            checkCardResponse
                    .setResultCode("0")
                    .setResultString("OK")
                    .setRequestHash(checkCardRequest.getHash())
                    .calculateHash()
                    .createSOAPRequest();
            LOG.info("RequestHash: " + checkCardRequest.getHash());
            LOG.info("response: \n" + checkCardResponse.getResponse());
            return checkCardResponse.getResponse();
        }
        if (checkHeader(headers, OPERATION_SEND_PAYMENT_KOP)) {
            SendPaymentKopRequest sendPaymentKopRequest = new SendPaymentKopRequest(body);
            SendPaymentKopResponse sendPaymentKopResponse = new SendPaymentKopResponse();
//          Составляем ответ
            sendPaymentKopResponse
                    .setResultCode("0")
                    .setResultString("OK")
                    .setSodTime(sendPaymentKopRequest.getAgentTime())
                    .setRequestHash(sendPaymentKopRequest.getHash())
                    .calculateHash()
                    .createSOAPRequest();
            LOG.info("RequestHash: " + sendPaymentKopRequest.getHash());
            LOG.info("response: \n" + sendPaymentKopResponse.getResponse());
            return sendPaymentKopResponse.getResponse();
        }
        return null;
    }
 
開發者ID:asmodeirus,項目名稱:BackOffice,代碼行數:39,代碼來源:PlantainController.java

示例2: mediaTypesAndExpectedStatuses

@DataProvider
public Object[][] mediaTypesAndExpectedStatuses() {
    return new Object[][] { new Object[] { MediaType.ALL_VALUE, MockMvcResultMatchers.status().isOk() },
            { MediaType.APPLICATION_JSON_VALUE, MockMvcResultMatchers.status().isOk() },
            { MimeTypes.Type.APPLICATION_JSON_UTF_8.toString(), MockMvcResultMatchers.status().isOk() },
            { MediaType.APPLICATION_JSON_VALUE + ", application/*+json", MockMvcResultMatchers.status().isOk() },
            { MediaType.TEXT_PLAIN_VALUE, MockMvcResultMatchers.status().isOk() },
            { MimeTypes.Type.TEXT_PLAIN_UTF_8.toString(), MockMvcResultMatchers.status().isOk() },
            { "text/*+plain, " + MediaType.TEXT_PLAIN_VALUE, MockMvcResultMatchers.status().isOk() },
            { "fake/type, " + MediaType.TEXT_PLAIN_VALUE, MockMvcResultMatchers.status().isOk() },
            { "fake/type", MockMvcResultMatchers.status().isNotAcceptable() } };
}
 
開發者ID:eclipse,項目名稱:keti,代碼行數:12,代碼來源:AbstractHttpMethodsFilterTest.java


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