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

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

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

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

Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009994#comment-13009994 ] 

Henry Saputra commented on SHINDIG-1515:
----------------------------------------

If its ok with you, I would like to close this case with the proposed patch so we have different converters for request and response.

We will address reading from Accept header with SHINDIG-1518. I will also try to see if we could include this in the OpenSocial spec itself.

> 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

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

Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003826#comment-13003826 ] 

Henry Saputra commented on SHINDIG-1515:
----------------------------------------

I dont see in the OpenSocial Core API or Core Data specs on how to get the format of the response for REST services if "format" parameter is not specified.
I believe the core data spec only specify that the default is json.

I propose to add get converter for response and use these steps to determine the right converter:
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

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

Posted by "hongtao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010159#comment-13010159 ] 

hongtao commented on SHINDIG-1515:
----------------------------------

Thank you. I am ok with this solution.

> 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

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

Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009297#comment-13009297 ] 

Henry Saputra commented on SHINDIG-1515:
----------------------------------------

Add CR for fix to use "format" parameter to determine the return type based on OpenSocial Core API Server spec: http://opensocial-resources.googlecode.com/svn/spec/1.1/Core-API-Server.xml#Request-Parameter-Format-Value

Please review at:
http://codereview.appspot.com/4282058/

> 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

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

Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Saputra reassigned SHINDIG-1515:
--------------------------------------

    Assignee: Henry Saputra

> 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
>            Assignee: Henry Saputra
>
> 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

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

Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Saputra resolved SHINDIG-1515.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 3.0.0

Thanks. Its fixed with revision 1084860 at trunk.

> 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
>            Assignee: Henry Saputra
>             Fix For: 3.0.0
>
>
> 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

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

Posted by "Paul Lindner (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Lindner closed SHINDIG-1515.
---------------------------------


part of 2.5.0-beta1 release.

                
> 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
>            Assignee: Henry Saputra
>             Fix For: 2.5.0-beta1
>
>
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009753#comment-13009753 ] 

Henry Saputra commented on SHINDIG-1515:
----------------------------------------

The patch contain proposed change to separate logic to get converter for request and response. 
For response, the change is to use"format" request parameter as defined in the OpenSocial Core API server spec.

So with this change you can send POST request with Content-Type of XML but request return of format JSON by specifiying format=json in the URL parameter.


> 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

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

Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
    [ 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

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

Posted by "hongtao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009737#comment-13009737 ] 

hongtao commented on SHINDIG-1515:
----------------------------------

Hi,
http://codereview.appspot.com/4282058/patch/6002/14004
Is above the final patch for this bug?
I find no code uses "Accept" header to decide the converter for response.

The logic of the patch is, response converter is decided by format parameter, and is json if no format parameter specified.
Has shindig team decided not to use "Accept" header info?

Regards,
Hongtao

> 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

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

Posted by "Henry Saputra (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003814#comment-13003814 ] 

Henry Saputra commented on SHINDIG-1515:
----------------------------------------

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