Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Mysterious DS Criteria as String[] issue on server

    I encountered a strange problem with retrieving the Criteria for a fetch operation inside a DatasourceConstructor on the webserver.
    On the client side the criteria is created as an array of Strings using the provided "addCriteria(String, String[])" method. I would expected the identical data comming out on the server.
    Instead of array of strings I however would receive a LinkedMap of my data plus a whole bunch of other things that are not understandable. Below is an example:
    Client Criteria:
    [sup:grp-1cat-NE Transport, sup:grp-2cat-NE Transport]...
    Server Criteria:
    {summaryViewGroupPtrs={b=[sup:grp-1cat-NE Transport, sup:grp-2cat-NE Transport], c=2, cM={650=1, 676=1, 680=1, 684=1}}...}

    Can someone explain to me whether there is a way to access the desired data buried below and the meaning of the others).

    Thanks

    Be sure your post includes:

    1. the SmartGWT or SmartClient version from the lower left-hand corner of the Developer Console (see FAQ for how to open Developer Console)
    3.0 EE

    2. browser(s) and version(s) involved
    All versions
    3. for a server-side problem, the *complete* logs generated during processing of the failing request (do *not* trim to just the error message)
    see above

    4. for any problem processing a server response, the actual response as shown in the RPC tab in the Developer Console
    see above

    5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)

    6. sample code if applicable

    Posts with incomplete information are much more likely to be ignored.

    #2
    If you're using dsRequest.getAdvancedCriteria() your simple Criteria will be up-converted to the more sophisticated AdvancedCriteria format (as the docs describe).

    However neither Criteria nor AdvancedCriteria are represented in the format you're showing, we're not sure how you produced that output.

    Comment


      #3
      On server I have under GenericDataSourceCounstructror:
      public DSResponse executeFetch(DSRequest req) throws Exception
      {
      return fetchRecords(req.getCriteria(), req.getStartRow(), req.getEndRow());
      }
      so "getCriteria" is called to produce the Criteria Map.

      Be sure your post includes:

      1. the SmartGWT or SmartClient version from the lower left-hand corner of the Developer Console (see FAQ for how to open Developer Console)

      2. browser(s) and version(s) involved

      3. for a server-side problem, the *complete* logs generated during processing of the failing request (do *not* trim to just the error message)

      4. for any problem processing a server response, the actual response as shown in the RPC tab in the Developer Console

      5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)

      6. sample code if applicable

      Posts with incomplete information are much more likely to be ignored.

      Comment


        #4
        My output is straight from the debugger in Eclipse, here is the full code concerned:
        Client:
        Code:
        lViewSelector.addChangedHandler(new ChangedHandler() {
        			
        			@Override
        			public void onChanged(ChangedEvent event) {
        				String[] lSummaryViewSelected = lViewSelector.getSelectedRecord().getAttributeAsStringArray("groupPointers");
        				Criteria lSummaryViewMatchCri = new Criteria();
        				lSummaryViewMatchCri.addCriteria("summaryViewGroupPtrs", lSummaryViewSelected);
        				lSummaryViewMatchCri.addCriteria("loadPerGroup",true);
        				if(summaryViewGrid_ != null)
        				{
        					summaryViewGrid_.addDefaultCriteria(lSummaryViewMatchCri);
        					summaryViewGrid_.fetchData();
        				}
        				
        			}
        server:
        Code:
        	protected synchronized DSResponse fetchRecords(Map criteria, long start,
        			long stop) 
        	{
        ...
                if(criteria.containsKey("summaryViewGroupPtrs"))
                {
                	lSummaryViewGroupPtrs = (String[]) ((Map) criteria.get("summaryViewGroupPtrs")).values().toArray();
                	lFilter = new Filter.And(lFilter, new Filter.In("supervisionGroupPointer", Arrays.asList(lSummaryViewGroupPtrs)));
                }
        ...
        }
        [
        ]

        Comment


          #5
          It's not clear what the debugger in Eclipse is trying to show - try showing us the server-side logs (note: the forums instructions tell you to include this, and you always should).

          Also, there's a possibility you're being bitten by a core GWT (not SmartGWT) bug - see the FAQ about Strings being serialized as though they are Arrays.

          Comment


            #6
            === 2012-02-29 15:23:55,805 [ec-4] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
            === 2012-02-29 15:23:55,805 [ec-4] DEBUG RPCManager - non-DMI response, dropExtraFields: false
            === 2012-02-29 15:23:55,805 [ec-4] INFO Compression - /SAMClientWebPrototypegwt/sam5620webclientprototype/sc/IDACall: 1
            78 -> 153 bytes
            === 2012-02-29 15:24:00,501 [ec-4] INFO RequestContext - URL: '/SAMClientWebPrototypegwt/sam5620webclientprototype/sc/s
            kins/Enterprise/images/Scrollbar/hthumb_Over_start.png', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1;
            WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)': MSIE with
            Accept-Encoding header, ready for compressed JS
            === 2012-02-29 15:24:00,501 [ec-2] INFO RequestContext - URL: '/SAMClientWebPrototypegwt/sam5620webclientprototype/sc/s
            kins/Enterprise/images/Scrollbar/hthumb_Over_stretch.png', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.
            1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)': MSIE wi
            th Accept-Encoding header, ready for compressed JS
            === 2012-02-29 15:24:00,505 [ec-2] INFO Download - done streaming: E:/SAM10_WEB/nms/web/tomcat/webapps/SAMClientWebProt
            otypegwt.war/sam5620webclientprototype/sc/skins/Enterprise/images/Scrollbar/hthumb_Over_stretch.png
            === 2012-02-29 15:24:00,505 [ec-4] INFO Download - done streaming: E:/SAM10_WEB/nms/web/tomcat/webapps/SAMClientWebProt
            otypegwt.war/sam5620webclientprototype/sc/skins/Enterprise/images/Scrollbar/hthumb_Over_start.png
            === 2012-02-29 15:29:17,490 [ec-1] INFO RequestContext - URL: '/SAMClientWebPrototypegwt/sam5620webclientprototype/sc/I
            DACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727;
            .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)': MSIE with Accept-Encoding header, ready for compressed JS

            === 2012-02-29 15:29:17,492 [ec-1] DEBUG XML - Parsed XML from (in memory stream): 1ms
            === 2012-02-29 15:29:17,495 [ec-1] DEBUG RPCManager - Processing 1 requests.
            === 2012-02-29 15:29:17,496 [ec-1] DEBUG RPCManager - Request #1 (DSRequest) payload: {
            criteria:{
            summaryViewGroupPtrs:{
            a:[
            "sup:grp-1cat-NE Transport",
            "sup:grp-2cat-NE Transport"
            ],
            b:2,
            cM:{
            "650":1,
            "676":1,
            "680":1,
            "684":1
            }
            },
            loadPerGroup:true
            },
            operationConfig:{
            dataSource:"sup_SupervisionGroupState",
            operationType:"fetch",
            textMatchStyle:"exact"
            },
            startRow:0,
            endRow:75,
            componentId:"isc_SummaryViewGrid_1",
            appID:"builtinApplication",
            operation:"sup_SupervisionGroupState_fetch",
            oldValues:{
            summaryViewGroupPtrs:{
            a:[
            "sup:grp-1cat-NE Transport",
            "sup:grp-2cat-NE Transport"
            ],
            b:2,
            cM:{
            "650":1,
            "676":1,
            "680":1,
            "684":1
            }
            },
            loadPerGroup:true
            }
            }
            === 2012-02-29 15:29:17,496 [ec-1] INFO IDACall - Performing 1 operation(s)
            === 2012-02-29 15:29:17,496 [ec-1] DEBUG AppBase - [builtinApplication.sup_SupervisionGroupState_fetch] No userTypes def
            ined, allowing anyone access to all operations for this application
            === 2012-02-29 15:29:17,496 [ec-1] DEBUG AppBase - [builtinApplication.sup_SupervisionGroupState_fetch] No public zero-a
            rgument method named '_sup_SupervisionGroupState_fetch' found, performing generic datasource operation
            === 2012-02-29 15:29:17,496 [ec-1] WARN RequestContext - dsRequest.execute() failed:
            java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;
            at com.alu.nms.client.web.module.view.gwt.server.SupSummaryViewDataSourceConstructor.fetchRecords(SupSummaryView
            DataSourceConstructor.java:76)
            at com.alu.nms.client.web.common.core.gwt.server.GenericDataSourceConstructor.executeFetch(GenericDataSourceCons
            tructor.java:52)
            at com.isomorphic.datasource.DataSource.execute(DataSource.java:1287)
            at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721)
            at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
            at com.isomorphic.application.AppBase.execute(AppBase.java:491)
            at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1948)
            at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
            at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
            at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
            at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
            at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at com.alu.cnm.csa.ssoagent.filters.CSARefreshTokenFilter.doFilter(CSARefreshTokenFilter.java:40)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at com.alu.cnm.csa.ssoagent.filters.CSAInputServletFilter.doFilter(CSAInputServletFilter.java:147)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
            at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:354)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619)
            === 2012-02-29 15:29:17,497 [ec-1] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
            === 2012-02-29 15:29:17,497 [ec-1] DEBUG RPCManager - non-DMI response, dropExtraFields: false
            === 2012-02-29 15:29:17,497 [ec-1] INFO Compression - /SAMClientWebPrototypegwt/sam5620webclientprototype/sc/IDACall: 1
            78 -> 153 bytes

            Comment


              #7
              Yes, this suggests you are being bitten by the GWT bug described in the FAQ. The FAQ also explains the workaround.

              Also, if you're testing in Chrome development mode, that might explain the extra properties - see the FAQ about this as well (another GWT/Chrome bug).

              Comment


                #8
                Thanks, could you please send me the link to the page where this issue is addressed/worked around?

                Comment


                  #9
                  The FAQ tells you the workaround for the String as Array bug. There is no workaround for the GWT/Chrome bug - don't use Chrome with GWT development mode (compiled mode is fine).

                  Comment

                  Working...
                  X