@ POST @ Consumes ( MediaType . APPLICATION_JSON ) @ Produces ( MediaType . APPLICATION_JSON ) public Response registerPushApplication ( PushApplication pushApp ) { try { validateModelClass ( pushApp ) ; } catch ( ConstraintViolationException cve ) { logger . trace ( "Unable to create Push Application" ) ; return createBadRequestResponse ( cve . getConstraintViolations ( ) ) . build ( ) ; } try { logger . trace ( "Invoke service to create a push application" ) ; pushAppService . addPushApplication ( pushApp ) ; } catch ( IllegalArgumentException e ) { return Response . status ( Status . CONFLICT ) . entity ( e . getMessage ( ) ) . build ( ) ; } final URI uri = UriBuilder . fromResource ( PushApplicationEndpoint . class ) . path ( pushApp . getPushApplicationID ( ) ) . build ( ) ; return Response . created ( uri ) . entity ( pushApp ) . build ( ) ; }
Create Push Application