Working with content-type and file extensions
faoggor opened this issue · comments
Hi.
I have 2 questions.
-
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?
-
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.
- 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.
- 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.
Thanks for answers. I would like to look at the implementation of dynamic Content-Type.
It’s clear about "mimetype".
The feature is in latest release 3.8.0 - let me know if that works for you.