public CatalogItem[] getAllItems() { return services .getCatalogService() .register(CatalogItem.class) .request() .get(CatalogItem[].class); }
public void addCatalog() { Response response = services.getCatalogService().request().post(Entity.xml(catalogItem)); Response.StatusType statusInfo = response.getStatusInfo(); if (statusInfo.getStatusCode() == Response.Status.CREATED.getStatusCode()) status = "User added successfully"; else status = statusInfo.getReasonPhrase(); }
public String catalogServiceEndpoint() { String itemId = FacesContext.getCurrentInstance() .getExternalContext() .getRequestParameterMap() .get("itemId"); String response = services.getCatalogService().path(itemId).request().get(String.class); JsonObject jsonObject = Json.createReader(new StringReader(response)).readObject(); catalogItem.setId(jsonObject.getInt("id")); catalogItem.setName(jsonObject.getString("name")); catalogItem.setDescription(jsonObject.getString("description")); return response; }