use of permafrost.tundra.xml.XMLCanonicalizationAlgorithm in project Tundra by Permafrost.
the class xml method canonicalize.
// ---( server methods )---
public static final void canonicalize(IData pipeline) throws ServiceException {
// --- <<IS-START(canonicalize)>> ---
// @subtype unknown
// @sigtype java 3.5
// [i] object:0:optional $content
// [i] field:0:optional $encoding
// [i] field:0:optional $algorithm {"Canonical XML Version 1.0","Canonical XML Version 1.0 With Comments","Canonical XML Version 1.1","Canonical XML Version 1.1 With Comments","Exclusive Canonical XML Version 1.0","Exclusive Canonical XML Version 1.0 With Comments"}
// [i] field:0:optional $mode {"stream","bytes","string"}
// [o] object:0:optional $content.canonical
IDataCursor cursor = pipeline.getCursor();
try {
Object content = IDataHelper.get(cursor, "$content");
Charset charset = IDataHelper.get(cursor, "$encoding", Charset.class);
XMLCanonicalizationAlgorithm algorithm = XMLCanonicalizationAlgorithm.normalize(IDataHelper.get(cursor, "$algorithm", String.class));
ObjectConvertMode mode = IDataHelper.get(cursor, "$mode", ObjectConvertMode.class);
if (content != null)
IDataHelper.put(cursor, "$content.canonical", ObjectHelper.convert(XMLCanonicalizationHelper.canonicalize(BytesHelper.normalize(content, charset), charset, algorithm), charset, mode));
} catch (IOException ex) {
ExceptionHelper.raise(ex);
} finally {
cursor.destroy();
}
// --- <<IS-END>> ---
}
Aggregations