xforms:header Content-Type is ignored with a PUT submission

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

xforms:header Content-Type is ignored with a PUT submission

benjamin.dougherty
We require a different content type header to be set on a PUT submission i.e.

<xforms:header>
        <xforms:name>Content-Type</xforms:name>
        <xforms:value>application/vnd.iptc.g2.newsitem+xml</xforms:value>
</xforms:header>

unfortunately this does not seem to work and all PUT submissions have a Content-Type of 'application/xml'

Is this a bug or is there something I'm missing?

We are using Orbeon 3.9.0 CE.

Thanks for your help,
Ben.
Reply | Threaded
Open this post in threaded view
|

Re: xforms:header Content-Type is ignored with a PUT submission

Erik Bruchez
Administrator
Ben,

It is possible that the default mediatype is overriding your header.
Did you try the `mediatype` attribute on `xforms:submission` instead?
E.g.:

<xforms:submission mediatype="application/vnd.iptc.g2.newsitem+xml" …/>

-Erik

On Sun, Feb 26, 2012 at 9:11 AM, benjamin.dougherty
<[hidden email]> wrote:

> We require a different content type header to be set on a PUT submission i.e.
>
> <xforms:header>
>        <xforms:name>Content-Type</xforms:name>
>        <xforms:value>application/vnd.iptc.g2.newsitem+xml</xforms:value>
> </xforms:header>
>
> unfortunately this does not seem to work and all PUT submissions have a
> Content-Type of 'application/xml'
>
> Is this a bug or is there something I'm missing?
>
> We are using Orbeon 3.9.0 CE.
>
> Thanks for your help,
> Ben.
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/xforms-header-Content-Type-is-ignored-with-a-PUT-submission-tp4422496p4422496.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: xforms:header Content-Type is ignored with a PUT submission

benjamin.dougherty
Hi Erik thanks for the reply,

That does work but only when you do serialization not when serialization="none" so after digging into the code a little:

In 3.9.0CE method org.orbeon.oxf.util.Connection.connect line 420 should

// Set request content type
                    if (!didSOAP && hasRequestBody) {
                        final String actualContentType = (contentType != null) ? contentType : "application/xml";
                        headersMap.put("Content-Type", new String[] { actualContentType });
                        indentedLogger.logDebug(LOG_TYPE, "setting header", "Content-Type", actualContentType);
                    }

not be

// Set request content type
                    if (!didSOAP && hasRequestBody && headersMap.get("Content-Type")==null) {
                        final String actualContentType = (contentType != null) ? contentType : "application/xml";
                        headersMap.put("Content-Type", new String[] { actualContentType });
                        indentedLogger.logDebug(LOG_TYPE, "setting header", "Content-Type", actualContentType);
                    }

or maybe append actualContentType to 'Content-Type' header?

Regards,
Ben.
Reply | Threaded
Open this post in threaded view
|

Re: Re: xforms:header Content-Type is ignored with a PUT submission

Erik Bruchez
Administrator
Ben,

That might be the right thing to do! Before committing that change we
need to try it out a bit though,

-Erik

On Wed, Feb 29, 2012 at 7:06 AM, benjamin.dougherty
<[hidden email]> wrote:

> Hi Erik thanks for the reply,
>
> That does work but only when you do serialization not when
> serialization="none" so after digging into the code a little:
>
> In 3.9.0CE method org.orbeon.oxf.util.Connection.connect line 420 should
>
> // Set request content type
>                    if (!didSOAP && hasRequestBody) {
>                        final String actualContentType = (contentType !=
> null) ? contentType : "application/xml";
>                        headersMap.put("Content-Type", new String[] {
> actualContentType });
>                        indentedLogger.logDebug(LOG_TYPE, "setting header",
> "Content-Type", actualContentType);
>                    }
>
> not be
>
> // Set request content type
>                    if (!didSOAP && hasRequestBody &&
> headersMap.get("Content-Type")==null) {
>                        final String actualContentType = (contentType !=
> null) ? contentType : "application/xml";
>                        headersMap.put("Content-Type", new String[] {
> actualContentType });
>                        indentedLogger.logDebug(LOG_TYPE, "setting header",
> "Content-Type", actualContentType);
>                    }
>
> or maybe append actualContentType to 'Content-Type' header?
>
> Regards,
> Ben.
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/xforms-header-Content-Type-is-ignored-with-a-PUT-submission-tp4422496p4431777.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws