OpenAS2 / OpenAs2App

OpenAS2 is a java-based implementation of the EDIINT AS2 standard. It is intended to be used as a server. It is extremely configurable and supports a wide variety of signing and encryption algorithms.
https://sourceforge.net/projects/openas2/
GNU General Public License v3.0
185 stars 137 forks source link

Working with content-type and file extensions #345

Closed faoggor closed 6 months ago

faoggor commented 1 year ago

Hi.

I have 2 questions.

  1. My partner needs the content type in the Content-Type header for files with the .edi extension to be application/edifact, for .xml - application/xml, for others the default type. How can this be configured? Partnership has a content_type attribute, but according to the documentation it substitutes content for all messages. Is there a way to set a specific type for a specific file extension?

  2. What is the difference between the content_type attribute in partnership (xpath /partnerships/partnership/attribute[@name='content_type']/@value) and the mimetype attribute in pollerConfig (xpath /partnerships/partnership/pollerConfig/@mimetype)? According to the documentation at the partnership level in pollerConfig, I can override any parameter from the global pollerConfigBase setting (same attribute is /openas2/pollerConfigBase/@mimetype). It turns out that the mimetype for pollerConfig actually duplicates the function of the content_type attribute on the same partnership?

Thank you.

uhurusurfa commented 1 year ago
  1. There is currently no way to set the Content-Type dynamically based on the filename extension - it would have to be an enhancement though should be relatively straightforward. I will look into adding that feature in the next week or so. It will allow you to define a set of mappings from filename extension to content type with a fallback to the global content type.
  2. Essentially yes, you are correct. The mimetype attribute is the last ditch fallback in case there is no no partnership attribute "content_type" or global "content_type" property (not documented but you can set a property "content_type" and it will apply globally if the partnership does not have a content_type set).The mimetype on the poller is not much use really because you can only configure 1 poller per partnership so I will probably deprecate the use of "mimetype" on the pollerConfig.
faoggor commented 1 year ago

Thanks for answers. I would like to look at the implementation of dynamic Content-Type.

It’s clear about "mimetype".

uhurusurfa commented 1 year ago

The feature is in latest release 3.8.0 - let me know if that works for you.