Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(913)

Issue 4282058: Separate logic to get converter for REST response and request in DataServiceServlet (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 12 months ago by henry.saputra
Modified:
14 years, 11 months ago
Reviewers:
Paul Lindner, dev-remailer
Base URL:
http://svn.apache.org/repos/asf/shindig/trunk/
Visibility:
Public.

Description

This patch is related to JIRA bug (SHINDIG-1515) Why shindig uses "Content-Type" not "Accept" to determine the return info type. Currently the REST servlet, DataServiceServlet, uses the same converted to process request payload to also process the response content-type and body. This CR contains changes to separate the logic to get the BeanConverter for request and response, and also fix to the unit test cases. For response, it will simply check the "format" request parameter and defaulted to JSON if not specified as defined in the OpenSocial Core Server API spec 1.1. We could add logic to check Accept header for response if needed.

Patch Set 1 #

Patch Set 2 : remove line to set Accept header to null in unit test #

Patch Set 3 : Remove check for Accept header #

Patch Set 4 : change modifier for the methods #

Patch Set 5 : simplify the code to make override easier and remove duplicate lines #

Patch Set 6 : remove unneeded static string #

Patch Set 7 : rename internal variable names #

Patch Set 8 : some cleanup #

Total comments: 6

Messages

Total messages: 3
henry.saputra
Proposed fix to separate logic to get converter for REST response and request in DataServiceServlet.
14 years, 12 months ago (2011-03-19 02:32:41 UTC) #1
Paul Lindner
LGTM http://codereview.appspot.com/4282058/diff/6002/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java File java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java (right): http://codereview.appspot.com/4282058/diff/6002/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java#newcode171 java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java:171: contentType = ContentTypes.extractMimePart(servletRequest.getContentType()); remove commented code? http://codereview.appspot.com/4282058/diff/6002/java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java#newcode238 java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java:238: ...
14 years, 11 months ago (2011-03-23 15:40:04 UTC) #2
henry.saputra
14 years, 11 months ago (2011-03-24 07:05:28 UTC) #3
Thanks for the review Paul. Checked in as rev 1084860

http://codereview.appspot.com/4282058/diff/6002/java/common/src/main/java/org...
File
java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java
(right):

http://codereview.appspot.com/4282058/diff/6002/java/common/src/main/java/org...
java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java:171:
contentType = ContentTypes.extractMimePart(servletRequest.getContentType());
Thanks, will do.

On 2011/03/23 15:40:05, Paul Lindner wrote:
> remove commented code?

http://codereview.appspot.com/4282058/diff/6002/java/common/src/main/java/org...
java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java:238:
BeanConverter getConverterForRequest(String contentType, String format) {
Done.

On 2011/03/23 15:40:05, Paul Lindner wrote:
> add @Nullable if contentType can be null (which I believe it can be)

http://codereview.appspot.com/4282058/diff/6002/java/common/src/main/java/org...
java/common/src/main/java/org/apache/shindig/protocol/DataServiceServlet.java:275:
if (ATOM_FORMAT.equals(format)) {
Done, thanks for the input.

On 2011/03/23 15:40:05, Paul Lindner wrote:
> this (and the logic above) can be represented as a ternary 
>  return ATOM_FORMAT.equals(format) ? atomConverter :
>             XML_FORMAT.equals(format) ? xmlConverter :
>                 jsonConverter ;
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b