public String getCharsetEncoding() { return document.getCharsetEncoding(); }
String getEncoding() { if (currentEvent == START_DOCUMENT) { if (node instanceof OMDocument) { return ((OMDocument)node).getCharsetEncoding(); } else { return null; } } else { throw new IllegalStateException(); } }
String getEncoding() { if (currentEvent == START_DOCUMENT) { if (node instanceof OMDocument) { return ((OMDocument)node).getCharsetEncoding(); } else { return null; } } else { throw new IllegalStateException(); } }
/** * Method getEncoding. * * @return Returns String. */ public String getEncoding() { if (parser != null) { return parser.getEncoding(); } else { if (currentEvent == START_DOCUMENT) { if (lastNode instanceof OMDocument) { return ((OMDocument)lastNode).getCharsetEncoding(); } else { return null; } } else { throw new IllegalStateException(); } } }
public void writeTo(Base base, Writer out, WriterOptions options) throws IOException { try { XMLStreamWriter w = StAXUtils.createXMLStreamWriter(out); XMLStreamWriter pw = new PrettyStreamWriter(w); OMElement om = (base instanceof Document) ? getOMElement(((Document)base).getRoot()) : (OMElement)base; String charset = options.getCharset(); if (om.getParent() != null && om.getParent() instanceof OMDocument) { OMDocument doc = (OMDocument)om.getParent(); pw.writeStartDocument(charset != null ? charset : doc.getCharsetEncoding(), doc.getXMLVersion()); } om.serialize(pw); pw.writeEndDocument(); if (options.getAutoClose()) out.close(); } catch (XMLStreamException e) { throw new RuntimeException(e); } }
encoding = document.getCharsetEncoding();
public OMElement processDocument(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault { try { String charSetEncoding = (String) messageContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); // createSOAPModelBuilder takes care of configuring the underlying parser to // avoid the security issue described in CVE-2010-1632 OMXMLParserWrapper builder = OMXMLBuilderFactory.createSOAPModelBuilder(inputStream, charSetEncoding); messageContext.setProperty(Constants.BUILDER, builder); SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement(); BuilderUtil .validateSOAPVersion(BuilderUtil.getEnvelopeNamespace(contentType), envelope); BuilderUtil.validateCharSetEncoding(charSetEncoding, builder.getDocument() .getCharsetEncoding(), envelope.getNamespace().getNamespaceURI()); return envelope; } catch (IOException e) { throw AxisFault.makeFault(e); } }
public OMElement processMIMEMessage(Attachments attachments, String contentType, MessageContext messageContext) throws AxisFault { try { // TODO: this will be changed later (see AXIS2-5308) messageContext.setAttachmentMap(attachments); SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(attachments); OMDocument document = builder.getDocument(); String charsetEncoding = document.getCharsetEncoding(); if (charsetEncoding == null) { charsetEncoding = MessageContext.UTF_8; } messageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charsetEncoding); SOAPEnvelope envelope = (SOAPEnvelope)document.getOMDocumentElement(); // TODO: Axiom should take care of this, but we need to validate that // BuilderUtil // .validateSOAPVersion(BuilderUtil.getEnvelopeNamespace(contentType), envelope); // BuilderUtil.validateCharSetEncoding(charSetEncoding, builder.getDocument() // .getCharsetEncoding(), envelope.getNamespace().getNamespaceURI()); messageContext.setDoingMTOM(true); return envelope; } catch (OMException e) { throw AxisFault.makeFault(e); } } }
public OMElement processDocument(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault { try { String charSetEncoding = (String) messageContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); // Apply a detachable inputstream. This can be used later // to (a) get the length of the incoming message or (b) // free transport resources. DetachableInputStream is = new DetachableInputStream(inputStream); messageContext.setProperty(Constants.DETACHABLE_INPUT_STREAM, is); // createSOAPModelBuilder takes care of configuring the underlying parser to // avoid the security issue described in CVE-2010-1632 OMXMLParserWrapper builder = OMXMLBuilderFactory.createSOAPModelBuilder(is, charSetEncoding); SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement(); BuilderUtil .validateSOAPVersion(BuilderUtil.getEnvelopeNamespace(contentType), envelope); BuilderUtil.validateCharSetEncoding(charSetEncoding, builder.getDocument() .getCharsetEncoding(), envelope.getNamespace().getNamespaceURI()); return envelope; } catch (IOException e) { throw AxisFault.makeFault(e); } }
messageContext.setProperty(Constants.BUILDER, builder); OMDocument document = builder.getDocument(); String charsetEncoding = document.getCharsetEncoding(); if (charsetEncoding == null) { charsetEncoding = MessageContext.UTF_8;