public RepositoryRouteResource getResourceFromText(String responseString) { assertThat(responseString, not(IsEmptyString.isEmptyOrNullString())); XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType); RepositoryRouteResourceResponse resourceResponse = (RepositoryRouteResourceResponse) representation.getPayload(new RepositoryRouteResourceResponse()); return resourceResponse.getData(); }
/** IMPORTANT: Make sure to release the Response in a finally block when you are done with it. */ public Response sendMessage(Method method, RepositoryRouteResource resource) throws IOException { XStreamRepresentation representation = new XStreamRepresentation(xstream, "", mediaType); String resourceId = (resource.getId() == null) ? "" : "/" + resource.getId(); String serviceURI = "service/local/repo_routes" + resourceId; if (method != Method.GET || method != Method.DELETE) { RepositoryRouteResourceResponse requestResponse = new RepositoryRouteResourceResponse(); requestResponse.setData(resource); // now set the payload representation.setPayload(requestResponse); } return RequestFacade.sendMessage(serviceURI, method, representation); }