You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shindig.apache.org by "Henry Saputra (JIRA)" <ji...@apache.org> on 2011/03/08 07:06:59 UTC

[jira] Issue Comment Edited: (SHINDIG-1515) Why shindig uses "Content-Type" not "Accept" to determine the return info type

    [ https://issues.apache.org/jira/browse/SHINDIG-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003814#comment-13003814 ] 

Henry Saputra edited comment on SHINDIG-1515 at 3/8/11 6:05 AM:
----------------------------------------------------------------

Updating my prev comment, looks like Shindig is using the same converter for handling request and response. Thats why Content-Type is used.

I guess DataServiceServlet need to create separate bean converter for converting the response.

      was (Author: hsaputra):
    I dont see in the OpenSocial Core API and Core Data specs on how to get the format of the response for REST services if "format" parameter is not specified. 
The core Data spec only specify that the default is json. 

The current code check Content-Type and use it instead the format request parameter if specified which not really following the spec IMO.

I propose these updated steps to determine the bean converter for DataServiceServlet:
1. Check for "format" request parameter and use it if available.
2. If it was not passed, Shindig will do courtesy to check Accept header and use the first one from the list that could be accepted if any.
3. Otherwise just use the json format as specified by the specs.

Thoughts?
  
> Why shindig uses "Content-Type" not "Accept" to determine the return info type
> ------------------------------------------------------------------------------
>
>                 Key: SHINDIG-1515
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1515
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 2.0.2
>            Reporter: hongtao
>
> I checked the shindig code(common org.apache.shindig.protocol.DataServiceServlet), which is used to handle opensocial REST call.
> The type of response is determined by "Content-Type" header, not "Accept" header.
> From reading of http1.1(Content-Type : http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17, Accept : http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1),
> my understanding is,
> The "Content-Type" is used by server to tell the receiver the type of response, when it is added to response.
> The "Accept" is used by request sender to tell server the type of response he expecting, when it is in request.
> The "Content-Type" in request should be used to tell server the type of request's content.
> Is this a bug of shindig that it utilizes "Content-Type" not "Accept" to decide the response type?
> Or if there is any doc specifies this behavior, please send me the link.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira