public String getUrl() { StringBuilder sb = new StringBuilder(); StringBuilder ori = getOut(); this.setOut(sb); TreeMap<Integer, cn.bran.japid.template.ActionRunner> parentActionRunners = actionRunners; actionRunners = new TreeMap<Integer, cn.bran.japid.template.ActionRunner>(); // line 48, japidviews\AdminController\flashPurchaseList.html p(" "); // line 48, japidviews\AdminController\flashPurchaseList.html p( lookup( "AdminController.flashPurchaseList", new Object[] {})); // line 49, japidviews\AdminController\flashPurchaseList.html p(" "); // line 49, japidviews\AdminController\flashPurchaseList.html this.setOut(ori); if (actionRunners.size() > 0) { StringBuilder _sb2 = new StringBuilder(); int segStart = 0; for (Map.Entry<Integer, cn.bran.japid.template.ActionRunner> _arEntry : actionRunners.entrySet()) { int pos = _arEntry.getKey(); _sb2.append(sb.substring(segStart, pos)); segStart = pos; cn.bran.japid.template.ActionRunner _a_ = _arEntry.getValue(); _sb2.append(_a_.run().getContent().toString()); } _sb2.append(sb.substring(segStart)); actionRunners = parentActionRunners; return _sb2.toString(); } else { actionRunners = parentActionRunners; return sb.toString(); } }
@Test public void maxLength() { StringBuilder body = new StringBuilder(); for (int i = 0; i < 1100; i++) { body.append("1234567890"); } assertThat( status( callWithStringBody( new MockJavaAction() { // #max-length // Accept only 10KB of data. @BodyParser.Of(value = BodyParser.Text.class, maxLength = 10 * 1024) public Result index() { if (request().body().isMaxSizeExceeded()) { return badRequest("Too much data!"); } else { return ok("Got body: " + request().body().asText()); } } // #max-length }, fakeRequest(), body.toString())), equalTo(400)); }