当前位置: 首页>>代码示例>>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;未经允许,请勿转载。