本文整理匯總了Java中org.eclipse.jetty.http.HttpStatus.NOT_FOUND_404屬性的典型用法代碼示例。如果您正苦於以下問題:Java HttpStatus.NOT_FOUND_404屬性的具體用法?Java HttpStatus.NOT_FOUND_404怎麽用?Java HttpStatus.NOT_FOUND_404使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jetty.http.HttpStatus
的用法示例。
在下文中一共展示了HttpStatus.NOT_FOUND_404屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testApexCall
@Test
public void testApexCall() throws Exception {
try {
doTestApexCall("");
doTestApexCall("Xml");
} catch (CamelExecutionException e) {
if (e.getCause() instanceof SalesforceException) {
SalesforceException cause = (SalesforceException) e.getCause();
if (cause.getStatusCode() == HttpStatus.NOT_FOUND_404) {
LOG.error("Make sure test REST resource MerchandiseRestResource.apxc has been loaded: "
+ e.getMessage());
}
}
throw e;
}
}
示例2: getRun
@GET
@Path("/{runId}")
@UnitOfWork
@ApiOperation(value = "Get a specific run")
@ApiResponses({
@ApiResponse(code = HttpStatus.OK_200, response = RunApiEntity.class, message = "OK"),
@ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found"),
@ApiResponse(
code = HttpStatus.CONFLICT_409,
response = ErrorMessage.class,
message = "Event ID and Run ID are mismatched"
)
})
public RunApiEntity getRun(
@PathParam("eventId") @ApiParam(value = "Event ID", required = true) String eventId,
@PathParam("runId") @ApiParam(value = "Run ID", required = true) String runId
) throws EntityMismatchException, EntityNotFoundException {
Run domainRun = runEntityService.getByEventIdAndRunId(eventId, runId);
return runMapper.toApiEntity(domainRun);
}
示例3: getRegistration
@GET
@Path("/{registrationId}")
@UnitOfWork
@ApiOperation(value = "Get a specific registration")
@ApiResponses({
@ApiResponse(code = HttpStatus.OK_200, response = RegistrationApiEntity.class, message = "OK"),
@ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found"),
@ApiResponse(
code = HttpStatus.CONFLICT_409,
response = ErrorMessage.class,
message = "Event ID and Registration ID are mismatched"
)
})
public RegistrationApiEntity getRegistration(
@PathParam("eventId") @ApiParam(value = "Event ID", required = true) String eventId,
@PathParam("registrationId") @ApiParam(value = "Registration ID", required = true) String registrationId
) throws EntityMismatchException, EntityNotFoundException {
Registration domainRegistration = eventRegistrationService.getByEventIdAndRegistrationId(
eventId,
registrationId
);
return registrationMapper.toApiEntity(domainRegistration);
}
示例4: addHandicapGroupToHandicapGroupSet
@POST
@Path("/{handicapGroupSetId}/handicapGroups/{handicapGroupId}")
@UnitOfWork
@ApiOperation(value = "Add a Handicap Group to a Handicap Group Set", response = HandicapGroupSetApiEntity.class)
@ApiResponses({
@ApiResponse(code = HttpStatus.OK_200, response = HandicapGroupSetApiEntity.class, message = "OK"),
@ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found"),
})
public HandicapGroupSetApiEntity addHandicapGroupToHandicapGroupSet(
@PathParam("handicapGroupSetId") @ApiParam(value = "Handicap Group Set ID", required = true)
String handicapGroupSetId,
@PathParam("handicapGroupId") @ApiParam(value = "Handicap Group ID", required = true)
String handicapGroupId
) throws EntityNotFoundException {
HandicapGroupSet domainSetEntity = handicapGroupSetService.getById(handicapGroupSetId);
HandicapGroup domainEntity = handicapGroupEntityService.getById(handicapGroupId);
handicapGroupSetService.addToHandicapGroups(domainSetEntity, domainEntity);
return handicapGroupSetMapper.toApiEntity(domainSetEntity);
}
示例5: addCompetitionGroupToCompetitionGroupSet
@POST
@Path("/{competitionGroupSetId}/competitionGroups/{competitionGroupId}")
@UnitOfWork
@ApiOperation(
value = "Add a Competition Group to a Competition Group Set",
response = CompetitionGroupSetApiEntity.class
)
@ApiResponses({
@ApiResponse(code = HttpStatus.OK_200, response = CompetitionGroupSetApiEntity.class, message = "OK"),
@ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found"),
})
public CompetitionGroupSetApiEntity addCompetitionGroupToCompetitionGroupSet(
@PathParam("competitionGroupSetId") @ApiParam(value = "Competition Group Set ID", required = true)
String competitionGroupSetId,
@PathParam("competitionGroupId") @ApiParam(value = "Competition Group ID", required = true)
String competitionGroupId
) throws EntityNotFoundException {
CompetitionGroupSet domainSetEntity = competitionGroupSetService.getById(competitionGroupSetId);
CompetitionGroup domainEntity = competitionGroupEntityService.getById(competitionGroupId);
competitionGroupSetService.addToCompetitionGroups(domainSetEntity, domainEntity);
return competitionGroupSetMapper.toApiEntity(domainSetEntity);
}
示例6: acquireLease
/**
* Acquires a lease on a blob. The lease ID is NULL initially.
* @param leaseTimeInSec The time in seconds you want to acquire the lease for.
* @param leaseId Proposed ID you want to acquire the lease with, null if not proposed.
* @return String that represents lease ID. Null if acquireLease is unsuccessful because the blob is leased already.
* @throws AzureException If a Azure storage service error occurred. This includes the case where the blob you're trying to lease does not exist.
*/
public String acquireLease(int leaseTimeInSec, String leaseId) {
try {
String id = leaseBlob.acquireLease(leaseTimeInSec, leaseId);
LOG.info("Acquired lease with lease id = " + id);
return id;
} catch (StorageException storageException) {
int httpStatusCode = storageException.getHttpStatusCode();
if (httpStatusCode == HttpStatus.CONFLICT_409) {
LOG.info("The blob you're trying to acquire is leased already.", storageException.getMessage());
} else if (httpStatusCode == HttpStatus.NOT_FOUND_404) {
LOG.error("The blob you're trying to lease does not exist.", storageException);
throw new AzureException(storageException);
} else {
LOG.error("Error acquiring lease!", storageException);
throw new AzureException(storageException);
}
}
return null;
}
示例7: getCompetitionGroup
@GET
@Path("/{competitionGroupId}")
@UnitOfWork
@ApiOperation(value = "Get a Competition Group", response = CompetitionGroupApiEntity.class)
@ApiResponses({
@ApiResponse(code = HttpStatus.OK_200, response = CompetitionGroupApiEntity.class, message = "OK"),
@ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found")
})
public CompetitionGroupApiEntity getCompetitionGroup(
@PathParam("competitionGroupId") @ApiParam(value = "Competition Group ID", required = true) String id
) throws EntityNotFoundException {
CompetitionGroup domainEntity = competitionGroupEntityService.getById(id);
return competitionGroupMapper.toApiEntity(domainEntity);
}
示例8: 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();
}
示例9: getEvent
@GET
@Path("/{eventId}")
@UnitOfWork
@ApiOperation(value = "Get an Event")
@ApiResponses({
@ApiResponse(code = HttpStatus.OK_200, response = EventApiEntity.class, message = "OK"),
@ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found")
})
public EventApiEntity getEvent(
@PathParam("eventId") @ApiParam(value = "Event ID", required = true) String id
) throws EntityNotFoundException {
Event domainEntity = eventEntityService.getById(id);
return eventMapper.toApiEntity(domainEntity);
}
示例10: 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();
}
示例11: getHandicapGroupSet
@GET
@Path("/{handicapGroupSetId}")
@UnitOfWork
@ApiOperation(value = "Get a Handicap Group Set", response = HandicapGroupSetApiEntity.class)
@ApiResponses({
@ApiResponse(code = HttpStatus.OK_200, response = HandicapGroupSetApiEntity.class, message = "OK"),
@ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found")
})
public HandicapGroupSetApiEntity getHandicapGroupSet(
@PathParam("handicapGroupSetId")
@ApiParam(value = "Handicap Group Set ID", required = true) String id
) throws EntityNotFoundException {
HandicapGroupSet domainEntity = handicapGroupSetService.getById(id);
return handicapGroupSetMapper.toApiEntity(domainEntity);
}
示例12: getCompetitionGroupSet
@GET
@Path("/{competitionGroupSetId}")
@UnitOfWork
@ApiOperation(value = "Get a Competition Group Set", response = CompetitionGroupSetApiEntity.class)
@ApiResponses({
@ApiResponse(code = HttpStatus.OK_200, response = CompetitionGroupSetApiEntity.class, message = "OK"),
@ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found")
})
public CompetitionGroupSetApiEntity getCompetitionGroupSet(
@PathParam("competitionGroupSetId")
@ApiParam(value = "Competition Group Set ID", required = true) String id
) throws EntityNotFoundException {
CompetitionGroupSet domainEntity = competitionGroupSetService.getById(id);
return competitionGroupSetMapper.toApiEntity(domainEntity);
}
示例13: getHandicapGroup
@GET
@Path("/{handicapGroupId}")
@UnitOfWork
@ApiOperation(value = "Get a Handicap Group", response = HandicapGroupApiEntity.class)
@ApiResponses({
@ApiResponse(code = HttpStatus.OK_200, response = HandicapGroupApiEntity.class, message = "OK"),
@ApiResponse(code = HttpStatus.NOT_FOUND_404, response = ErrorMessage.class, message = "Not found")
})
public HandicapGroupApiEntity getHandicapGroup(
@PathParam("handicapGroupId") @ApiParam(value = "Handicap Group ID", required = true) String id
) throws EntityNotFoundException {
HandicapGroup domainEntity = handicapGroupEntityService.getById(id);
return handicapGroupMapper.toApiEntity(domainEntity);
}
示例14: isAuthorised
@Override
public boolean isAuthorised(final ServiceUser serviceUser,
final DocRef docRef,
final String permissionName) {
Response response;
try {
final Map<String, Object> request = new HashMap<>();
request.put("docRef", new DocRef.Builder()
.uuid(docRef.getUuid())
.type(docRef.getType())
.build()); // stripping out the name
request.put("permission", permissionName);
response = httpClient
.target(this.isAuthorisedUrl)
.request()
.header("Authorization", "Bearer " + serviceUser.getJwt())
.post(Entity.json(request));
} catch (final Exception e) {
LOGGER.error("Could not request authorisation " + e.getLocalizedMessage());
return false;
}
boolean isUserAuthorised;
switch (response.getStatus()) {
case HttpStatus.UNAUTHORIZED_401:
isUserAuthorised = false;
break;
case HttpStatus.OK_200:
isUserAuthorised = true;
break;
case HttpStatus.NOT_FOUND_404:
isUserAuthorised = false;
LOGGER.error("Received a 404 when trying to access the authorisation service! I am unable to check authorisation so all requests will be rejected until this is fixed. Is the service location correctly configured? Is the service running? The URL I tried was: {}", this.isAuthorisedUrl);
break;
default:
isUserAuthorised = false;
LOGGER.error("Tried to check authorisation for a user but got an unknown response!",
response.getStatus());
}
return isUserAuthorised;
}
示例15: isNotFound
private static boolean isNotFound(com.google.common.base.Optional<Integer> statusCode) {
return statusCode.isPresent() && statusCode.get() == HttpStatus.NOT_FOUND_404;
}