Transform curl http: // IP: PORT / sendLocalEvent? eventName = _evento in Javafx

0

I would like to make an app in javafx, when pressing a button it sends a command of type: curl http://IP:PORTA/sendLocalEvent?eventName=_evento to a server on the same network to start the _evento event.

Would it be using httpUrlConnection and POST? How would it be?

    
asked by anonymous 22.07.2017 / 21:02

1 answer

0

In this case JavaFX does not differ from Java, so the same traditional method is used:

URL url = new URL("http://IP:PORTA/sendLocalEvent?eventName=_evento");
HttpURLConnection httpcon = (HttpURLConnection) url.openConnection();
httpcon.setRequestMethod("POST");
httpcon.setDoOutPut(true);

References:

How to fire http post request from an javafx client (SOen)

How to send http request getpost in java

    
28.07.2017 / 14:52