RE: http-request: c:response/c:body/@content-type value

>   In p:http-request, when using @override-content-type, should
> c:body/@content-type contain the overridden content type, or the
> overriding one?  For instance, with the following request:
> 
>     <c:request override-content-type="text/plain" .../>
> 
> should we get:
> 
>     <c:response ...>
>        <c:header name="Content-Type" value="application/xml"/>
>        ...
>        <c:body content-type="text/plain">
>           ...
>        </c:body>
>     </c:response>
> 
> or instead:
> 
>     <c:response ...>
>        <c:header name="Content-Type" value="application/xml"/>
>        ...
>        <c:body content-type="application/xml">
>           ...
>        </c:body>
>     </c:response>
> 
>   Personally, I think the former is more logical, because
> c:body/@content-type represent the type used to build the c:body,
> the original content type being still available in the headers.
> But I can't find a clear response in the CR.

The way I read the spec, I would say the latter is correct (that is,
"application/xml" will be used in both cases).

7.1.10.2: "The content-type attribute specifies the media type of the
body or body part, that is, the value of its Content-Type header."

7.1.10.3: "The override-content-type attribute controls interpretation
of the response's Content-Type header. If this attribute is present, the
response will be treated as if it returned the Content-Type given by its
value. This original Content-Type header will however be reflected
unchanged as a c:header in the result document"

But you are probably right. The relationship between
override-content-type and c:body/@content-type is not clearly defined in
the spec.

> 
>   A related question is: should we use the full Content-Type
> header value, or just the media type within it for @content-type?
> For instance, should we get:
> 
>     <c:header name="Content-Type" value="text/xml; charset=utf-8"/>
>     <c:body content-type="text/xml">
> 
> or:
> 
>     <c:header name="Content-Type" value="text/xml; charset=utf-8"/>
>     <c:body content-type="text/xml; charset=utf-8">
> 
> in the c:response?
> 

I have been wondering about this as well. I use the full value in both
cases. As far as I know, there is nothing in the spec that says that
@content-type should be stripped off some information.

Regards,
Vojtech

Received on Tuesday, 10 February 2009 08:46:17 UTC