private Response finalizeExistingWadlResponse(Document wadlDoc, Message m, UriInfo ui, MediaType mt) throws Exception { Object entity; if (stylesheetReference != null) { if (!applyStylesheetLocally) { ProcessingInstruction pi = wadlDoc.createProcessingInstruction("xml-stylesheet", getStylesheetInstructionData(getBaseURI(m, ui))); wadlDoc.insertBefore(pi, wadlDoc.getDocumentElement()); entity = copyDOMToString(wadlDoc); } else { entity = transformLocally(m, ui, new DOMSource(wadlDoc)); } } else { entity = new DOMSource(wadlDoc); } return Response.ok(entity, mt).build(); } private String copyDOMToString(Document wadlDoc) throws Exception {
private Response finalizeExistingWadlResponse(Document wadlDoc, Message m, UriInfo ui, MediaType mt) throws Exception { Object entity; if (stylesheetReference != null) { if (!applyStylesheetLocally) { ProcessingInstruction pi = wadlDoc.createProcessingInstruction("xml-stylesheet", getStylesheetInstructionData(getBaseURI(m, ui))); wadlDoc.insertBefore(pi, wadlDoc.getDocumentElement()); entity = copyDOMToString(wadlDoc); } else { entity = transformLocally(m, ui, new DOMSource(wadlDoc)); } } else { entity = new DOMSource(wadlDoc); } return Response.ok(entity, mt).build(); } private String copyDOMToString(Document wadlDoc) throws Exception {
StringBuilder sbMain = new StringBuilder(); if (!isJson && stylesheetReference != null && !applyStylesheetLocally) { sbMain.append("<?xml-stylesheet ").append(getStylesheetInstructionData(baseURI)).append("?>");
StringBuilder sbMain = new StringBuilder(); if (!isJson && stylesheetReference != null && !applyStylesheetLocally) { sbMain.append("<?xml-stylesheet ").append(getStylesheetInstructionData(baseURI)).append("?>");