try {
RestClient client = new RestClient();
Resource resource =
client.resource(MessageFormat.format(SERVICE_URL, String.valueOf(server
.getServerPort())));
Providers providers = RuntimeContextTLS.getRuntimeContext().getProviders();
MessageBodyReader<AtomFeed> afp =
providers.getMessageBodyReader(AtomFeed.class,
AtomFeed.class,
null,
MediaType.APPLICATION_ATOM_XML_TYPE);
AtomFeed entryToPost =
afp.readFrom(AtomFeed.class,
null,
null,
MediaType.APPLICATION_ATOM_XML_TYPE,
null,
new ByteArrayInputStream(FEED.getBytes()));
AtomFeed responseEntity =
resource.accept(MediaType.APPLICATION_ATOM_XML_TYPE)
.contentType(MediaType.APPLICATION_ATOM_XML_TYPE).post(AtomFeed.class,
entryToPost);
ByteArrayOutputStream os = new ByteArrayOutputStream();
MessageBodyWriter<AtomFeed> writer =
providers.getMessageBodyWriter(AtomFeed.class,
AtomFeed.class,
null,
MediaType.APPLICATION_ATOM_XML_TYPE);
writer.writeTo(responseEntity,
AtomFeed.class,