本文整理匯總了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() } };
}