public StreamBuilder startDocument(String xmlversion, String charset) { if (root != null) throw new IllegalStateException("Document already started"); root = abdera.getFactory().newDocument(); ((Document)root).setCharset(charset); current = root; return this; }
public StreamBuilder startDocument(String xmlversion, String charset) { if (root != null) throw new IllegalStateException("Document already started"); root = abdera.getFactory().newDocument(); ((Document)root).setCharset(charset); current = root; return this; }
private Response makeRepositoryInfoResponse(HttpServletRequest httpRequest, URI baseUri, String repositoryId) { Service service = AbderaFactory.getInstance().getFactory().newService(); service.declareNS(AtomCMIS.CMIS_NS_URI, AtomCMIS.CMIS_PREFIX); service.declareNS(AtomCMIS.CMISRA_NS_URI, AtomCMIS.CMISRA_PREFIX); addCmisRepository(httpRequest, service, repositoryId, baseUri); Document<Service> serviceDocument = service.getDocument(); serviceDocument.setCharset("utf-8"); ResponseContext abderaResponse = new BaseResponseContext<Document<Service>>(serviceDocument); abderaResponse.setStatus(200); return Response.ok(abderaResponse).header(HttpHeaders.CACHE_CONTROL, "no-cache") .type(MediaType.APPLICATION_ATOM_XML).build(); }
@SuppressWarnings("unchecked") public void writeTo(Base base, OutputStream out, WriterOptions options) throws IOException { out = getCompressedOutputStream(out, options); String charset = options.getCharset(); if (charset == null) { if (base instanceof Document) charset = ((Document)base).getCharset(); else if (base instanceof Element) { Document doc = ((Element)base).getDocument(); if (doc != null) charset = doc.getCharset(); } if (charset == null) charset = "UTF-8"; } else { Document doc = null; if (base instanceof Document) doc = (Document)base; else if (base instanceof Element) doc = ((Element)base).getDocument(); if (doc != null) doc.setCharset(charset); } base.writeTo(new OutputStreamWriter(out, charset)); finishCompressedOutputStream(out, options); if (options.getAutoClose()) out.close(); }