Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
CXF interceptor fixing memory leak by removing attachments
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
import org.apache.cxf.endpoint.ClientImpl;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.phase.Phase;
* Fix CXF memory leak by removing attachments once the SOAP message was sent.
public class ClearAttachmentsOutInterceptor extends AbstractSoapInterceptor {
public ClearAttachmentsOutInterceptor() {
public void handleMessage(SoapMessage message) throws Fault {
org.apache.cxf.attachment.AttachmentSerializer.class, null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment