Hi Isomorphic,
After upgrading from "v10.1p_2017-08-10/Pro Deployment (built 2017-08-10)" to "v12.0p_2018-08-28/Pro Deployment (built 2018-08-28)" DSRequest parameters that we were setting are no longer being passed to the server.
I have provided the use case below.
The parameter, param1, is no longer available in the request on the server after upgrading, breaking some of our functionality.
Thanks
-----
EntryPoint
sandbox12.ds.xml
Server DS Object
After upgrading from "v10.1p_2017-08-10/Pro Deployment (built 2017-08-10)" to "v12.0p_2018-08-28/Pro Deployment (built 2018-08-28)" DSRequest parameters that we were setting are no longer being passed to the server.
I have provided the use case below.
The parameter, param1, is no longer available in the request on the server after upgrading, breaking some of our functionality.
Thanks
-----
EntryPoint
Code:
package com.sandbox.client; import java.util.LinkedHashMap; import java.util.Map; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.AutoFitWidthApproach; import com.smartgwt.client.types.FetchMode; import com.smartgwt.client.types.RecordComponentPoolingMode; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.events.FetchDataEvent; import com.smartgwt.client.widgets.events.FetchDataHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.VLayout; public class Sandbox12 implements EntryPoint { DSRequest requestProperties; @Override public void onModuleLoad() { final ListGrid list = new ListGrid(); list.setWidth100(); list.setHeight100(); list.setDataSource(DataSource.get("sandbox12")); list.setDataFetchMode(FetchMode.PAGED); list.setAutoFitFieldsFillViewport(Boolean.TRUE); list.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH); list.setAutoFitFieldWidths(Boolean.TRUE); list.setCanFreezeFields(Boolean.FALSE); list.setCanGroupBy(Boolean.FALSE); list.setRecordComponentPoolingMode(RecordComponentPoolingMode.RECYCLE); list.setAlternateRecordStyles(Boolean.TRUE); list.setAutoFetchData(Boolean.TRUE); list.setShowRollOver(Boolean.FALSE); ListGridField gfld1 = new ListGridField("name"); ListGridField gfld2 = new ListGridField("groupNames"); ListGridField gfld3 = new ListGridField("id"); list.setDefaultFields(gfld1, gfld2, gfld3); list.addFetchDataHandler(new FetchDataHandler() { @Override public void onFilterData(FetchDataEvent event) { requestProperties = event.getRequestProperties(); } }); VLayout appLayout = new VLayout(); appLayout.setWidth100(); appLayout.setHeight100(); IButton btnLoad = new IButton("Run"); btnLoad.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Map params = requestProperties.getAttributeAsMap("params"); // or Map params = requestProperties.getParams(); in 12.0. if (params == null) params = new LinkedHashMap<String, Object>(); params.put("param1", System.currentTimeMillis()); requestProperties.setParams(params); list.invalidateCache(); } }); appLayout.setMargin(5); appLayout.setMembersMargin(5); appLayout.addMembers(btnLoad, list); appLayout.draw(); } }
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DataSource xmlns:fmt="WEB-INF/" ID="sandbox12" serverType="generic"> <fields> <field name="id" type="text" primaryKey="true" canEdit="false"> <title>UUID</title> </field> <field name="name" type="text" length="255" required="true"> <title>Name</title> </field> <field name="groupNames" type="text" multiple="true" canFilter="false" canEdit="false"> <title>Group Names</title> </field> </fields> <serverObject lookupStyle="new" className="com.sandbox.server.Sandbox12DS"/> </DataSource>
Code:
package com.sandbox.server; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.isomorphic.datasource.DSRequest; import com.isomorphic.datasource.DSResponse; public class Sandbox12DS { public Sandbox12DS() {} public DSResponse fetch(final DSRequest req) { String param1 = req.getHttpServletRequest().getParameter("param1"); // NOTE: param1 available with "v10.1p_2017-08-10/Pro Deployment (built 2017-08-10)", however, it is no longer available with "v12.0p_2018-08-28/Pro Deployment (built 2018-08-28)". DSResponse resp = new DSResponse(); resp.setStartRow(req.getStartRow()); resp.setEndRow(req.getEndRow()); resp.setTotalRows(1000); resp.setData(getTestData(req.getStartRow(), req.getEndRow())); return resp; } private List<Map<String, Object>> getTestData(long startRow, long endRow) { List<Map<String, Object>> rList = new ArrayList<>(); HashMap<String, Object> r; String id; String groupName; for (long i = startRow; i <= endRow; i++) { r = new HashMap<String, Object>(); id = Long.toString(i); r.put("id", id); r.put("name", "Item" + id); groupName = "Group" + id; r.put("groupNames", new String[] { groupName }); rList.add(r); } return rList; } }
Comment