Javier Paniza
-
2013-04-09
- status: open --> closed
- milestone: v1.0_(example) --> v4.7
It fails because the tab object has no an update request. It only fail in some specific server configuration, so it difficult to test in a concrete way.
The solution is adding the next line in TabBaseAction:
protected Tab getTab() throws XavaException { if (tab == null ) { String tabObject = Is.emptyString(getCollection())?"xava_tab":Tab.COLLECTION_PREFIX + Strings.change(getCollection(), ".", "_"); tab = (Tab) getContext().get(getRequest(), tabObject); tab.setRequest(getRequest()); // ADD THIS LINE if (tab.getCollectionView() != null) { tab.getCollectionView().refreshCollections(); } } return tab; }
And improving ModuleManager to populate the object to inject in actions (among them is tab) with request. For example, in setObjectsToActionUseObjects() and setObjectsToActionInjectFields() we can add
Object value = getObjectFromContext(objectName); if (value == null) { value = createObject(objectName); setObjectInContext(objectName, value); } updateRequest(value, request); // ADD THIS LINE
The code for updateRequest is:
private void updateRequest(Object value, HttpServletRequest request) { try { PropertiesManager pm = new PropertiesManager(value); if (pm.exists("request")) { pm.executeSet("request", request); } } catch (Exception ex) { ex.printStackTrace(); // tmp some log } }
The above code has been tested in a configuration where we could reproduce the problem and it fix it.