Problems with consumption Rest Java swing?

0

I have a java swing application where I get a list of data from a webservice.  When I perform that by netbeans it does right, now when I generate the jar to send to the client, the application simply does not make the request, it hangs. Here's the class:

public class Rest {

    public void get() {
        Client client = Client.create();
        WebResource webResource = client
                .resource("...");

        ClientResponse response = webResource.accept("application/json")
                .get(ClientResponse.class);

        if (response.getStatus()
                != 200) {
            throw new RuntimeException("Failed : HTTP error code : "
                    + response.getStatus());
        }

        String[] result = new String[2];

        String output = response.getEntity(String.class);

        result[0] = String.valueOf(response.getStatus());

        System.err.println(result[1]);

        JsonParser parser = new JsonParser();
        JsonObject obj = parser.parse(output).getAsJsonObject();

        Gson gson = new Gson();

        Arquivo arquivo = gson.fromJson(obj, Arquivo.class);
    }

}

and here and where my button calls

private void bt_listaActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        new Rest().get();

    }
    
asked by anonymous 27.02.2018 / 19:10

0 answers