// nope, keep 400 response empty to not leak details about cert/passphrase
return Response.status(Status.BAD_REQUEST).build();
}
// extract form values:
iOSVariant iOSVariant = new iOSVariant();
iOSVariant.setName(form.getName());
iOSVariant.setDescription(form.getDescription());
iOSVariant.setPassphrase(form.getPassphrase());
iOSVariant.setCertificate(form.getCertificate());
iOSVariant.setProduction(form.getProduction());
// store the "developer:
iOSVariant.setDeveloper(extractUsername(request));
// some model validation on the entity:
try {
validateModelClass(iOSVariant);
} catch (ConstraintViolationException cve) {
// Build and return the 400 (Bad Request) response
ResponseBuilder builder = createBadRequestResponse(cve.getConstraintViolations());
return builder.build();
}
// store the iOS variant:
variantService.addVariant(iOSVariant);
// add iOS variant, and merge:
pushAppService.addVariant(pushApp, iOSVariant);
return Response.created(uriInfo.getAbsolutePathBuilder().path(String.valueOf(iOSVariant.getVariantID())).build()).entity(iOSVariant).build();
}