Here are the examples of the java api org.springframework.http.HttpStatus.NOT_ACCEPTABLE taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
60 Examples
19
View Source File : StatusResultMatchers.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* replacedert the response status code is {@code HttpStatus.NOT_ACCEPTABLE} (406).
*/
public ResultMatcher isNotAcceptable() {
return matcher(HttpStatus.NOT_ACCEPTABLE);
}
19
View Source File : ProjectApiController.java
License : Apache License 2.0
Project Creator : opendevstack
License : Apache License 2.0
Project Creator : opendevstack
/**
* Validate the project's key name. Duplicates are not allowed in most bugtrackers.
*
* @param key the project's name to validate against
* @return Response with HTTP status. If 406 a project with this key exists in JIRA
*/
@PreAuthorizeAllRoles
@RequestMapping(method = RequestMethod.GET, value = "/key/validate")
public ResponseEnreplacedy<Object> validateKey(@RequestParam(value = "projectKey") String key) {
if (jiraAdapter.projectKeyExists(key)) {
HashMap<String, Object> result = new HashMap<>();
result.put("error", true);
result.put("error_message", "A key with this name exists");
return ResponseEnreplacedy.status(HttpStatus.NOT_ACCEPTABLE).body(result);
}
return ResponseEnreplacedy.ok().build();
}
19
View Source File : ProjectApiController.java
License : Apache License 2.0
Project Creator : opendevstack
License : Apache License 2.0
Project Creator : opendevstack
/**
* Validate the project name. Duplicates are not allowed in most bugtrackers.
*
* @param name the project's name
* @return Response with HTTP status. If 406 a project with this name exists in JIRA
*/
@PreAuthorizeAllRoles
@RequestMapping(method = RequestMethod.GET, value = "/validate")
public ResponseEnreplacedy<Object> validateProject(@RequestParam(value = "projectName") String name) {
if (jiraAdapter.projectKeyExists(name)) {
HashMap<String, Object> result = new HashMap<>();
result.put("error", true);
result.put("error_message", "A project with this name exists");
return ResponseEnreplacedy.status(HttpStatus.NOT_ACCEPTABLE).body(result);
}
return ResponseEnreplacedy.ok().build();
}
19
View Source File : ControllerExceptionHandler.java
License : GNU General Public License v3.0
Project Creator : halo-dev
License : GNU General Public License v3.0
Project Creator : halo-dev
@ExceptionHandler(HttpMediaTypeNotAcceptableException.clreplaced)
@ResponseStatus(HttpStatus.NOT_ACCEPTABLE)
public BaseResponse<?> handleHttpMediaTypeNotAcceptableException(HttpMediaTypeNotAcceptableException e) {
BaseResponse<?> baseResponse = handleBaseException(e);
baseResponse.setStatus(HttpStatus.NOT_ACCEPTABLE.value());
return baseResponse;
}
19
View Source File : HttpMediaTypeNotAcceptableExceptionHandler.java
License : Apache License 2.0
Project Creator : eclipse
License : Apache License 2.0
Project Creator : eclipse
@ExceptionHandler(HttpMediaTypeNotAcceptableException.clreplaced)
@ResponseStatus(HttpStatus.NOT_ACCEPTABLE)
@ResponseBody
public RestApiErrorResponse handleException(final HttpMediaTypeNotAcceptableException e) {
return super.handleException(e, HttpStatus.NOT_ACCEPTABLE.getReasonPhrase());
}
19
View Source File : ACSAcceptanceIT.java
License : Apache License 2.0
Project Creator : eclipse
License : Apache License 2.0
Project Creator : eclipse
// TODO: Remove this test when the "httpValidation" Spring profile is removed
@Test
public void testHttpValidationBasedOnActiveSpringProfile() throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.ACCEPT, MediaType.TEXT_HTML_VALUE);
if (!Arrays.asList(this.environment.getActiveProfiles()).contains("httpValidation")) {
replacedert.replacedertEquals(this.getMonitoringApiResponse(headers).getStatusCode(), HttpStatus.OK);
return;
}
try {
this.getMonitoringApiResponse(headers);
replacedert.fail("Expected an HttpMediaTypeNotAcceptableException exception to be thrown");
} catch (final HttpClientErrorException e) {
replacedert.replacedertEquals(e.getStatusCode(), HttpStatus.NOT_ACCEPTABLE);
}
}
19
View Source File : RestExceptionHandler.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@ExceptionHandler
ResponseEnreplacedy<Object> handle(NotAcceptableException exception) {
logError(exception);
return ResponseEnreplacedy.status(HttpStatus.NOT_ACCEPTABLE).headers(addErrorOriginationHeader(new HttpHeaders(), ErrorOrigination.BANK)).build();
}
18
View Source File : ControllerEndpointHandlerMappingIntegrationTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void getWithUnacceptableContentType() {
this.contextRunner.run(withWebTestClient((webTestClient) -> webTestClient.get().uri("/actuator/example/one").accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isEqualTo(HttpStatus.NOT_ACCEPTABLE)));
}
18
View Source File : App37Test.java
License : Apache License 2.0
Project Creator : qaware
License : Apache License 2.0
Project Creator : qaware
@Test
public void getOpenApiAsJson_withAcceptTextHtml() throws Exception {
performApiDocsRequest(x -> x, x -> x.accept(new MediaType("text", "html"))).expectStatus().isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : RestFilter.java
License : MIT License
Project Creator : kkaravitis
License : MIT License
Project Creator : kkaravitis
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
try {
RestServiceRequest restServiceRequest = new RestServiceRequest(request);
chain.doFilter(restServiceRequest, response);
} catch (Exception e) {
((HttpServletResponse) response).setStatus(HttpStatus.NOT_ACCEPTABLE.value());
}
}
18
View Source File : TreatmentControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_post_return_406_for_invalid_case_id() throws Exception {
// given
Treatment treatmentEnreplacedy = new Treatment();
treatmentEnreplacedy.setDescription("Lorem ipsum");
Case caseEnreplacedy = new Case();
treatmentEnreplacedy.setRelevantCase(caseEnreplacedy);
caseEnreplacedy.setId(121132L);
// when
ResponseEnreplacedy<Void> responseEnreplacedy = testRestTemplate.withBasicAuth("1", "1").postForEnreplacedy("/v1/treatments", treatmentEnreplacedy, Void.clreplaced);
// then
replacedertThat(responseEnreplacedy.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : TreatmentControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_post_return_406_for_null_case_id() throws Exception {
// given
Treatment treatmentEnreplacedy = new Treatment();
treatmentEnreplacedy.setDescription("Lorem ipsum");
Case caseEnreplacedy = new Case();
treatmentEnreplacedy.setRelevantCase(caseEnreplacedy);
// when
ResponseEnreplacedy<Void> responseEnreplacedy = testRestTemplate.withBasicAuth("1", "1").postForEnreplacedy("/v1/treatments", treatmentEnreplacedy, Void.clreplaced);
// then
replacedertThat(responseEnreplacedy.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : TreatmentControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_post_return_406_for_invalid_case() throws Exception {
// given
Treatment treatmentEnreplacedy = new Treatment();
treatmentEnreplacedy.setDescription("Lorem ipsum");
// when
ResponseEnreplacedy<Void> responseEnreplacedy = testRestTemplate.withBasicAuth("1", "1").postForEnreplacedy("/v1/treatments", treatmentEnreplacedy, Void.clreplaced);
// then
replacedertThat(responseEnreplacedy.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : MedicineControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_post_medicine_return_406_when_replacedigned_to_not_persisted_case() throws Exception {
// given
Medicine medicine = new Medicine();
medicine.setName("Lorem ipsum");
Case caseEnreplacedy = new Case();
medicine.setRelevantCase(caseEnreplacedy);
// when
ResponseEnreplacedy responseEnreplacedy = testRestTemplate.withBasicAuth("1", "1").postForEnreplacedy(url, medicine, Void.clreplaced);
// then
replacedertThat(responseEnreplacedy.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : MedicineControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_put_medicine_return_406_when_replacedigned_to_deleted_case() throws Exception {
// given
ResponseEnreplacedy<Void> postResponse = postMedicineAndGetResponse();
URI location = postResponse.getHeaders().getLocation();
String id = RestHelper.extractIdStringFromURI(location);
Medicine savedMedicine = medicineRepository.findOne(Long.parseLong(id));
theCase.setId(19783L);
savedMedicine.setRelevantCase(theCase);
// when
ResponseEnreplacedy putResponse = testRestTemplate.withBasicAuth("1", "1").exchange(url + "/" + id, HttpMethod.PUT, new HttpEnreplacedy<>(savedMedicine), Void.clreplaced);
// then
Matcherreplacedert.replacedertThat(putResponse.getStatusCode(), equalTo(HttpStatus.NOT_ACCEPTABLE));
}
18
View Source File : MedicineControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_put_medicine_return_406_when_not_replacedigned_to_case() throws Exception {
// given
ResponseEnreplacedy<Void> postResponse = postMedicineAndGetResponse();
URI location = postResponse.getHeaders().getLocation();
String id = RestHelper.extractIdStringFromURI(location);
Medicine savedMedicine = medicineRepository.findOne(Long.parseLong(id));
savedMedicine.setRelevantCase(null);
// when
ResponseEnreplacedy<Void> putResponse = testRestTemplate.withBasicAuth("1", "1").exchange(url + "/" + id, HttpMethod.PUT, new HttpEnreplacedy<>(savedMedicine), Void.clreplaced);
// then
replacedertThat(putResponse.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : MedicineControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_post_medicine_return_406_when_replacedigned_to_deleted_case() throws Exception {
// given
Medicine medicine = new Medicine();
medicine.setName("Lorem ipsum");
Case caseEnreplacedy = new Case();
medicine.setRelevantCase(caseEnreplacedy);
caseEnreplacedy.setId(32145L);
// when
ResponseEnreplacedy responseEnreplacedy = testRestTemplate.withBasicAuth("1", "1").postForEnreplacedy(url, medicine, Void.clreplaced);
// then
replacedertThat(responseEnreplacedy.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : MedicineControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_post_medicine_return_406_when_not_replacedigned_to_case() throws Exception {
// given
Medicine medicine = new Medicine();
medicine.setName("Lorem ipsum");
// when
ResponseEnreplacedy<Void> responseEnreplacedy = testRestTemplate.withBasicAuth("1", "1").postForEnreplacedy(url, medicine, Void.clreplaced);
// then
replacedertThat(responseEnreplacedy.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : MedicineControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_put_medicine_return_406_when_replacedigned_to_not_persisted_case() throws Exception {
// given
ResponseEnreplacedy<Void> postResponse = postMedicineAndGetResponse();
URI location = postResponse.getHeaders().getLocation();
String id = RestHelper.extractIdStringFromURI(location);
Medicine savedMedicine = medicineRepository.findOne(Long.parseLong(id));
theCase.setId(null);
savedMedicine.setRelevantCase(theCase);
// when
ResponseEnreplacedy putResponse = testRestTemplate.withBasicAuth("1", "1").exchange(url + "/" + id, HttpMethod.PUT, new HttpEnreplacedy<>(savedMedicine), Void.clreplaced);
// then
replacedertThat(putResponse.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : CaseControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_put_return_406_when_symptoms_no_set() throws Exception {
// given
Case caseEnreplacedy = new Case();
caseEnreplacedy.setIllnessStartDate(LocalDate.MAX);
caseEnreplacedy.setNickname("R2-D2");
caseEnreplacedy.setSymptoms("Lorem ipsum dolor sit amet");
caseEnreplacedy.setNote("superiz");
Case persistedCase = caseRepository.save(caseEnreplacedy);
Long caseId = persistedCase.getId();
Case updatedCaseOnClientSide = persistedCase;
updatedCaseOnClientSide.setSymptoms(null);
// when
ResponseEnreplacedy<Void> putResponse = testRestTemplate.withBasicAuth("1", "1").exchange("/v1/cases/" + caseId, HttpMethod.PUT, new HttpEnreplacedy<>(updatedCaseOnClientSide), Void.clreplaced);
// then
replacedertThat(putResponse.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : CaseControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_post_return_406_for_invalid_case() throws Exception {
// given
Case caseEnreplacedy = new Case();
// when
ResponseEnreplacedy<Void> responseEnreplacedy = testRestTemplate.withBasicAuth("1", "1").postForEnreplacedy("/v1/cases", caseEnreplacedy, Void.clreplaced);
// then
replacedertThat(responseEnreplacedy.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : CaseControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_put_return_406_when_nickname_not_set() throws Exception {
// given
Case caseEnreplacedy = new Case();
caseEnreplacedy.setIllnessStartDate(LocalDate.MAX);
caseEnreplacedy.setNickname("R2-D2");
caseEnreplacedy.setSymptoms("Lorem ipsum dolor sit amet");
caseEnreplacedy.setNote("superiz");
Case persistedCase = caseRepository.save(caseEnreplacedy);
Long caseId = persistedCase.getId();
Case updatedCaseOnClientSide = persistedCase;
updatedCaseOnClientSide.setNickname(null);
// when
ResponseEnreplacedy<Void> putResponse = testRestTemplate.withBasicAuth("1", "1").exchange("/v1/cases/" + caseEnreplacedy.getId(), HttpMethod.PUT, new HttpEnreplacedy<>(updatedCaseOnClientSide), Void.clreplaced);
// then
replacedertThat(putResponse.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : CaseControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_put_return_406_when_case_not_have_an_id() throws Exception {
// given
Case caseEnreplacedy = new Case();
caseEnreplacedy.setIllnessStartDate(LocalDate.MAX);
caseEnreplacedy.setNickname("R2-D2");
caseEnreplacedy.setSymptoms("Lorem ipsum dolor sit amet");
caseEnreplacedy.setNote("superiz");
Case persistedCase = caseRepository.save(caseEnreplacedy);
Long caseId = persistedCase.getId();
Case updatedCaseOnClientSide = persistedCase;
updatedCaseOnClientSide.setId(null);
// when
ResponseEnreplacedy<Void> putResponse = testRestTemplate.withBasicAuth("1", "1").exchange("/v1/cases/" + caseId, HttpMethod.PUT, new HttpEnreplacedy<>(updatedCaseOnClientSide), Void.clreplaced);
// then
replacedertThat(putResponse.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : CaseControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_put_return_406_when_illnessStartDate_not_set() throws Exception {
// given
Case caseEnreplacedy = new Case();
caseEnreplacedy.setIllnessStartDate(LocalDate.MAX);
caseEnreplacedy.setNickname("R2-D2");
caseEnreplacedy.setSymptoms("Lorem ipsum dolor sit amet");
caseEnreplacedy.setNote("superiz");
Case persistedCase = caseRepository.save(caseEnreplacedy);
Long caseId = persistedCase.getId();
Case updatedCaseOnClientSide = persistedCase;
updatedCaseOnClientSide.setIllnessStartDate(null);
// when
ResponseEnreplacedy<Void> putResponse = testRestTemplate.withBasicAuth("1", "1").exchange("/v1/cases/" + caseId, HttpMethod.PUT, new HttpEnreplacedy<>(updatedCaseOnClientSide), Void.clreplaced);
// then
replacedertThat(putResponse.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
18
View Source File : SecHubExecutionScenario2IntTest.java
License : MIT License
Project Creator : Daimler
License : MIT License
Project Creator : Daimler
@Test
public void when_user_exists_user_cannot_be_signed_in_again() {
/* @formatter:off */
replacedertUser(USER_1).doesExist();
/* already created */
// signup is not existing
replacedertSignup(USER_1).doesNotExist();
TestUser newUser = new AnonymousTestUser(USER_1.getUserId(), "somewhere." + System.currentTimeMillis() + "@example.org");
/* execute + test */
expectHttpFailure(() -> as(ANONYMOUS).signUpAs(newUser), HttpStatus.NOT_ACCEPTABLE);
/* @formatter:on */
}
18
View Source File : SecHubExecutionScenario2IntTest.java
License : MIT License
Project Creator : Daimler
License : MIT License
Project Creator : Daimler
@Test
public void when_another_user_has_got_the_email_used_for_signup_but_different_name_user_cannot_be_signed_in_again() {
/* @formatter:off */
replacedertUser(USER_1).doesExist();
/* already created */
String name = "u_" + System.currentTimeMillis();
if (name.length() > 15 || name.length() < 5) {
throw new IllegalStateException("testcase corrupt - name invalid:" + name + ". Testcase checks only for same email recognized. Name must be correct here!");
}
TestUser newUser = new AnonymousTestUser(name, USER_1.getEmail());
/* execute + test */
expectHttpFailure(() -> as(ANONYMOUS).signUpAs(newUser), HttpStatus.NOT_ACCEPTABLE);
/* @formatter:on */
}
18
View Source File : SecHubExecutionScenario2IntTest.java
License : MIT License
Project Creator : Daimler
License : MIT License
Project Creator : Daimler
@Test
public void when_admin_updates_whitelist_of_project_to_empty_list_user_is_replacedigned_to_project_but_job_cannot_be_started__HTTP_STATUS_406_NOT_ACCEPTABLE() {
/* @formatter:off */
/* prepare */
replacedertProject(PROJECT_1).doesExist();
as(SUPER_ADMIN).replacedignUserToProject(USER_1, PROJECT_1);
/* execute */
as(SUPER_ADMIN).updateWhiteListForProject(PROJECT_1, Arrays.asList());
/* test */
replacedertUser(USER_1).doesExist().isreplacedignedToProject(PROJECT_1).canNotCreateWebScan(PROJECT_1, HttpStatus.NOT_ACCEPTABLE);
/* @formatter:on */
}
18
View Source File : UserRegistrationScenario1IntTest.java
License : MIT License
Project Creator : Daimler
License : MIT License
Project Creator : Daimler
/* +-----------------------------------------------------------------------+ */
/* +............................ Registration . ...........................+ */
/* +-----------------------------------------------------------------------+ */
@Test
public void an_existing_signup_is_not_added_twice() {
/* @formatter:off */
as(ANONYMOUS).signUpAs(USER_1);
replacedertSignup(USER_1).doesExist();
/* execute + test */
expectHttpFailure(() -> as(ANONYMOUS).signUpAs(USER_1), HttpStatus.NOT_ACCEPTABLE);
/* @formatter:on */
}
18
View Source File : FundDistributionService.java
License : GNU General Public License v3.0
Project Creator : coti-io
License : GNU General Public License v3.0
Project Creator : coti-io
public ResponseEnreplacedy<IResponse> distributeFundFromFile(AddFundDistributionsRequest request) {
AtomicLong acceptedDistributionNumber = new AtomicLong(0);
AtomicLong notAcceptedDistributionNumber = new AtomicLong(0);
Thread monitorDistributionFile = monitorDistributionFile(acceptedDistributionNumber, notAcceptedDistributionNumber);
try {
Instant now = Instant.now();
Hash hashOfToday = getHashOfDate(now);
DailyFundDistributionFileData fundDistributionFileByDayByHash = dailyFundDistributionFiles.getByHash(hashOfToday);
if (fundDistributionFileByDayByHash != null) {
return ResponseEnreplacedy.status(HttpStatus.NOT_ACCEPTABLE).body(new Response(DISTRIBUTION_FILE_ALREADY_PROCESSED, STATUS_ERROR));
}
List<FundDistributionData> fundDistributionFileDataEntries = new ArrayList<>();
ResponseEnreplacedy<IResponse> distributionFileVerificationResponse = verifyDailyDistributionFile(request, fundDistributionFileDataEntries);
if (distributionFileVerificationResponse != null) {
return distributionFileVerificationResponse;
}
monitorDistributionFile.start();
ResponseEnreplacedy<IResponse> responseEnreplacedy = updateWithTransactionsEntriesFromVerifiedFile(fundDistributionFileDataEntries, acceptedDistributionNumber, notAcceptedDistributionNumber);
if (responseEnreplacedy.getStatusCode().equals(HttpStatus.OK)) {
String fileName = request.getFileName();
DailyFundDistributionFileData fundDistributionFileOfDay = new DailyFundDistributionFileData(now, fileName);
dailyFundDistributionFiles.put(fundDistributionFileOfDay);
}
return responseEnreplacedy;
} finally {
if (monitorDistributionFile.isAlive()) {
monitorDistributionFile.interrupt();
}
}
}
18
View Source File : ServletWebErrorHandlerTest.java
License : Apache License 2.0
Project Creator : alimate
License : Apache License 2.0
Project Creator : alimate
private Object[] provideParamsForHandle() {
return p(p(new HttpMessageNotReadableException("", mock(HttpInputMessage.clreplaced)), INVALID_OR_MISSING_BODY, BAD_REQUEST, emptyMap()), p(new HttpMediaTypeNotAcceptableException(asList(APPLICATION_JSON, MediaType.APPLICATION_PDF)), ServletWebErrorHandler.NOT_ACCEPTABLE, HttpStatus.NOT_ACCEPTABLE, singletonMap(ServletWebErrorHandler.NOT_ACCEPTABLE, singletonList(arg("types", new HashSet<>(asList(APPLICATION_JSON_VALUE, APPLICATION_PDF_VALUE)))))), p(new HttpMediaTypeNotSupportedException(APPLICATION_JSON, emptyList()), NOT_SUPPORTED, UNSUPPORTED_MEDIA_TYPE, singletonMap(NOT_SUPPORTED, singletonList(arg("type", APPLICATION_JSON_VALUE)))), p(new HttpRequestMethodNotSupportedException("POST"), ServletWebErrorHandler.METHOD_NOT_ALLOWED, HttpStatus.METHOD_NOT_ALLOWED, singletonMap(ServletWebErrorHandler.METHOD_NOT_ALLOWED, singletonList(arg("method", "POST")))), p(new MissingServletRequestParameterException("name", "String"), MISSING_PARAMETER, BAD_REQUEST, singletonMap(MISSING_PARAMETER, asList(arg("name", "name"), arg("expected", "String")))), p(new MissingServletRequestPartException("file"), MISSING_PART, BAD_REQUEST, singletonMap(MISSING_PART, singletonList(arg("name", "file")))), p(new NoHandlerFoundException("POST", "/test", null), NO_HANDLER, NOT_FOUND, singletonMap(NO_HANDLER, singletonList(arg("path", "/test")))), p(new ServletException(), "unknown_error", INTERNAL_SERVER_ERROR, emptyMap()));
}
18
View Source File : PIS406ErrorMapper.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@Override
public HttpStatus getErrorStatus() {
return HttpStatus.NOT_ACCEPTABLE;
}
17
View Source File : AbstractResponseStatusExceptionHandlerTests.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
// gh-23741
@Test
public void handleResponseStatusExceptionWithHeaders() {
Throwable ex = new NotAcceptableStatusException(Arrays.asList(MediaType.TEXT_PLAIN, MediaType.TEXT_HTML));
this.handler.handle(this.exchange, ex).block(Duration.ofSeconds(5));
MockServerHttpResponse response = this.exchange.getResponse();
replacedertThat(response.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
replacedertThat(response.getHeaders().getAccept()).containsOnly(MediaType.TEXT_PLAIN, MediaType.TEXT_HTML);
}
17
View Source File : SafeRuleServiceImpl.java
License : Apache License 2.0
Project Creator : matevip
License : Apache License 2.0
Project Creator : matevip
@Override
public Mono<Void> filterBlackList(ServerWebExchange exchange) {
Stopwatch stopwatch = Stopwatch.createStarted();
ServerHttpRequest request = exchange.getRequest();
ServerHttpResponse response = exchange.getResponse();
try {
URI originUri = getOriginRequestUri(exchange);
String requestIp = RequestHolder.getServerHttpRequestIpAddress(request);
String requestMethod = request.getMethodValue();
AtomicBoolean forbid = new AtomicBoolean(false);
// 从缓存中获取黑名单信息
Set<Object> blackLists = ruleCacheService.getBlackList(requestIp);
blackLists.addAll(ruleCacheService.getBlackList());
// 检查是否在黑名单中
checkBlackLists(forbid, blackLists, originUri, requestMethod);
log.debug("黑名单检查完成 - {}", stopwatch.stop());
if (forbid.get()) {
log.info("属于黑名单地址 - {}", originUri.getPath());
return ResponseUtil.webFluxResponseWriter(response, MediaType.APPLICATION_JSON_VALUE, HttpStatus.NOT_ACCEPTABLE, Result.data(HttpStatus.NOT_ACCEPTABLE.value(), "", "已列入黑名单,访问受限"));
}
} catch (Exception e) {
log.error("黑名单检查异常: {} - {}", e.getMessage(), stopwatch.stop());
}
return null;
}
17
View Source File : ResponseEntityExceptionHandler.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
/**
* Provides handling for standard Spring MVC exceptions.
* @param ex the target exception
* @param request the current request
*/
@ExceptionHandler({ NoSuchRequestHandlingMethodException.clreplaced, HttpRequestMethodNotSupportedException.clreplaced, HttpMediaTypeNotSupportedException.clreplaced, HttpMediaTypeNotAcceptableException.clreplaced, MissingPathVariableException.clreplaced, MissingServletRequestParameterException.clreplaced, ServletRequestBindingException.clreplaced, ConversionNotSupportedException.clreplaced, TypeMismatchException.clreplaced, HttpMessageNotReadableException.clreplaced, HttpMessageNotWritableException.clreplaced, MethodArgumentNotValidException.clreplaced, MissingServletRequestPartException.clreplaced, BindException.clreplaced, NoHandlerFoundException.clreplaced })
public final ResponseEnreplacedy<Object> handleException(Exception ex, WebRequest request) {
HttpHeaders headers = new HttpHeaders();
if (ex instanceof NoSuchRequestHandlingMethodException) {
HttpStatus status = HttpStatus.NOT_FOUND;
return handleNoSuchRequestHandlingMethod((NoSuchRequestHandlingMethodException) ex, headers, status, request);
} else if (ex instanceof HttpRequestMethodNotSupportedException) {
HttpStatus status = HttpStatus.METHOD_NOT_ALLOWED;
return handleHttpRequestMethodNotSupported((HttpRequestMethodNotSupportedException) ex, headers, status, request);
} else if (ex instanceof HttpMediaTypeNotSupportedException) {
HttpStatus status = HttpStatus.UNSUPPORTED_MEDIA_TYPE;
return handleHttpMediaTypeNotSupported((HttpMediaTypeNotSupportedException) ex, headers, status, request);
} else if (ex instanceof HttpMediaTypeNotAcceptableException) {
HttpStatus status = HttpStatus.NOT_ACCEPTABLE;
return handleHttpMediaTypeNotAcceptable((HttpMediaTypeNotAcceptableException) ex, headers, status, request);
} else if (ex instanceof MissingPathVariableException) {
HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
return handleMissingPathVariable((MissingPathVariableException) ex, headers, status, request);
} else if (ex instanceof MissingServletRequestParameterException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleMissingServletRequestParameter((MissingServletRequestParameterException) ex, headers, status, request);
} else if (ex instanceof ServletRequestBindingException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleServletRequestBindingException((ServletRequestBindingException) ex, headers, status, request);
} else if (ex instanceof ConversionNotSupportedException) {
HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
return handleConversionNotSupported((ConversionNotSupportedException) ex, headers, status, request);
} else if (ex instanceof TypeMismatchException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleTypeMismatch((TypeMismatchException) ex, headers, status, request);
} else if (ex instanceof HttpMessageNotReadableException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleHttpMessageNotReadable((HttpMessageNotReadableException) ex, headers, status, request);
} else if (ex instanceof HttpMessageNotWritableException) {
HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
return handleHttpMessageNotWritable((HttpMessageNotWritableException) ex, headers, status, request);
} else if (ex instanceof MethodArgumentNotValidException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleMethodArgumentNotValid((MethodArgumentNotValidException) ex, headers, status, request);
} else if (ex instanceof MissingServletRequestPartException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleMissingServletRequestPart((MissingServletRequestPartException) ex, headers, status, request);
} else if (ex instanceof BindException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleBindException((BindException) ex, headers, status, request);
} else if (ex instanceof NoHandlerFoundException) {
HttpStatus status = HttpStatus.NOT_FOUND;
return handleNoHandlerFoundException((NoHandlerFoundException) ex, headers, status, request);
} else {
logger.warn("Unknown exception type: " + ex.getClreplaced().getName());
HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
return handleExceptionInternal(ex, null, headers, status, request);
}
}
17
View Source File : TreatmentControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_put_return_406__when_replacedigned_to_not_persisted_case() throws Exception {
// given
ResponseEnreplacedy<Void> postResponse = getCreateTreatmentResponse();
URI location = postResponse.getHeaders().getLocation();
String id = RestHelper.extractIdStringFromURI(location);
Treatment savedTreatment = treatmentRepository.findOne(Long.parseLong(id));
theCase.setId(null);
savedTreatment.setRelevantCase(theCase);
// when
ResponseEnreplacedy<Void> putResponse = testRestTemplate.withBasicAuth("1", "1").exchange("/v1/treatments/" + id, HttpMethod.PUT, new HttpEnreplacedy<>(savedTreatment), Void.clreplaced);
// then
replacedertThat(putResponse.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
17
View Source File : TreatmentControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_put_return_406_when_replacedigned_to_deleted_case() throws Exception {
// given
ResponseEnreplacedy<Void> postResponse = getCreateTreatmentResponse();
URI location = postResponse.getHeaders().getLocation();
String id = RestHelper.extractIdStringFromURI(location);
Treatment savedTreatment = treatmentRepository.findOne(Long.parseLong(id));
theCase.setId(104243L);
savedTreatment.setRelevantCase(theCase);
// when
ResponseEnreplacedy<Void> putResponse = testRestTemplate.withBasicAuth("1", "1").exchange("/v1/treatments/" + id, HttpMethod.PUT, new HttpEnreplacedy<>(savedTreatment), Void.clreplaced);
// then
replacedertThat(putResponse.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
17
View Source File : TreatmentControllerIT.java
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
License : GNU General Public License v3.0
Project Creator : JUGIstanbul
@Test
public void should_put_return_406_when_not_replacedigned_to_case() throws Exception {
// given
ResponseEnreplacedy<Void> postResponse = getCreateTreatmentResponse();
URI location = postResponse.getHeaders().getLocation();
String id = RestHelper.extractIdStringFromURI(location);
Treatment savedTreatment = treatmentRepository.findOne(Long.parseLong(id));
savedTreatment.setRelevantCase(null);
// when
ResponseEnreplacedy<Void> putResponse = testRestTemplate.withBasicAuth("1", "1").exchange("/v1/treatments/" + id, HttpMethod.PUT, new HttpEnreplacedy<>(savedTreatment), Void.clreplaced);
// then
replacedertThat(putResponse.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
17
View Source File : AbstractHttpMethodsFilter.java
License : Apache License 2.0
Project Creator : eclipse
License : Apache License 2.0
Project Creator : eclipse
private static void sendNotAcceptableError(final HttpServletResponse response) throws IOException {
addCommonResponseHeaders(response);
response.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE, HttpStatus.NOT_ACCEPTABLE.getReasonPhrase());
}
17
View Source File : CrudControllerAdvice.java
License : BSD 3-Clause "New" or "Revised" License
Project Creator : dhis2
License : BSD 3-Clause "New" or "Revised" License
Project Creator : dhis2
@ExceptionHandler(HttpMediaTypeNotAcceptableException.clreplaced)
public void httpMediaTypeNotAcceptableExceptionHandler(HttpMediaTypeNotAcceptableException ex, HttpServletRequest request, HttpServletResponse response) {
webMessageService.send(WebMessageUtils.createWebMessage(ex.getMessage(), Status.ERROR, HttpStatus.NOT_ACCEPTABLE), response, request);
}
17
View Source File : SecHubExceptionHandler.java
License : MIT License
Project Creator : Daimler
License : MIT License
Project Creator : Daimler
private String commonHandleFileUploadSizeExceed(Exception ex, HttpServletResponse response) {
if (response == null) {
throw new IllegalStateException("response missing");
}
if (ex == null) {
throw new IllegalStateException("exception missing");
}
response.setStatus(HttpStatus.NOT_ACCEPTABLE.value());
return "File upload maximum reached. Please reduce your upload file size.";
}
17
View Source File : PDSExceptionHandler.java
License : MIT License
Project Creator : Daimler
License : MIT License
Project Creator : Daimler
private Exception commonHandleFileUploadSizeExceed(Exception ex, HttpServletResponse response) {
if (response == null) {
throw new IllegalStateException("response missing");
}
if (ex == null) {
throw new IllegalStateException("exception missing");
}
response.setStatus(HttpStatus.NOT_ACCEPTABLE.value());
return ex;
}
17
View Source File : CommonErrorControllerTest.java
License : Apache License 2.0
Project Creator : bliblidotcom
License : Apache License 2.0
Project Creator : bliblidotcom
@Test
void testNotAcceptableStatusException() {
webTestClient.get().uri("/NotAcceptableStatusException").exchange().expectStatus().isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
17
View Source File : PIS406ErrorMapperTest.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@Test
void getErrorStatus_shouldReturn406() {
// When
HttpStatus errorStatus = pis406ErrorMapper.getErrorStatus();
// Then
replacedertEquals(HttpStatus.NOT_ACCEPTABLE, errorStatus);
}
17
View Source File : AIS406ErrorMapperTest.java
License : Apache License 2.0
Project Creator : adorsys
License : Apache License 2.0
Project Creator : adorsys
@Test
void getErrorStatus_shouldReturn406() {
// When
HttpStatus errorStatus = ais406ErrorMapper.getErrorStatus();
// Then
replacedertEquals(HttpStatus.NOT_ACCEPTABLE, errorStatus);
}
16
View Source File : ResponseEntityExceptionHandler.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Provides handling for standard Spring MVC exceptions.
* @param ex the target exception
* @param request the current request
*/
@ExceptionHandler({ HttpRequestMethodNotSupportedException.clreplaced, HttpMediaTypeNotSupportedException.clreplaced, HttpMediaTypeNotAcceptableException.clreplaced, MissingPathVariableException.clreplaced, MissingServletRequestParameterException.clreplaced, ServletRequestBindingException.clreplaced, ConversionNotSupportedException.clreplaced, TypeMismatchException.clreplaced, HttpMessageNotReadableException.clreplaced, HttpMessageNotWritableException.clreplaced, MethodArgumentNotValidException.clreplaced, MissingServletRequestPartException.clreplaced, BindException.clreplaced, NoHandlerFoundException.clreplaced, AsyncRequestTimeoutException.clreplaced })
@Nullable
public final ResponseEnreplacedy<Object> handleException(Exception ex, WebRequest request) throws Exception {
HttpHeaders headers = new HttpHeaders();
if (ex instanceof HttpRequestMethodNotSupportedException) {
HttpStatus status = HttpStatus.METHOD_NOT_ALLOWED;
return handleHttpRequestMethodNotSupported((HttpRequestMethodNotSupportedException) ex, headers, status, request);
} else if (ex instanceof HttpMediaTypeNotSupportedException) {
HttpStatus status = HttpStatus.UNSUPPORTED_MEDIA_TYPE;
return handleHttpMediaTypeNotSupported((HttpMediaTypeNotSupportedException) ex, headers, status, request);
} else if (ex instanceof HttpMediaTypeNotAcceptableException) {
HttpStatus status = HttpStatus.NOT_ACCEPTABLE;
return handleHttpMediaTypeNotAcceptable((HttpMediaTypeNotAcceptableException) ex, headers, status, request);
} else if (ex instanceof MissingPathVariableException) {
HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
return handleMissingPathVariable((MissingPathVariableException) ex, headers, status, request);
} else if (ex instanceof MissingServletRequestParameterException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleMissingServletRequestParameter((MissingServletRequestParameterException) ex, headers, status, request);
} else if (ex instanceof ServletRequestBindingException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleServletRequestBindingException((ServletRequestBindingException) ex, headers, status, request);
} else if (ex instanceof ConversionNotSupportedException) {
HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
return handleConversionNotSupported((ConversionNotSupportedException) ex, headers, status, request);
} else if (ex instanceof TypeMismatchException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleTypeMismatch((TypeMismatchException) ex, headers, status, request);
} else if (ex instanceof HttpMessageNotReadableException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleHttpMessageNotReadable((HttpMessageNotReadableException) ex, headers, status, request);
} else if (ex instanceof HttpMessageNotWritableException) {
HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
return handleHttpMessageNotWritable((HttpMessageNotWritableException) ex, headers, status, request);
} else if (ex instanceof MethodArgumentNotValidException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleMethodArgumentNotValid((MethodArgumentNotValidException) ex, headers, status, request);
} else if (ex instanceof MissingServletRequestPartException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleMissingServletRequestPart((MissingServletRequestPartException) ex, headers, status, request);
} else if (ex instanceof BindException) {
HttpStatus status = HttpStatus.BAD_REQUEST;
return handleBindException((BindException) ex, headers, status, request);
} else if (ex instanceof NoHandlerFoundException) {
HttpStatus status = HttpStatus.NOT_FOUND;
return handleNoHandlerFoundException((NoHandlerFoundException) ex, headers, status, request);
} else if (ex instanceof AsyncRequestTimeoutException) {
HttpStatus status = HttpStatus.SERVICE_UNAVAILABLE;
return handleAsyncRequestTimeoutException((AsyncRequestTimeoutException) ex, headers, status, request);
} else {
// Unknown exception, typically a wrapper with a common MVC exception as cause
// (since @ExceptionHandler type declarations also match first-level causes):
// We only deal with top-level MVC exceptions here, so let's rethrow the given
// exception for further processing through the HandlerExceptionResolver chain.
throw ex;
}
}
16
View Source File : MyLogGateWayFilter.java
License : MIT License
Project Creator : moxi624
License : MIT License
Project Creator : moxi624
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
log.info("***********come in MyLogGateWayFilter: " + new Date());
String uname = exchange.getRequest().getQueryParams().getFirst("uname");
if (uname == null) {
log.info("*******用户名为null,非法用户,o(╥﹏╥)o");
exchange.getResponse().setStatusCode(HttpStatus.NOT_ACCEPTABLE);
return exchange.getResponse().setComplete();
}
return chain.filter(exchange);
}
16
View Source File : RouteEnhanceServiceImpl.java
License : Apache License 2.0
Project Creator : JacksonTu
License : Apache License 2.0
Project Creator : JacksonTu
@Override
public Mono<Void> filterBlockList(ServerWebExchange exchange) {
Stopwatch stopwatch = Stopwatch.createStarted();
ServerHttpRequest request = exchange.getRequest();
ServerHttpResponse response = exchange.getResponse();
try {
URI requestUrl = getGatewayRequestUrl(exchange);
URI originUri = getGatewayOriginalRequestUrl(exchange);
if (originUri != null) {
String requestIp = BrightUtil.getServerHttpRequestIpAddress(request);
String requestMethod = request.getMethodValue();
AtomicBoolean forbid = new AtomicBoolean(false);
ResultBody<List<GatewayBlockList>> resultBody = remoteGatewayFeignService.listGatewayBlockList();
List<GatewayBlockList> blockLists = Lists.newArrayList();
if (resultBody.getCode() == 200 && resultBody.getData().size() > 0) {
blockLists = resultBody.getData();
}
checkBlockList(forbid, blockLists, requestUrl, requestMethod);
log.info("BlockList verification completed - {}", stopwatch.stop());
if (forbid.get()) {
return BrightUtil.makeWebFluxResponse(response, MediaType.APPLICATION_JSON_VALUE, HttpStatus.NOT_ACCEPTABLE, new CommonResult().message("黑名单限制,禁止访问"));
}
} else {
log.info("BlockList verification info: Request IP not obtained, no blockList check - {}", stopwatch.stop());
}
} catch (Exception e) {
log.warn("BlockList verification failed : {} - {}", stopwatch.stop(), e.getMessage());
}
return null;
}
16
View Source File : InviteOrganisationController.java
License : MIT License
Project Creator : InnovateUKGitHub
License : MIT License
Project Creator : InnovateUKGitHub
@PutMapping("/save")
public RestResult<Void> put(@RequestBody InviteOrganisationResource inviteOrganisationResource) {
if (service.getById(inviteOrganisationResource.getId()).isSuccess()) {
return service.save(inviteOrganisationResource).toPutResponse();
} else {
return RestResult.restFailure(HttpStatus.NOT_ACCEPTABLE);
}
}
16
View Source File : RouteEnhanceServiceImpl.java
License : Apache License 2.0
Project Creator : febsteam
License : Apache License 2.0
Project Creator : febsteam
@Override
public Mono<Void> filterBlackList(ServerWebExchange exchange) {
Stopwatch stopwatch = Stopwatch.createStarted();
ServerHttpRequest request = exchange.getRequest();
ServerHttpResponse response = exchange.getResponse();
try {
URI originUri = getGatewayOriginalRequestUrl(exchange);
if (originUri != null) {
String requestIp = FebsUtil.getServerHttpRequestIpAddress(request);
String requestMethod = request.getMethodValue();
AtomicBoolean forbid = new AtomicBoolean(false);
Set<Object> blackList = routeEnhanceCacheService.getBlackList(requestIp);
blackList.addAll(routeEnhanceCacheService.getBlackList());
doBlackListCheck(forbid, blackList, originUri, requestMethod);
log.info("Blacklist verification completed - {}", stopwatch.stop());
if (forbid.get()) {
return FebsUtil.makeWebFluxResponse(response, MediaType.APPLICATION_JSON_VALUE, HttpStatus.NOT_ACCEPTABLE, new FebsResponse().message("黑名单限制,禁止访问"));
}
} else {
log.info("Request IP not obtained, no blacklist check - {}", stopwatch.stop());
}
} catch (Exception e) {
log.warn("Blacklist verification failed : {} - {}", e.getMessage(), stopwatch.stop());
}
return null;
}
16
View Source File : RestServiceCameraDeviceTest.java
License : MIT License
Project Creator : botorabi
License : MIT License
Project Creator : botorabi
@Test
public void createCameraInvalidCamera() {
CameraInfo reqCreateCamera = new CameraInfo();
reqCreateCamera.setUrl("");
ResponseEnreplacedy<CameraInfo> response = restServiceCameraDevice.createCamera(reqCreateCamera, userTestUtils.createAuthentication("admin-user", true));
replacedertThat(response.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
See More Examples