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

Issue 183045: Extend concat servlet to support json concatination

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 8 months ago by zhoresh
Modified:
15 years, 8 months ago
Reviewers:
johnfargo, shindig.remailer
Base URL:
http://svn.apache.org/repos/asf/incubator/shindig/trunk/
Visibility:
Public.

Description

The goal is to improve script concatenation: Input: <script src="1.js"></script> <div>Hello, World!</div> <script src="2.js"></script> <span>Goodbye, cruel world.</span> <script src="3.js"></script> Output: <script src="http://www.ggs.com/gadgets/concat?1=1.js&2=2.js&3=3.js&asJSON=1"></script> <script>eval(_js["1.js"]);</script> <div>Hello, World!</div> <script>eval(_js["2.js"]);</script> <span>Goodbye, cruel world.</span> <script>eval(_js["3.js"]);</script> The change here change the concat servlet to support such concatenation.

Patch Set 1 #

Total comments: 2

Patch Set 2 : Updated according to comments #

Total comments: 2

Patch Set 3 : Update wrapper to handle all logic #

Total comments: 3

Patch Set 4 : Changes according to comments, Also added tests for errors #

Total comments: 4

Patch Set 5 : Clean up EscapedServletOutputStream #

Unified diffs Side-by-side diffs Delta from patch set Stats (+356 lines, -7 lines) Patch
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java View 1 2 3 4 9 chunks +116 lines, -7 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/ConcatProxyServletTest.java View 1 2 3 4 1 chunk +240 lines, -0 lines 0 comments Download

Messages

Total messages: 13
zhoresh
15 years, 8 months ago (2009-12-23 23:30:51 UTC) #1
johnfargo
http://codereview.appspot.com/183045/diff/1/2 File java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java (right): http://codereview.appspot.com/183045/diff/1/2#newcode47 java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java:47: public static final String ASJSON_PARAM = "asJSON"; Thinking on ...
15 years, 8 months ago (2010-01-04 22:15:25 UTC) #2
zhoresh
Updated according to comments
15 years, 8 months ago (2010-01-04 23:48:43 UTC) #3
zhoresh
On 2010/01/04 22:15:25, johnfargo wrote: > http://codereview.appspot.com/183045/diff/1/2 > File > java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java > (right): > > ...
15 years, 8 months ago (2010-01-04 23:49:59 UTC) #4
johnfargo
Looks pretty good, but why not go the distance and stick the JSON-open and JSON-end ...
15 years, 8 months ago (2010-01-05 00:06:30 UTC) #5
zhoresh
The code recognize end of concat only when there is no paramater (line 96), at ...
15 years, 8 months ago (2010-01-05 01:24:08 UTC) #6
johnfargo
I'm with you re: the wrapper logic. I'm suggesting a structure more like what you're ...
15 years, 8 months ago (2010-01-05 02:32:40 UTC) #7
zhoresh
Update wrapper to handle all logic
15 years, 8 months ago (2010-01-06 02:52:06 UTC) #8
johnfargo
Looks good, but I'm being a pain :) http://codereview.appspot.com/183045/diff/1006/13 File java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java (right): http://codereview.appspot.com/183045/diff/1006/13#newcode85 java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java:85: String ...
15 years, 8 months ago (2010-01-06 18:36:02 UTC) #9
zhoresh
Changes according to comments, Also added tests for errors
15 years, 8 months ago (2010-01-06 23:15:24 UTC) #10
johnfargo
Tests look awesome. Just one more niggling request. http://codereview.appspot.com/183045/diff/18/19 File java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java (right): http://codereview.appspot.com/183045/diff/18/19#newcode85 java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java:85: // ...
15 years, 8 months ago (2010-01-06 23:45:10 UTC) #11
zhoresh
Clean up EscapedServletOutputStream
15 years, 8 months ago (2010-01-07 00:45:08 UTC) #12
zhoresh
15 years, 8 months ago (2010-01-07 18:42:06 UTC) #13
On Wed, Jan 6, 2010 at 3:45 PM, <johnfargo@gmail.com> wrote:

> Tests look awesome. Just one more niggling request.
>
>
> http://codereview.appspot.com/183045/diff/18/19
>
> File
>
>
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java
> (right):
>
> http://codereview.appspot.com/183045/diff/18/19#newcode85
>
>
>
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java:85:
> // Check for asJSON concat
> s/asJSON/json/g
>
Done

>
> http://codereview.appspot.com/183045/diff/18/19#newcode374
>
>
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java:374:
> super();
> not needed
>
Changed

>
> http://codereview.appspot.com/183045/diff/18/19#newcode377
>
>
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java:377:
> outputStream.print("\"" + var + "\":\"");
> Let's pull the delimiter logic into the wrapper too, so the outputstream
> _just_ escapes.
>
Good idea, The stream is much cleaner now

>
> http://codereview.appspot.com/183045/diff/18/20
> File
>
>
java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/ConcatProxyServletTest.java
> (right):
>
> http://codereview.appspot.com/183045/diff/18/20#newcode44
>
>
java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/ConcatProxyServletTest.java:44:
> "var v2 = { \\\"a-b\\\": 1 , c: \\\"hello!,\\\" };";
> nit: you could also use the escaper itself to generate these vars

I know I don't really test the escaper, but it feel to me almost like
testing assertEqual(f(),f())
So I rather specify in the test what I expect instead of using the same
escaper to generate it.


>
>
> http://codereview.appspot.com/183045
>
Sign in to reply to this message.

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