I am having trouble correctly formatting my PUT request to get my server to recognise my client application's PUT command.
Here is my section of code that puts a JSON string to the server.
try {
URI uri = new URI("the server address goes here");
URL url = uri.toURL();
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter out = new OutputStreamWriter(conn.getOutputStream());
out.write(gson.toJson(newClient));
out.close();
} catch (Exception e) {
Logger.getLogger(CATHomeMain.class.getName()).log(Level.SEVERE, null, e);
}
and here is the code that is supposed to catch the PUT command
@PUT
@Consumes("text/plain")
public void postAddClient(String content, @PathParam("var1") String var1, @PathParam("var2") String var2) {
What am I doing wrong?