Announcement

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

    Strange error when deployed to tomcat

    Hello,

    I am using smartgwt 2.4 LGPL version, and when testing under eclipse, it is fine. But if deployed as a war file to tomcat, I got strange error regarding adding data to server side via data source.

    I have a listGrid, and a DynamicForm, both bound to a data source, under eclipse dev env, I can add record successful, but if deployed as war, error.

    The error is the row added shown in the attachment picture, as below:
    the correct result should be: user8
    but what I got is:
    {"0":"u","1":"s","2":"e","3":"r","4":"8","cM":{"1":1,"124":1,"125":1,"126":1}}


    The main code of my data source like this:
    --------------------
    setID(id);
    setDataFormat(DSDataFormat.XML);
    setRecordXPath("//" + recordName);

    DataSourceField pkField = new DataSourceField("id", FieldType.INTEGER, "id");
    pkField.setHidden(true);
    pkField.setPrimaryKey(true);
    DataSourceField nameField = new DataSourceField("name", FieldType.TEXT, "username");
    DataSourceField passwordField = new DataSourceField("password", FieldType.TEXT, "password");
    DataSourceField emailField = new DataSourceField("email", FieldType.TEXT, "email");
    DataSourceField roleTypeField = new DataSourceField("roleType", FieldType.TEXT, "type");
    roleTypeField.setValueMap("AdminType", "UserType", "Combined");
    DataSourceField versionField = new DataSourceField("version", FieldType.INTEGER, "version");
    versionField.setHidden(true);
    setFields(pkField, nameField, passwordField, emailField, roleTypeField, versionField);

    OperationBinding fetch = new OperationBinding(DSOperationType.FETCH, fetchURL);
    fetch.setDataProtocol(DSProtocol.GETPARAMS);
    fetch.setDataFormat(DSDataFormat.XML);
    // POST
    OperationBinding add = new OperationBinding(DSOperationType.ADD, addURL);
    add.setDataProtocol(DSProtocol.GETPARAMS);
    add.setDataFormat(DSDataFormat.XML);
    add.setRecordName(recordName);
    DSRequest postDSRequest = new DSRequest();
    postDSRequest.getUseSimpleHttp();
    postDSRequest.setHttpMethod("POST");
    add.setRequestProperties(postDSRequest);
    // PUT
    OperationBinding update = new OperationBinding(DSOperationType.UPDATE, updateURL);
    update.setDataProtocol(DSProtocol.POSTPARAMS);
    update.setDataFormat(DSDataFormat.XML);
    update.setRecordName(recordName);
    DSRequest putDSRequest = new DSRequest();
    putDSRequest.getUseSimpleHttp();
    putDSRequest.setHttpMethod("PUT");
    update.setRequestProperties(putDSRequest);
    // DELETE
    OperationBinding remove = new OperationBinding(DSOperationType.REMOVE, removeURL);
    remove.setDataProtocol(DSProtocol.POSTXML);
    remove.setDataFormat(DSDataFormat.XML);
    DSRequest deleteDSRequest = new DSRequest();
    deleteDSRequest.getUseSimpleHttp();
    deleteDSRequest.setHttpMethod("DELETE");
    remove.setRequestProperties(deleteDSRequest);

    dataSource.setOperationBindings(fetch, add, update, remove);
    --------------------
    Attached Files

    #2
    More details:

    from firebug, it did a post to my rest server side:

    POST http://localhost:8080/test/userinfoes.xml

    But the response seems not correct as below, what is the problem and how to correct it? Thanks!
    <com.domain.UserInfo><name>{&quot;0&quot;:&quot;u&quot;,&quot;1&quot;:&quot;s&quot;,&quot;2&quot;:&quot;e&quot;,&quot;3&quot;:&quot;r&quot;,&quot;4&quot;:&quot;8&quot;,&quot;cM&quot;:{&quot;1&quot;:1,&quot;124&quot;:1,&quot;125&quot;:1,&quot;126&quot;:1}}</name><password>{&quot;0&quot;:&quot;8&quot;,&quot;1&quot;:&quot;8&quot;,&quot;2&quot;:&quot;8&quot;,&quot;cM&quot;:{&quot;1&quot;:1,&quot;124&quot;:1,&quot;125&quot;:1,&quot;126&quot;:1}}</password><email>{&quot;0&quot;:&quot;u&quot;,&quot;1&quot;:&quot;s&quot;,&quot;2&quot;:&quot;e&quot;,&quot;3&quot;:&quot;r&quot;,&quot;4&quot;:&quot;8&quot;,&quot;5&quot;:&quot;@&quot;,&quot;6&quot;:&quot;e&quot;,&quot;7&quot;:&quot;m&quot;,&quot;8&quot;:&quot;a&quot;,&quot;9&quot;:&quot;i&quot;,&quot;10&quot;:&quot;l&quot;,&quot;11&quot;:&quot;.&quot;,&quot;12&quot;:&quot;c&quot;,&quot;13&quot;:&quot;o&quot;,&quot;14&quot;:&quot;m&quot;,&quot;cM&quot;:{&quot;1&quot;:1,&quot;124&quot;:1,&quot;125&quot;:1,&quot;126&quot;:1}}</email></com.domain.UserInfo>

    Comment


      #3
      This is probably due to a GWT issue. Make sure you cast the value to a String type instead of calling .toString() to produce "user8" in your sample.

      Comment


        #4
        Originally posted by sjivan
        This is probably due to a GWT issue. Make sure you cast the value to a String type instead of calling .toString() to produce "user8" in your sample.
        Exactly this issue! Thanks a lot for helping me resolved an urgent problem!!

        Comment

        Working...
        X