Search in sources :

Example 1 with DepthRestrictingStreamReader

use of org.apache.cxf.staxutils.DepthRestrictingStreamReader in project cxf by apache.

the class DepthRestrictingStreamInterceptor method handleMessage.

public void handleMessage(Message message) {
    if (canBeIgnored(message)) {
        return;
    }
    XMLStreamReader reader = message.getContent(XMLStreamReader.class);
    if (reader == null) {
        InputStream is = message.getContent(InputStream.class);
        if (is != null) {
            reader = StaxUtils.createXMLStreamReader(is);
            message.setContent(InputStream.class, null);
        }
        if (reader == null) {
            return;
        }
    }
    DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader, elementCountThreshold, innerElementLevelThreshold, innerElementCountThreshold);
    message.setContent(XMLStreamReader.class, dr);
}
Also used : XMLStreamReader(javax.xml.stream.XMLStreamReader) InputStream(java.io.InputStream) DepthRestrictingStreamReader(org.apache.cxf.staxutils.DepthRestrictingStreamReader)

Example 2 with DepthRestrictingStreamReader

use of org.apache.cxf.staxutils.DepthRestrictingStreamReader in project cxf by apache.

the class AbstractJAXBProvider method createDepthReaderIfNeeded.

protected XMLStreamReader createDepthReaderIfNeeded(XMLStreamReader reader, InputStream is) {
    DocumentDepthProperties props = getDepthProperties();
    if (props != null && props.isEffective()) {
        reader = TransformUtils.createNewReaderIfNeeded(reader, is);
        reader = new DepthRestrictingStreamReader(reader, props);
    } else if (reader != null) {
        reader = configureReaderRestrictions(reader);
    }
    return reader;
}
Also used : DocumentDepthProperties(org.apache.cxf.staxutils.DocumentDepthProperties) DepthRestrictingStreamReader(org.apache.cxf.staxutils.DepthRestrictingStreamReader)

Example 3 with DepthRestrictingStreamReader

use of org.apache.cxf.staxutils.DepthRestrictingStreamReader in project tomee by apache.

the class AbstractJAXBProvider method createDepthReaderIfNeeded.

protected XMLStreamReader createDepthReaderIfNeeded(XMLStreamReader reader, InputStream is) {
    DocumentDepthProperties props = getDepthProperties();
    if (props != null && props.isEffective()) {
        reader = TransformUtils.createNewReaderIfNeeded(reader, is);
        reader = new DepthRestrictingStreamReader(reader, props);
    } else if (reader != null) {
        reader = configureReaderRestrictions(reader);
    }
    return reader;
}
Also used : DocumentDepthProperties(org.apache.cxf.staxutils.DocumentDepthProperties) DepthRestrictingStreamReader(org.apache.cxf.staxutils.DepthRestrictingStreamReader)

Aggregations

DepthRestrictingStreamReader (org.apache.cxf.staxutils.DepthRestrictingStreamReader)3 DocumentDepthProperties (org.apache.cxf.staxutils.DocumentDepthProperties)2 InputStream (java.io.InputStream)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1