I've also seen this behaviour and ended up turning off GZip compression for "application/json" mime type.
See https://issues.apache.org/jira/browse/TAP5-469. Patrick 2009/3/12 Howard Lewis Ship <hls...@gmail.com> > It's possible that XmlHttpRequest may not handle GZIPed responses > correctly; I'm looking into it. > > On Thu, Mar 12, 2009 at 4:28 AM, Peter Kanze <peterka...@gmail.com> wrote: > > Hi Joost, > > > > The error is in my javascript, because the response in my javascript is > > empty, but a full JSONArray is returned in my java code. > > It looks like somewhere between these steps the response gets empty. > > Anyone an explanation? > > > > Here is some code: > > > > /* > > *Java script > > */ > > function fillSubCategories(response) { > > selectElement = $('subCategorySelect'); > > clearSelectOption(selectElement); > > var responseJSON = response.evalJSON(); > > for (index = 0; index < responseJSON.length; index++) { > > selectElement.options[index] = new > > Option(responseJSON[index].label, responseJSON [index].value); > > } > > Tapestry.ElementEffect.highlight($('subCategorySelect')); > > } > > > > /* > > *Java page > > */ > > @OnEvent(component = "rootCategorySelect", value = "change") > > JSONArray onCategorySelectChanged(String categoryId) { > > JSONArray jsonArray = new JSONArray(); > > if (StringUtils.hasLength(categoryId)) { > > try { > > List<Category> subCategories = > > categoryService.getSubCategoriesForCategory(Long.valueOf(categoryId)); > > for (Category subCategory : subCategories) { > > JSONObject jsonObject = new JSONObject(); > > jsonObject.put("value", > subCategory.getId().toString()); > > jsonObject.put("label", subCategory.getName()); > > // put the jsonobjects into an array, to maintain the > > sorted > > // order. > > jsonArray.put(jsonObject); > > } > > } > > catch (Exception ex) { > > logger.error(ex); > > } > > } > > > > return jsonArray; > > } > > > > On Thu, Mar 12, 2009 at 12:19 PM, Joost Schouten (mailing lists) < > > joost...@jsportal.com> wrote: > > > >> Do you get an error on your server or in javascript? Because I too > >> have been having problems with the JSONResponse. > >> transport.responseJSON in my javascript is sometimes null. For some > >> weird reason the problem resolved itself when using shorter variable > >> names (scarry). Haven't had the time to look into it but maybe it is > >> related. > >> > >> Just thought I'd share, > >> Joost > >> > >> On Thu, Mar 12, 2009 at 7:05 PM, Peter Kanze <peterka...@gmail.com> > wrote: > >> > Hello > >> > > >> > I had implement a depended select box. This works fine in T 5.0.18. > But > >> > after I upgrade to 5.1 the dependent select doesn't work anymore. > >> > Only sometimes. It seems that the response is sometimes filled > correctly, > >> > but most of the time it is empty. I then mostly get the error "Badly > >> formed > >> > JSON String" > >> > > >> > Can someone explain to me why this isn't working in T5.1 and how I can > >> fix > >> > this again? > >> > > >> > Thanks! > >> > Peter > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >> For additional commands, e-mail: users-h...@tapestry.apache.org > >> > >> > > > > > > -- > Howard M. Lewis Ship > > Creator Apache Tapestry and Apache HiveMind > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >