protected URI doPostCreate ( String path , Object o , MultivaluedMap < String , String > headers ) throws ClientException { this . readLock . lock ( ) ; try { WebResource . Builder requestBuilder = getResourceWrapper ( ) . rewritten ( path , HttpMethod . POST ) . getRequestBuilder ( ) ; requestBuilder = ensurePostCreateJsonHeaders ( headers , requestBuilder , true , false ) ; ClientResponse response = requestBuilder . post ( ClientResponse . class , o ) ; errorIfStatusNotEqualTo ( response , ClientResponse . Status . OK , ClientResponse . Status . CREATED ) ; try { return response . getLocation ( ) ; } finally { response . close ( ) ; } } catch ( ClientHandlerException ex ) { throw new ClientException ( ClientResponse . Status . INTERNAL_SERVER_ERROR , ex . getMessage ( ) ) ; } finally { this . readLock . unlock ( ) ; } }
Creates a resource specified as a JSON object .