fmancinelli (SVN) wrote:
Author: fmancinelli Date: 2008-12-31 11:06:24 +0100 (Wed, 31 Dec 2008) New Revision: 14987
Modified: sandbox/xwiki-core-rest/src/main/java/org/xwiki/rest/PageResource.java sandbox/xwiki-core-rest/src/main/java/org/xwiki/rest/PagesResource.java sandbox/xwiki-core-rest/src/main/java/org/xwiki/rest/SpacesResource.java Log: Added proper error handling and status code setting in response headers.
Modified: sandbox/xwiki-core-rest/src/main/java/org/xwiki/rest/PageResource.java =================================================================== + /* Represent */ + if (variant.getMediaType().equals(MediaType.TEXT_XML)) { + return new StringRepresentation(Utils.toXml(DomainObjectFactory.createPage(getRequest(), doc)), + MediaType.APPLICATION_XML); + } else if (variant.getMediaType().equals(MediaType.TEXT_PLAIN)) { + return new StringRepresentation(doc.getContent(), MediaType.TEXT_PLAIN); + }
This if-else looks bad. What will happen when we support more formats? PDF, XAR, HTML, RTF, zip, RDF... -- Sergiu Dumitriu http://purl.org/net/sergiu/