Announcement

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

    RESTHandler issue: relatedUpdate not included in response

    Hi Isomorphic,

    using latest 6.1p (v11.1p_2017-11-16) I found an issue with RESTHandler + relatedUpdate, which just seems to be missing:

    Employees.java DMI (+ register in employees.ds.xml):
    Code:
    package com.smartgwt.sample.server.listener;
    
    import javax.servlet.http.HttpServletRequest;
    
    import com.isomorphic.datasource.DSRequest;
    import com.isomorphic.datasource.DSResponse;
    import com.isomorphic.datasource.DataSource;
    
    public class Employees {
    
        public DSResponse fetch(DSRequest request, HttpServletRequest servletRequest) throws Exception {
    [B]       return request.execute()
                    .addRelatedUpdate(new DSRequest("animals", DataSource.OP_FETCH).execute().setOperationType(DataSource.OP_UPDATE));[/B]
        }
    }
    ARC request, POST to http://127.0.0.1:8888/builtinds/sc/RESTHandler
    Code:
    <request>
        <dataSource>employees</dataSource>
        <operationType>fetch</operationType>
        <startRow>0</startRow>
        <endRow>2</endRow>
    </request>
    Response:
    Code:
    <?xml version="1.0" ?>
    <response>
        <status>0</status>
        <queueStatus>0</queueStatus>
        <startRow>0</startRow>
        <endRow>2</endRow>
        <totalRows>115</totalRows>
        <queueStatus>0</queueStatus>
        <data>
            <record>
                <OrgUnit>Management</OrgUnit>
                <Salary>26200.0</Salary>
                <MaritalStatus>married</MaritalStatus>
                <Email>cmadigan@server.com</Email>
                <EmployeeStatus>active</EmployeeStatus>
                <userOrder>1</userOrder>
                <ReportsTo>1</ReportsTo>
                <Gender>male</Gender>
                <EmployeeId>4</EmployeeId>
                <Job>Chief Operating Officer</Job>
                <Name>Charles Madigen</Name>
                <EmployeeType>full time</EmployeeType>
            </record>
            <record>
                <OrgUnit>Management</OrgUnit>
                <Salary>11900.0</Salary>
                <MaritalStatus>single</MaritalStatus>
                <Email>tkane@server.com</Email>
                <EmployeeStatus>active</EmployeeStatus>
                <userOrder>112</userOrder>
                <ReportsTo>4</ReportsTo>
                <Gender>female</Gender>
                <EmployeeId>182</EmployeeId>
                <Job>Mgr Site Services</Job>
                <Name>Tamara Kane</Name>
                <EmployeeType>part time</EmployeeType>
            </record>
        </data>
    </response>
    Server log (includes successful request to animals):
    Code:
    === 2017-11-17 00:12:48,452 [5-31] INFO  RequestContext - URL: '/builtinds/sc/RESTHandler', User-Agent: 'null': Unsupported WITHOUT Accept-Encoding header
    === 2017-11-17 00:12:48,453 [5-31] DEBUG RESTHandler - Defaulting response data format to xml
    === 2017-11-17 00:12:48,454 [5-31] DEBUG RestRequestParser - Parsing xml object: '<request>
        <dataSource>employees</dataSource>
        <operationType>fetch</operationType>
        <startRow>0</startRow>
        <endRow>2</endRow>
    </request>'
    === 2017-11-17 00:12:48,455 [5-31] DEBUG XML - Parsed XML from (in memory stream): 1ms
    === 2017-11-17 00:12:48,456 [5-31] INFO  RESTHandler - Performing 1 operation(s)
    === 2017-11-17 00:12:48,457 [5-31] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
    === 2017-11-17 00:12:48,457 [5-31] DEBUG DeclarativeSecurity - DataSource employees is not in the pre-checked list, processing...
    === 2017-11-17 00:12:48,457 [5-31] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
    === 2017-11-17 00:12:48,457 [5-31] DEBUG DeclarativeSecurity - DataSource employees is not in the pre-checked list, processing...
    === 2017-11-17 00:12:48,457 [5-31] DEBUG AppBase - [builtinApplication.employees_fetch] No userTypes defined, allowing anyone access to all operations for this application
    === 2017-11-17 00:12:48,457 [5-31] DEBUG AppBase - [builtinApplication.employees_fetch] No public zero-argument method named '_employees_fetch' found, performing generic datasource operation
    === 2017-11-17 00:12:48,457 [5-31] INFO  SQLDataSource - [builtinApplication.employees_fetch] Performing fetch operation with
        criteria: {}    values: {}
    === 2017-11-17 00:12:48,458 [5-31] DEBUG SQLDataSource - [builtinApplication.employees_fetch] DataSource 20 acquired SQLDriver instance 1995870055 during initialization
    === 2017-11-17 00:12:48,458 [5-31] INFO  SQLWhereClause - [builtinApplication.employees_fetch] empty condition
    === 2017-11-17 00:12:48,458 [5-31] INFO  SQLDataSource - [builtinApplication.employees_fetch] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
    === 2017-11-17 00:12:48,458 [5-31] DEBUG SQLDataSource - [builtinApplication.employees_fetch] Executing row count query: SELECT COUNT(*) FROM $defaultTableClause
    === 2017-11-17 00:12:48,458 [5-31] DEBUG SQLDataSource - [builtinApplication.employees_fetch] Eval'd row count query: SELECT COUNT(*) FROM employeeTable
    === 2017-11-17 00:12:48,459 [5-31] DEBUG SQLConnectionManager - [builtinApplication.employees_fetch] Borrowed connection '1992006570'
    === 2017-11-17 00:12:48,459 [5-31] INFO  SQLDriver - [builtinApplication.employees_fetch] Executing SQL query on 'HSQLDB' using connection '1992006570': SELECT COUNT(*) FROM employeeTable
    === 2017-11-17 00:12:48,459 [5-31] DEBUG SQLDataSource - [builtinApplication.employees_fetch] Using SQL Limit query
    === 2017-11-17 00:12:48,459 [5-31] DEBUG SQLDataSource - [builtinApplication.employees_fetch] SQL windowed select rows 0->2, result size 2. Query: SELECT LIMIT 0 2  employeeTable.userOrder, employeeTable.Name, employeeTable.EmployeeId, employeeTable.ReportsTo, employeeTable.Job, employeeTable.Email, employeeTable.EmployeeType, employeeTable.EmployeeStatus, employeeTable.Salary, employeeTable.OrgUnit, employeeTable.Gender, employeeTable.MaritalStatus FROM employeeTable WHERE ('1'='1')
    === 2017-11-17 00:12:48,459 [5-31] DEBUG SQLDataSource - [builtinApplication.employees_fetch] SQL windowed select rows 0->2, result size 2. Query: SELECT LIMIT 0 2  employeeTable.userOrder, employeeTable.Name, employeeTable.EmployeeId, employeeTable.ReportsTo, employeeTable.Job, employeeTable.Email, employeeTable.EmployeeType, employeeTable.EmployeeStatus, employeeTable.Salary, employeeTable.OrgUnit, employeeTable.Gender, employeeTable.MaritalStatus FROM employeeTable WHERE ('1'='1')
    === 2017-11-17 00:12:48,459 [5-31] INFO  SQLDataSource - [builtinApplication.employees_fetch] 20: Executing  query on 'HSQLDB': SELECT LIMIT 0 2  employeeTable.userOrder, employeeTable.Name, employeeTable.EmployeeId, employeeTable.ReportsTo, employeeTable.Job, employeeTable.Email, employeeTable.EmployeeType, employeeTable.EmployeeStatus, employeeTable.Salary, employeeTable.OrgUnit, employeeTable.Gender, employeeTable.MaritalStatus FROM employeeTable WHERE ('1'='1')
    === 2017-11-17 00:12:48,460 [5-31] INFO  DSResponse - DSResponse: List with 2 items
    === 2017-11-17 00:12:48,460 [5-31] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
    === 2017-11-17 00:12:48,460 [5-31] DEBUG DeclarativeSecurity - Request is not a client request, ignoring security checks.
    === 2017-11-17 00:12:48,460 [5-31] DEBUG AppBase - [builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application
    === 2017-11-17 00:12:48,461 [5-31] DEBUG AppBase - [builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation
    === 2017-11-17 00:12:48,461 [5-31] INFO  SQLDataSource - [builtinApplication.null] Performing fetch operation with
        criteria: {}    values: {}
    === 2017-11-17 00:12:48,461 [5-31] INFO  SQLWhereClause - [builtinApplication.null] empty condition
    === 2017-11-17 00:12:48,461 [5-31] INFO  SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
    === 2017-11-17 00:12:48,461 [5-31] INFO  SQLDataSource - [builtinApplication.null] 16: Executing SQL query on 'HSQLDB': SELECT animals.commonName, animals.scientificName, animals.lifeSpan, animals.status, animals.diet, animals.information, animals.picture FROM animals WHERE ('1'='1')
    === 2017-11-17 00:12:48,461 [5-31] DEBUG SQLConnectionManager - [builtinApplication.null] Borrowed connection '1586949668'
    [B]=== 2017-11-17 00:12:48,461 [5-31] INFO  SQLDriver - [builtinApplication.null] Executing SQL query on 'HSQLDB' using connection '1586949668': SELECT animals.commonName, animals.scientificName, animals.lifeSpan, animals.status, animals.diet, animals.information, animals.picture FROM animals WHERE ('1'='1')
    === 2017-11-17 00:12:48,464 [5-31] INFO  DSResponse - DSResponse: List with 29 items[/B]
    === 2017-11-17 00:12:48,465 [5-31] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 16
    === 2017-11-17 00:12:48,465 [5-31] DEBUG SQLDriver - Freeing SQLDriver dbConnection 1586949668 for SQLDriver instance 1098961536
    === 2017-11-17 00:12:48,465 [5-31] DEBUG SQLConnectionManager - About to close connection with hashcode "1586949668"
    === 2017-11-17 00:12:48,465 [5-31] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 16
    === 2017-11-17 00:12:48,465 [5-31] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 16
    === 2017-11-17 00:12:48,465 [5-31] INFO  DSResponse - DSResponse: List with 2 items
    === 2017-11-17 00:12:48,465 [5-31] DEBUG RPCManager - Content type for RPC transaction: text/html; charset=UTF-8
    === 2017-11-17 00:12:48,465 [5-31] DEBUG RPCManager - DMI response, dropExtraFields: true
    === 2017-11-17 00:12:48,466 [5-31] WARN  RequestContext - Content type has already been set to: text/html; charset=UTF-8 - setting to: text/xml
    === 2017-11-17 00:12:48,466 [5-31] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 20
    === 2017-11-17 00:12:48,466 [5-31] DEBUG SQLDriver - Freeing SQLDriver dbConnection 1992006570 for SQLDriver instance 1995870055
    === 2017-11-17 00:12:48,466 [5-31] DEBUG SQLConnectionManager - About to close connection with hashcode "1992006570"
    === 2017-11-17 00:12:48,466 [5-31] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 20
    === 2017-11-17 00:12:48,466 [5-31] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 20
    This is an important one for me.

    Please note that the queueStatus-multiple-times issue (thread also has other related issues) is still open and also visible here.

    Best regards
    Blama

    #2
    The RestHandler works with the RestDataSource protocol, which doesn't currently have a concept of relatedUpdates, or a serialization format for them. We do agree that this falls somewhere between an oversight and an enhancement however, so we'll plan to add it, and once added, it can be backported to 6.1. This may take some weeks, however.

    Comment


      #3
      Hi Isomorphic,

      OK, thanks for the fast answer. That means for now I'll have to create API-only operationBindings now that call my real operationBinding and return the most important data from the responses in the main response.
      This also means that the outbound API will change here afterwards. Not too good, but I assume that I'll be the only API user for the next weeks or that external API use will be limited to testing it until then.

      Best regards
      Blama

      Comment

      Working...
      X