/** * Create Push Application * * @param pushApp new {@link PushApplication} * @return created {@link PushApplication} * @statuscode 201 The PushApplication Variant created successfully * @statuscode 400 The format of the client request was incorrect */ @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ReturnType("org.jboss.aerogear.unifiedpush.api.PushApplication") public Response registerPushApplication(PushApplication pushApp) { // some validation try { validateModelClass(pushApp); } catch (ConstraintViolationException cve) { // Build and return the 400 (Bad Request) response ResponseBuilder builder = createBadRequestResponse(cve.getConstraintViolations()); return builder.build(); } pushAppService.addPushApplication(pushApp); return Response.created( UriBuilder.fromResource(PushApplicationEndpoint.class) .path(String.valueOf(pushApp.getPushApplicationID())) .build()) .entity(pushApp) .build(); }