public Object set4(String name, Object value, Boolean unset, Boolean sync) throws ClientProtocolException, IOException { Form form = Form.form().add("name", name).add("sync", sync.toString()).add("session", this.session); if (!unset) { form.add("value", mapper.writeValueAsString(value)); } String reply = Request.Post(urlBase + "/set") .addHeader("Authorization", auth) .bodyForm(form.build()) .execute() .returnContent() .asString(); if (!reply.equals("ok")) { throw new RuntimeException(reply); } return value; }