I'm with you re: the wrapper logic. I'm suggesting a structure more like
what you're starting to hint at -- where the ResponseWrapper has more
existing base-class logic stuffed into it.

Then the loop would just be:
for (each referenced JS file) {
  wrapper.addJs(file);  // non-static private class has reference to
proxyHandler, does doFetch, creates wrapped JS, handles
comments/encoding, etc.
}
// wrapper.close() called by framework, obviating the need for .done()

thoughts?


http://codereview.appspot.com/183045/diff/8/9
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java
(right):

http://codereview.appspot.com/183045/diff/8/9#newcode85
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java:85:
String jsonVar = request.getParameter(JSON_PARAM);
let's sanitize this by ensuring it matches [a-zA-Z0-9_]{0,32} or
similar.

http://codereview.appspot.com/183045/diff/8/9#newcode99
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java:99:
response.getOutputStream().println("/* ---- Start " + url + " ---- */");
start/end comments should be harmless, but are also redundant in the
json case, as the original URL reference is right in the object.

http://codereview.appspot.com/183045

Reply via email to