public Representation post(Representation entity) {
if (entity==null) {
getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
return new StringRepresentation("Missing post body.");
}
MediaType postType = entity.getMediaType();
if (postType.getName().equals("application/sparql-query")) {
return handleSparqlPost(entity);
} else if (!postType.getName().equals(MediaType.APPLICATION_XML.getName())) {
getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
return new StringRepresentation("Non-xml media type "+postType.getName());
}
String charset = postType.getParameters().getValues("charset");
if (charset==null) {
charset = "UTF-8";
}
Document doc = null;
DocumentLoader loader = new SAXDocumentLoader();