-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for issue #88 cxf tmp files not deleted
- Loading branch information
1 parent
edec240
commit 2c5616d
Showing
17 changed files
with
1,126 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/no/difi/oxalis/as4/inbound/AttachmentCleanupInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package no.difi.oxalis.as4.inbound; | ||
|
||
import lombok.SneakyThrows; | ||
import org.apache.cxf.attachment.As4AttachmentDataSource; | ||
import org.apache.cxf.attachment.As4AttachmentDeserializer; | ||
import org.apache.cxf.interceptor.Fault; | ||
import org.apache.cxf.message.Attachment; | ||
import org.apache.cxf.message.Exchange; | ||
import org.apache.cxf.message.Message; | ||
import org.apache.cxf.phase.AbstractPhaseInterceptor; | ||
import org.apache.cxf.phase.Phase; | ||
|
||
import javax.activation.DataSource; | ||
|
||
public class AttachmentCleanupInterceptor extends AbstractPhaseInterceptor<Message> { | ||
|
||
public AttachmentCleanupInterceptor() { | ||
super(Phase.POST_INVOKE); | ||
} | ||
|
||
public void handleMessage(Message message) throws Fault { | ||
Exchange exchange = message.getExchange(); | ||
cleanRequestAttachment(exchange); | ||
} | ||
|
||
private void cleanRequestAttachment(Exchange exchange) { | ||
As4AttachmentDeserializer ad = exchange.getInMessage().get(As4AttachmentDeserializer.class); | ||
ad.getRemoved().forEach(this::close); | ||
} | ||
|
||
@SneakyThrows | ||
private void close(Attachment attachment) { | ||
DataSource dataSource = attachment.getDataHandler().getDataSource(); | ||
|
||
if (dataSource instanceof As4AttachmentDataSource) { | ||
As4AttachmentDataSource ads = (As4AttachmentDataSource) dataSource; | ||
ads.closeAll(); | ||
} | ||
} | ||
} |
42 changes: 0 additions & 42 deletions
42
src/main/java/no/difi/oxalis/as4/inbound/CertificateValidatorSignatureTrustValidator.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.