Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ More detailed information is available in the DeveloperGuide.odt in the docs fol
The following commands can be used in the build process.

Updating Maven to a different version:
`./mvnw wrapper:wrapper -Dmaven=3.9.9
`./mvnw wrapper:wrapper -Dmaven=3.9.9`

Checking dependency tree:
`./mvnw dependency:tree`
Expand Down Expand Up @@ -92,7 +92,7 @@ $ docker build -t openas2:latest .
```

Run the OpenAS2 server, with its network set to "host", so that the WebUI can access the server.
NOTE: Some users have reported that using --net=host does not work for them and removing it solves the problem..
NOTE: Some users have reported that using --net=host does not work for them and removing it solves the problem.

```console
$ docker run -it --rm --net=host -p 4080:10080 -p 4081:10081 -p 8443:8080 -v ${PWD}/config:/opt/openas2/config -v ${PWD}/data:/opt/openas2/data openas2:latest
Expand Down Expand Up @@ -145,7 +145,7 @@ $ docker compose logs openas2_webui

## Dynamically configure your container using environment variables

Here is a short explaination how to override properties in the container's `config.xml` file using environment variables.
Here is a short explanation how to override properties in the container's `config.xml` file using environment variables.

**Prerequisites:**

Expand Down
43 changes: 32 additions & 11 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
# OpenAS2 Server
# Version 4.7.1
# Version 4.7.2
# RELEASE NOTES
-----
The OpenAS2 project is pleased to announce the release of OpenAS2 4.7.1
The OpenAS2 project is pleased to announce the release of OpenAS2 4.7.2

The release download file is: OpenAS2Server-4.7.1.zip
The release download file is: OpenAS2Server-4.7.2.zip

The zip file contains a PDF document (OpenAS2HowTo.pdf) providing information on installing and using the application.
## NOTE: Testing covers Java 11 to 21.
## Java 8 is NO LONGER SUPPORTED.

Version 4.7.1 - 2025-10-20

This is a minor bufix release.
1. Fix boolean return values from processMDN method causing wrong log message.
2. Fix logging WARN message that should have been a TRACE log.


##Upgrade Notes
Version 4.7.2 - 2025-10-23

This is a minor bugfix release.

1. Changes to partnership.xml

* New optional attribute `quote_send_file_name` for the partnership to specify if
the filename which is to be included in header `Content-Disposition: Attachment; filename="filename.ext"` should be quoted or not.
Useful for target AS2 servers which are picky about the quotes. Requires `sendfilename="true"` to be set.

Any value other than "false" will be considered true - default: true (previous behaviour).
````
<!-- Configuration at partnership-level -->
<partnership name="MyCompany-to-PartnerA">
<sender name="MyCompany"/>
<receiver name="PartnerA"/>
<!-- ... -->

<!-- Prerequisite: sendfilename has to be set -->
<!-- a) Set pollerConfigBase.sendfilename="true" in the config.xml OR -->
<!-- b) Set sendfilename="true" at partnership-level in the partnerships.xml using pollerConfig -->
<pollerConfig enabled="true" sendfilename="true"/>

<!-- Example for disabling the quoting of the sent filename at partnership-level. -->
<attribute name="quote_send_file_name" value="false"/>
</partnership>
````

## Upgrade Notes
See the openAS2HowTo appendix for the general process on upgrading OpenAS2.

Below are some specific things to focus on depending on which version you are upgrading from.
Expand Down
7 changes: 7 additions & 0 deletions Server/src/config/partnerships.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
<attribute name="split_file_contains_header_row" value="true"/>
<attribute name="split_file_name_prefix" value="SF"/>
-->
<!--
Example for disabling the quoting of the sent filename at partnership-level.
Works only in combination with sendfilename="true" using pollerConfigBase.sendfilename="true" in the config.xml OR
at partnership-level in the partnerships.xml using &lt;pollerConfig enabled="true" sendfilename="true"/&gt;

<attribute name="quote_send_file_name" value="false"/>
-->
</partnership>
<partnership name="PartnerA-to-MyCompany">
<sender name="PartnerA"/>
Expand Down
1 change: 1 addition & 0 deletions Server/src/main/java/org/openas2/partner/Partnership.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class Partnership implements Serializable {
public static final String PA_SPLIT_FILE_CONTAINS_HEADER_ROW = "split_file_contains_header_row";
public static final String PA_SPLIT_FILE_NAME_PREFIX = "split_file_name_prefix";
public static final String PA_RESEND_ON_SSL_EXCEPTION = "resend_on_ssl_exception";
public static final String PA_QUOTE_SEND_FILE_NAME = "quote_send_file_name"; // Allow disabling the quoting of the filename in header when sendfilename=true is set
// A hopefully temporary key to maintain backwards compatibility
public static final String USE_NEW_CERTIFICATE_LOOKUP_MODE = "use_new_certificate_lookup_mode";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public abstract class MessageBuilderModule extends BaseReceiverModule {
public static final String PARAM_DEFAULTS = "defaults";
public static final String PARAM_MIMETYPE = "mimetype";
public static final String PARAM_RESEND_MAX_RETRIES = "resend_max_retries";

// Note: When this option is enabled, you can also configure its quoting using "quote_send_file_name" at partnership-level
public static final String PARAM_SEND_FILENAME = "sendfilename";

private Logger logger = LoggerFactory.getLogger(MessageBuilderModule.class);

public void init(Session session, Map<String, String> options) throws OpenAS2Exception {
Expand Down Expand Up @@ -398,14 +400,28 @@ public String getMessageContentType(Message msg) throws OpenAS2Exception {
return contentType;
}

private void setAdditionalMetaData(Message msg, MimeBodyPart mimeBodyPart) throws OpenAS2Exception {
// @VisibleForTesting
protected void setAdditionalMetaData(Message msg, MimeBodyPart mimeBodyPart) throws OpenAS2Exception {

try {
// add below statement will tell the receiver to save the filename
// as the one sent by sender. 2007-06-01
String sendFileName = getParameter("sendfilename", false);
String sendFileName = getParameter(PARAM_SEND_FILENAME, false);
if (sendFileName != null && sendFileName.equals("true")) {
String contentDisposition = "Attachment; filename=\"" + msg.getAttribute(FileAttribute.MA_FILENAME) + "\"";
// Allow configuration of the quoting at partnership-level
String quoteFileName = msg.getPartnership().getAttribute(Partnership.PA_QUOTE_SEND_FILE_NAME);

String quoteFileNameSign;
if ("false".equalsIgnoreCase(quoteFileName)){
// Explicitly disabled
quoteFileNameSign = "";
} else {
// For backward compatibility - default
// Or explicitly enabled
quoteFileNameSign = "\"";
}

String contentDisposition = String.format("Attachment; filename=%s%s%s", quoteFileNameSign, msg.getAttribute(FileAttribute.MA_FILENAME), quoteFileNameSign);
mimeBodyPart.setHeader("Content-Disposition", contentDisposition);
msg.setContentDisposition(contentDisposition);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package org.openas2.processor.receiver;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import jakarta.mail.internet.MimeBodyPart;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import org.junit.jupiter.api.TestMethodOrder;
import org.openas2.OpenAS2Exception;
import org.openas2.app.BaseServerSetup;
import org.openas2.message.FileAttribute;
import org.openas2.partner.Partnership;

@TestInstance(Lifecycle.PER_CLASS)
@TestMethodOrder(MethodOrderer.MethodName.class)
public class ContentDispositionTest extends BaseServerSetup {
private DirectoryPollingModule poller;

@BeforeAll
public void setUp() throws Exception {
super.createFileSystemResources();
super.setup();
this.poller = session.getPartnershipPoller(simpleTestMsg.getPartnership().getName());
}

@AfterAll
public void tearDown() throws Exception {
super.tearDown();
}

@Test
public void shouldUseSettingFromPartnership() throws Exception {

// Set the partnership to disable quotes for the filename
assertThat(getContentDispositionForQuoteConfiguration("false"), is("Attachment; filename=filename.ext"));
assertThat(getContentDispositionForQuoteConfiguration("FALSE"), is("Attachment; filename=filename.ext"));
assertThat(getContentDispositionForQuoteConfiguration("False"), is("Attachment; filename=filename.ext"));

// Set the partnership to enable quotes for the filename
assertThat(getContentDispositionForQuoteConfiguration("true"), is("Attachment; filename=\"filename.ext\""));
assertThat(getContentDispositionForQuoteConfiguration("TRUE"), is("Attachment; filename=\"filename.ext\""));
assertThat(getContentDispositionForQuoteConfiguration("tRuE"), is("Attachment; filename=\"filename.ext\""));
}

@Test
public void shouldUseDefaultSetting() throws Exception {

//Check backward compatible configuration
assertThat(getContentDispositionForQuoteConfiguration(""), is("Attachment; filename=\"filename.ext\""));
assertThat(getContentDispositionForQuoteConfiguration(null), is("Attachment; filename=\"filename.ext\""));
assertThat(getContentDispositionForQuoteConfiguration("other"), is("Attachment; filename=\"filename.ext\""));
}

private String getContentDispositionForQuoteConfiguration(String valueOfQuoteSendFileName) throws OpenAS2Exception {

if (valueOfQuoteSendFileName != null) {
simpleTestMsg.getPartnership().setAttribute(Partnership.PA_QUOTE_SEND_FILE_NAME, valueOfQuoteSendFileName);
}

simpleTestMsg.setAttribute(FileAttribute.MA_FILENAME, "filename.ext");
this.poller.setAdditionalMetaData(simpleTestMsg, new MimeBodyPart());

return simpleTestMsg.getContentDisposition();
}


}
26 changes: 26 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
**IMPORTANT NOTE**: Please review upgrade notes in the RELEASE-NOTES.md if you are upgrading

Version 4.7.2 - 2025-10-23

This is a minor enhancement release.
1. Changes to partnership.xml

* New optional attribute `quote_send_file_name` for the partnership to specify if
the filename which is to be included in header `Content-Disposition: Attachment; filename="filename.ext"` should be quoted or not.
Useful for target AS2 servers which are picky about the quotes. Requires `sendfilename="true"` to be set.

Any value other than "false" will be considered true - default: true (previous behaviour).

<!-- Configuration at partnership-level -->
<partnership name="MyCompany-to-PartnerA">
<sender name="MyCompany"/>
<receiver name="PartnerA"/>
<!-- ... -->

<!-- Prerequisite: sendfilename has to be set -->
<!-- a) Set pollerConfigBase.sendfilename="true" in the config.xml OR -->
<!-- b) Set sendfilename="true" at partnership-level in the partnerships.xml using pollerConfig -->
<pollerConfig enabled="true" sendfilename="true"/>

<!-- Example for disabling the quoting of the sent filename at partnership-level. -->
<attribute name="quote_send_file_name" value="false"/>
</partnership>

Version 4.7.1 - 2025-10-20

This is a minor enhancement release.
Expand Down