本文整理匯總了Java中org.eclipse.jetty.http.HttpStatus.UNPROCESSABLE_ENTITY_422屬性的典型用法代碼示例。如果您正苦於以下問題:Java HttpStatus.UNPROCESSABLE_ENTITY_422屬性的具體用法?Java HttpStatus.UNPROCESSABLE_ENTITY_422怎麽用?Java HttpStatus.UNPROCESSABLE_ENTITY_422使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jetty.http.HttpStatus
的用法示例。
在下文中一共展示了HttpStatus.UNPROCESSABLE_ENTITY_422屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addCompetitionGroup
@POST
@UnitOfWork
@ApiOperation(value = "Add a Competition Group")
@ApiResponses({
@ApiResponse(
code = HttpStatus.CREATED_201,
message = ApiResponseConstants.Created.MESSAGE,
responseHeaders = {
@ResponseHeader(
name = ApiResponseConstants.Created.Headers.NAME,
description = ApiResponseConstants.Created.Headers.DESCRIPTION,
response = String.class
)
}
),
@ApiResponse(
code = HttpStatus.UNPROCESSABLE_ENTITY_422,
message = "Failed validation",
response = ValidationErrorMessage.class
)
})
public Response addCompetitionGroup(
@Valid @ApiParam(value = "Competition Group") AddCompetitionGroupRequest request
) throws AddEntityException {
CompetitionGroupAddPayload addPayload = competitionGroupMapper.toDomainAddPayload(request);
CompetitionGroup domainEntity = competitionGroupEntityService.add(addPayload);
CompetitionGroupApiEntity entity = competitionGroupMapper.toApiEntity(domainEntity);
return Response.created(UriBuilder.fromPath("/competitionGroups/{competitionGroupId}")
.build(entity.getId()))
.build();
}
示例2: addRun
@POST
@UnitOfWork
@ApiOperation(value = "Add a new run")
@ApiResponses({
@ApiResponse(
code = HttpStatus.CREATED_201,
message = ApiResponseConstants.Created.MESSAGE,
responseHeaders = {
@ResponseHeader(
name = ApiResponseConstants.Created.Headers.NAME,
description = ApiResponseConstants.Created.Headers.DESCRIPTION,
response = String.class
)
}
),
@ApiResponse(
code = HttpStatus.NOT_FOUND_404,
response = ErrorMessage.class,
message = "No event with given ID"
),
@ApiResponse(
code = HttpStatus.UNPROCESSABLE_ENTITY_422,
response = ValidationErrorMessage.class,
message = "Failed validation"
)
})
public Response addRun(
@PathParam("eventId") @ApiParam(value = "Event ID", required = true) String eventId,
@Valid @ApiParam(value = "Run", required = true) AddRunRequest request
) throws AddEntityException, EntityNotFoundException {
RunAddPayload addPayload = runMapper.toDomainAddPayload(request, eventId);
Run domainEntity = runEntityService.add(addPayload);
RunApiEntity run = runMapper.toApiEntity(domainEntity);
return Response.created(UriBuilder.fromPath("/events/{eventId}/runs/{runId}")
.build(eventId, run.getId()))
.build();
}
示例3: addEvent
@POST
@UnitOfWork
@ApiOperation(value = "Add an Event", response = Response.class)
@ApiResponses({
@ApiResponse(
code = HttpStatus.CREATED_201,
message = ApiResponseConstants.Created.MESSAGE,
responseHeaders = {
@ResponseHeader(
name = ApiResponseConstants.Created.Headers.NAME,
description = ApiResponseConstants.Created.Headers.DESCRIPTION,
response = String.class
)
}
),
@ApiResponse(
code = HttpStatus.UNPROCESSABLE_ENTITY_422,
response = ValidationErrorMessage.class,
message = "Failed validation"
)
})
public Response addEvent(
@Valid @ApiParam(value = "Event", required = true) AddEventRequest request
) throws AddEntityException {
EventAddPayload addPayload = eventMapper.toDomainAddPayload(request);
Event domainEntity = eventEntityService.add(addPayload);
EventApiEntity eventApiEntity = eventMapper.toApiEntity(domainEntity);
return Response.created(UriBuilder.fromPath("/events/{eventId}")
.build(eventApiEntity.getId()))
.build();
}
示例4: addRegistration
@POST
@UnitOfWork
@ApiOperation(value = "Add a new registration")
@ApiResponses({
@ApiResponse(
code = HttpStatus.CREATED_201,
message = ApiResponseConstants.Created.MESSAGE,
responseHeaders = {
@ResponseHeader(
name = ApiResponseConstants.Created.Headers.NAME,
description = ApiResponseConstants.Created.Headers.DESCRIPTION,
response = String.class
)
}
),
@ApiResponse(
code = HttpStatus.NOT_FOUND_404,
response = ErrorMessage.class,
message = "No event with given ID"
),
@ApiResponse(
code = HttpStatus.UNPROCESSABLE_ENTITY_422,
response = ValidationErrorMessage.class,
message = "Failed validation"
)
})
public Response addRegistration(
@PathParam("eventId") @ApiParam(value = "Event ID", required = true) String eventId,
@Valid @ApiParam(value = "Registration", required = true) AddRegistrationRequest request
) throws AddEntityException, EntityNotFoundException {
RegistrationAddPayload addPayload = registrationMapper.toDomainAddPayload(request, eventId);
Registration domainEntity = eventRegistrationService.add(addPayload);
RegistrationApiEntity registration = registrationMapper.toApiEntity(domainEntity);
return Response.created(UriBuilder.fromPath("/events/{eventId}/registrations/{registrationId}")
.build(eventId, registration.getId()))
.build();
}
示例5: add
@POST
@UnitOfWork
@ApiOperation(
value = "Add a new Handicap Group Set",
notes = "Optionally include a set of Handicap Group entities with ID to associate them"
)
@ApiResponses({
@ApiResponse(
code = HttpStatus.CREATED_201,
message = ApiResponseConstants.Created.MESSAGE,
responseHeaders = {
@ResponseHeader(
name = ApiResponseConstants.Created.Headers.NAME,
description = ApiResponseConstants.Created.Headers.DESCRIPTION,
response = String.class
)
}
),
@ApiResponse(
code = HttpStatus.UNPROCESSABLE_ENTITY_422,
message = "Failed validation",
response = ValidationErrorMessage.class
)
})
public Response add(
@Valid @NotNull @ApiParam(value = "Handicap Group Set") AddHandicapGroupSetRequest request
) throws AddEntityException {
HandicapGroupSetAddPayload addPayload = handicapGroupSetMapper.toDomainAddPayload(request);
HandicapGroupSet domainEntity = handicapGroupSetService.add(addPayload);
HandicapGroupSetApiEntity entity = handicapGroupSetMapper.toApiEntity(domainEntity);
return Response.created(UriBuilder.fromPath("/handicapGroups/sets/{handicapGroupSetId}")
.build(entity.getId()))
.build();
}
示例6: add
@POST
@UnitOfWork
@ApiOperation(
value = "Add a new Competition Group Set",
notes = "Optionally include a list of Competition Group entities with ID to associate them"
)
@ApiResponses({
@ApiResponse(
code = HttpStatus.CREATED_201,
message = ApiResponseConstants.Created.MESSAGE,
responseHeaders = {
@ResponseHeader(
name = ApiResponseConstants.Created.Headers.NAME,
description = ApiResponseConstants.Created.Headers.DESCRIPTION,
response = String.class
)
}
),
@ApiResponse(
code = HttpStatus.UNPROCESSABLE_ENTITY_422,
message = "Failed validation",
response = ValidationErrorMessage.class
)
})
public Response add(
@Valid @ApiParam(value = "Competition Group Set") AddCompetitionGroupSetRequest request
) throws AddEntityException {
CompetitionGroupSetAddPayload addPayload = competitionGroupSetMapper.toDomainAddPayload(request);
CompetitionGroupSet domainEntity = competitionGroupSetService.add(addPayload);
CompetitionGroupSetApiEntity entity = competitionGroupSetMapper.toApiEntity(domainEntity);
return Response.created(UriBuilder.fromPath("/competitionGroups/sets/{competitionGroupSetId}")
.build(entity.getId()))
.build();
}
示例7: addHandicapGroup
@POST
@UnitOfWork
@ApiOperation(value = "Add a Handicap Group")
@ApiResponses({
@ApiResponse(
code = HttpStatus.CREATED_201,
message = ApiResponseConstants.Created.MESSAGE,
responseHeaders = {
@ResponseHeader(
name = ApiResponseConstants.Created.Headers.NAME,
description = ApiResponseConstants.Created.Headers.DESCRIPTION,
response = String.class
)
}
),
@ApiResponse(
code = HttpStatus.UNPROCESSABLE_ENTITY_422,
message = "Failed validation",
response = ValidationErrorMessage.class
)
})
public Response addHandicapGroup(
@Valid @ApiParam(value = "Handicap Group") AddHandicapGroupRequest request
) throws AddEntityException {
HandicapGroupAddPayload addPayload = handicapGroupMapper.toDomainAddPayload(request);
HandicapGroup domainEntity = handicapGroupEntityService.add(addPayload);
HandicapGroupApiEntity entity = handicapGroupMapper.toApiEntity(domainEntity);
return Response.created(UriBuilder.fromPath("/handicapGroups/{handicapGroupId}")
.build(entity.getId()))
.build();
}
示例8: addRawTimeToFirstRunInSequenceLackingOne
@POST
@Path("/rawTimes")
@UnitOfWork
@ApiOperation(
value = "Add a raw time to the first run in sequence lacking one, "
+ "or to a new run created on-the-fly if no runs lack a raw time"
)
@ApiResponses({
@ApiResponse(
code = HttpStatus.OK_200,
message = "Assigned the given raw time to an existing run which was the first in sequence "
+ "lacking one already",
response = RunApiEntity.class
),
@ApiResponse(
code = HttpStatus.CREATED_201,
message = "Created a new run entity with the given raw time. From the perspective of this "
+ "service, this isn't strictly an error, but would probably only come about due to an "
+ "exceptional circumstance which may spell trouble for event operations, such as a "
+ "false start/stop trip, a driver starting without the knowledge of the workers, etc.",
responseHeaders = {
@ResponseHeader(
name = ApiResponseConstants.Created.Headers.NAME,
description = ApiResponseConstants.Created.Headers.DESCRIPTION
)
},
response = RunApiEntity.class
),
@ApiResponse(
code = HttpStatus.NOT_FOUND_404,
response = ErrorMessage.class,
message = "No event with given ID"
),
@ApiResponse(
code = HttpStatus.UNPROCESSABLE_ENTITY_422,
response = ValidationErrorMessage.class,
message = "Failed validation"
)
})
public Response addRawTimeToFirstRunInSequenceLackingOne(
@PathParam("eventId") @ApiParam(value = "Event ID", required = true) String eventId,
@Valid @ApiParam(value = "Time", required = true) AddRawTimeToFirstRunLackingRequest request
) throws AddEntityException, EntityNotFoundException {
RunAddTimePayload inPayload = runMapper.toDomainAddTimePayload(request, eventId);
RunTimeAddedPayload outPayload = runEntityService.addTimeToFirstRunInSequenceWithoutRawTime(inPayload);
RunApiEntity run = runMapper.toApiEntity(outPayload.getRun());
switch (outPayload.getOutcome()) {
case RUN_RAWTIME_ASSIGNED_TO_EXISTING:
return Response.ok(run, MediaType.APPLICATION_JSON).build();
case RUN_ADDED_WITH_RAWTIME:
return Response.created(UriBuilder.fromPath("/events/{eventId}/runs/{runId}")
.build(eventId, run.getId()))
.entity(run)
.type(MediaType.APPLICATION_JSON)
.build();
default:
throw new RuntimeException("Unknown outcome: " + outPayload.getOutcome());
}
}