use of org.apache.axiom.ext.stax.datahandler.DataHandlerProvider in project webservices-axiom by apache.
the class XOPEncodingFilterHandler method processCharacterData.
@Override
protected String processCharacterData(Object data) throws StreamException {
if (data instanceof TextContent) {
TextContent textContent = (TextContent) data;
if (textContent.isBinary()) {
Object dataHandlerObject = textContent.getDataHandlerObject();
boolean optimize;
try {
if (dataHandlerObject instanceof DataHandlerProvider) {
optimize = optimizationPolicy.isOptimized((DataHandlerProvider) dataHandlerObject, textContent.isOptimize());
} else {
optimize = optimizationPolicy.isOptimized((DataHandler) dataHandlerObject, textContent.isOptimize());
}
} catch (IOException ex) {
throw new StreamException(ex);
}
if (optimize) {
String contentID = contentIDGenerator.generateContentID(textContent.getContentID());
dataHandlerObjects.put(contentID, dataHandlerObject);
return contentID;
}
}
}
return null;
}
Aggregations