Java Code Examples for org.eclipse.jetty.http.HttpStatus#METHOD_NOT_ALLOWED_405
The following examples show how to use
org.eclipse.jetty.http.HttpStatus#METHOD_NOT_ALLOWED_405 .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DomainQuotaRoutes.java From james-project with Apache License 2.0 | 6 votes |
@GET @ApiOperation( value = "Reading count and size at the same time", notes = "If there is no limitation for count and/or size, the returned value will be -1" ) @ApiResponses(value = { @ApiResponse(code = HttpStatus.OK_200, message = "OK", response = QuotaDomainDTO.class), @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "The requested domain can not be found."), @ApiResponse(code = HttpStatus.METHOD_NOT_ALLOWED_405, message = "Domain Quota configuration not supported when virtual hosting is desactivated."), @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "Internal server error - Something went bad on the server side.") }) public void defineGetQuota() { service.get(QUOTA_ENDPOINT, (request, response) -> { Domain domain = checkDomainExist(request); return domainQuotaService.getQuota(domain); }, jsonTransformer); }
Example 2
Source File: DomainQuotaRoutes.java From james-project with Apache License 2.0 | 6 votes |
@DELETE @Path("/size") @ApiOperation(value = "Removing per domain mail size limitation by updating to unlimited value") @ApiResponses(value = { @ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "The value is updated to unlimited value."), @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "The requested domain can not be found."), @ApiResponse(code = HttpStatus.METHOD_NOT_ALLOWED_405, message = "Domain Quota configuration not supported when virtual hosting is desactivated."), @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "Internal server error - Something went bad on the server side.") }) public void defineDeleteQuotaSize() { service.delete(SIZE_ENDPOINT, (request, response) -> { Domain domain = checkDomainExist(request); domainQuotaService.remoteMaxQuotaSize(domain); return Responses.returnNoContent(response); }); }
Example 3
Source File: DomainQuotaRoutes.java From james-project with Apache License 2.0 | 6 votes |
@PUT @Path("/size") @ApiOperation(value = "Updating per domain mail size limitation") @ApiImplicitParams({ @ApiImplicitParam(required = true, dataType = "integer", paramType = "body") }) @ApiResponses(value = { @ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "OK. The value has been updated."), @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "The body is not a positive integer."), @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "The requested domain can not be found."), @ApiResponse(code = HttpStatus.METHOD_NOT_ALLOWED_405, message = "Domain Quota configuration not supported when virtual hosting is desactivated."), @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "Internal server error - Something went bad on the server side.") }) public void defineUpdateQuotaSize() { service.put(SIZE_ENDPOINT, (request, response) -> { Domain domain = checkDomainExist(request); QuotaSizeLimit quotaSize = Quotas.quotaSize(request.body()); domainQuotaService.setMaxSizeQuota(domain, quotaSize); return Responses.returnNoContent(response); }); }
Example 4
Source File: DomainQuotaRoutes.java From james-project with Apache License 2.0 | 6 votes |
@GET @Path("/size") @ApiOperation(value = "Reading per domain mail size limitation") @ApiResponses(value = { @ApiResponse(code = HttpStatus.OK_200, message = "OK", response = Long.class), @ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "No value defined"), @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "The requested domain can not be found."), @ApiResponse(code = HttpStatus.METHOD_NOT_ALLOWED_405, message = "Domain Quota configuration not supported when virtual hosting is desactivated."), @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "Internal server error - Something went bad on the server side.") }) public void defineGetQuotaSize() { service.get(SIZE_ENDPOINT, (request, response) -> { Domain domain = checkDomainExist(request); Optional<QuotaSizeLimit> maxSizeQuota = domainQuotaService.getMaxSizeQuota(domain); if (maxSizeQuota.isPresent()) { return maxSizeQuota; } return Responses.returnNoContent(response); }, jsonTransformer); }
Example 5
Source File: DomainQuotaRoutes.java From james-project with Apache License 2.0 | 6 votes |
@DELETE @Path("/count") @ApiOperation(value = "Removing per domain mail count limitation by updating to unlimited value") @ApiResponses(value = { @ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "The value is updated to unlimited value."), @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "The requested domain can not be found."), @ApiResponse(code = HttpStatus.METHOD_NOT_ALLOWED_405, message = "Domain Quota configuration not supported when virtual hosting is desactivated."), @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "Internal server error - Something went bad on the server side.") }) public void defineDeleteQuotaCount() { service.delete(COUNT_ENDPOINT, (request, response) -> { Domain domain = checkDomainExist(request); domainQuotaService.remoteMaxQuotaCount(domain); return Responses.returnNoContent(response); }); }
Example 6
Source File: DomainQuotaRoutes.java From james-project with Apache License 2.0 | 6 votes |
@PUT @Path("/count") @ApiOperation(value = "Updating per domain mail count limitation") @ApiImplicitParams({ @ApiImplicitParam(required = true, dataType = "integer", paramType = "body") }) @ApiResponses(value = { @ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "OK. The value has been updated."), @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "The body is not a positive integer."), @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "The requested domain can not be found."), @ApiResponse(code = HttpStatus.METHOD_NOT_ALLOWED_405, message = "Domain Quota configuration not supported when virtual hosting is desactivated."), @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "Internal server error - Something went bad on the server side.") }) public void defineUpdateQuotaCount() { service.put(COUNT_ENDPOINT, (request, response) -> { Domain domain = checkDomainExist(request); QuotaCountLimit quotaCount = Quotas.quotaCount(request.body()); domainQuotaService.setMaxCountQuota(domain, quotaCount); return Responses.returnNoContent(response); }); }
Example 7
Source File: DomainQuotaRoutes.java From james-project with Apache License 2.0 | 6 votes |
@GET @Path("/count") @ApiOperation(value = "Reading per domain mail count limitation") @ApiResponses(value = { @ApiResponse(code = HttpStatus.OK_200, message = "OK", response = Long.class), @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "The requested domain can not be found."), @ApiResponse(code = HttpStatus.METHOD_NOT_ALLOWED_405, message = "Domain Quota configuration not supported when virtual hosting is desactivated."), @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "Internal server error - Something went bad on the server side.") }) public void defineGetQuotaCount() { service.get(COUNT_ENDPOINT, (request, response) -> { Domain domain = checkDomainExist(request); Optional<QuotaCountLimit> maxCountQuota = domainQuotaService.getMaxCountQuota(domain); if (maxCountQuota.isPresent()) { return maxCountQuota; } return Responses.returnNoContent(response); }, jsonTransformer); }
Example 8
Source File: DomainQuotaRoutes.java From james-project with Apache License 2.0 | 5 votes |
@PUT @ApiOperation(value = "Updating count and size at the same time") @ApiImplicitParams({ @ApiImplicitParam(required = true, dataTypeClass = QuotaDTO.class, paramType = "body") }) @ApiResponses(value = { @ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "OK. The value has been updated."), @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "The body is not a positive integer or not unlimited value (-1)."), @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "The requested domain can not be found."), @ApiResponse(code = HttpStatus.METHOD_NOT_ALLOWED_405, message = "Domain Quota configuration not supported when virtual hosting is desactivated."), @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "Internal server error - Something went bad on the server side.") }) public void defineUpdateQuota() { service.put(QUOTA_ENDPOINT, ((request, response) -> { try { Domain domain = checkDomainExist(request); QuotaDTO quotaDTO = jsonExtractor.parse(request.body()); ValidatedQuotaDTO validatedQuotaDTO = quotaDTOValidator.validatedQuotaDTO(quotaDTO); domainQuotaService.defineQuota(domain, validatedQuotaDTO); return Responses.returnNoContent(response); } catch (IllegalArgumentException e) { throw ErrorResponder.builder() .statusCode(HttpStatus.BAD_REQUEST_400) .type(ErrorType.INVALID_ARGUMENT) .message("Quota should be positive or unlimited (-1)") .cause(e) .haltError(); } })); }