public void postLicense ( final License license , final String user , final String password ) throws GrapesCommunicationException , AuthenticationException { final Client client = getClient ( user , password ) ; final WebResource resource = client . resource ( serverURL ) . path ( RequestUtils . licenseResourcePath ( ) ) ; final ClientResponse response = resource . type ( MediaType . APPLICATION_JSON ) . post ( ClientResponse . class , license ) ; client . destroy ( ) ; if ( ClientResponse . Status . CREATED . getStatusCode ( ) != response . getStatus ( ) ) { final String message = "Failed to POST license" ; if ( LOG . isErrorEnabled ( ) ) { LOG . error ( String . format ( HTTP_STATUS_TEMPLATE_MSG , message , response . getStatus ( ) ) ) ; } throw new GrapesCommunicationException ( message , response . getStatus ( ) ) ; } }
Post a license to the server