本文整理汇总了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;
}
示例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() } };
}