记录 SOAP 消息时如何忽略 base64binary 字段?
我正在使用 Spring 的 SoapEnvelopeLoggingInterceptor 来记录 SOAP 请求/响应。
一些请求/响应包含 base64Binary
字段,这些字段占用日志文件中的大量空间,并且我不需要出于我的目的而记录它。
深入研究 SoapEnvelopeLoggingInterceptor 的代码,我可以看到使用的 java.xml.transform.Transformer 是这样创建的:
Transformer transformer = createTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, "no");
return transformer;
是否有一些我可以在 Transformer 上设置的属性 这会阻止它打印 base64Binary
字段的内容?或者我可以配置或覆盖其他任何内容以防止其被记录?
I am using Spring's SoapEnvelopeLoggingInterceptor
to log SOAP requests/responses.
Some of the requests/responses contains base64Binary
fields which takes up a lot of space in the log files and I don't require to log it for my purposes.
Digging into the code of SoapEnvelopeLoggingInterceptor
I can see the java.xml.transform.Transformer
used is created like this:
Transformer transformer = createTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, "no");
return transformer;
Are there some properties I can set on the Transformer
which will prevent it from printing out the contents of the base64Binary
fields? Or anything else I can configure or override to prevent it from being logged?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不了解 Transformer,但我认为 Base64 字段的大写和小写字母数量大致相等。普通文本往往会包含更多小写字母或全部大写字母。您也许能够通过这种方式确定差异。
还有一些标点符号从未出现在 Base64 中。看到其中任何一个都会告诉您该字段不是 Base64。
I do not know about Transformer, however I would think that a Base64 field will have roughly equal numbers of uppercase and lowercase letters. Normal text will tend to have either many more lowercase or be all uppercase. You may be able to determine the difference that way.
Also there are punctuation characters that never appear in Base64. Seeing any one of those will tell you that the field is not Base64.