> On Aug. 1, 2016, 8:09 p.m., Joshua Cohen wrote: > > Overall looks good to me. > > > > +1 to David's comment as well.
Done. > On Aug. 1, 2016, 8:09 p.m., Joshua Cohen wrote: > > src/main/java/org/apache/aurora/scheduler/http/api/TContentAwareServlet.java, > > line 97 > > <https://reviews.apache.org/r/50685/diff/1/?file=1459555#file1459555line97> > > > > This could use HTTP 415? Done. > On Aug. 1, 2016, 8:09 p.m., Joshua Cohen wrote: > > src/main/java/org/apache/aurora/scheduler/http/api/ApiModule.java, lines > > 99-102 > > <https://reviews.apache.org/r/50685/diff/1/?file=1459554#file1459554line99> > > > > Why a list of this class instead of a simple `Map`. I doubt this will > > be a perf hotspot, but it would allow for constant time lookup of the > > proper factory type for a given request type rather than having to iterate > > all of the request types to find a match. We could then have a second map > > from factory->response mime type? I sketched this out and I was not pleased with the verbosity in ApiModule in setting up this new servlet. Two maps plus a default is pretty ugly. I like this list of 3-tuple because its clear what the relationship is with input mime type, output mimetype and factory is at a glance. - Zameer ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/50685/#review144450 ----------------------------------------------------------- On Aug. 1, 2016, 6:29 p.m., Zameer Manji wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/50685/ > ----------------------------------------------------------- > > (Updated Aug. 1, 2016, 6:29 p.m.) > > > Review request for Aurora, Joshua Cohen, Maxim Khutornenko, and Dmitriy > Shirchenko. > > > Bugs: AURORA-1743 > https://issues.apache.org/jira/browse/AURORA-1743 > > > Repository: aurora > > > Description > ------- > > This replaces the `TServlet` servlet from thrift with our own servlet which > dispatches thrift responses based on the content type of the request. This > enables a client to use either the thrift json protocol or the binary > protocol when communicating with the scheduler. > > Without this patch the current behaviour is: > - Regardless of content type of the request, assume the request is json and > return json with a `application/x-thrift` content type. > > With this patch the behaviour becomes: > - A missing content type in the request results in a HTTP 400 response. > - A request with a content type of `application/x-thrift` is assumed to be > json and returns json with a `application/vnd.apache.thrift.json` content > type. This maintains backwards compatability with the client. > - A request with a content type of `application/json` returns json with a > `application/vnd.apache.thrift.json` content type. This maintains backwards > compatability with the AJAX UI. > - A request with a content type of `application/vnd.apache.thrift.json` > returns json with a `application/vnd.apache.thrift.json` content type. > - A request with a content type of `application/vnd.apache.thrift.binary` > returns binary thrift with a `application/vnd.apache.thrift.json` content > type. > - Any other content type in a request results in a HTTP 400 response. > > > Diffs > ----- > > src/main/java/org/apache/aurora/scheduler/http/api/ApiModule.java > cd5adf9655dc3368dbe06bfee15c65182176be2e > > src/main/java/org/apache/aurora/scheduler/http/api/TContentAwareServlet.java > PRE-CREATION > src/test/java/org/apache/aurora/scheduler/http/api/ApiIT.java > 31f5cb3bed48eef60c3b2becb2ed285e93f2bd5a > > src/test/java/org/apache/aurora/scheduler/http/api/TContentAwareServletTest.java > PRE-CREATION > > Diff: https://reviews.apache.org/r/50685/diff/ > > > Testing > ------- > > > Thanks, > > Zameer Manji > >