String sendAction ( String action ) throws ClientErrorException , ServerErrorException , OtherCommunicationException { try { String encodedPath = URLEncoder . encode ( this . journeyId , "UTF-8" ) ; String url = String . format ( "http://%s:%d/action/%s/%s" , this . hostname , port , action , encodedPath ) ; HttpResponse < String > response = Unirest . post ( url ) . header ( "Accept" , this . acceptHeader ) . header ( "Accept-Charset" , "UTF-8" ) . asString ( ) ; ensureStatusOk ( response ) ; return response . getBody ( ) ; } catch ( UnirestException | UnsupportedEncodingException e ) { throw new OtherCommunicationException ( "Could not perform POST request" , e ) ; } }
~~~~~~~ POST ~~~~~~~~