1. #1
    Sencha User
    Join Date
    Oct 2011
    Location
    São Paulo - SP
    Posts
    22
    Vote Rating
    0
    maps_tecnologia is on a distinguished road

      0  

    Default Unanswered: Java 5 + ExtJS + Rest (Complex JSON structure)

    Unanswered: Java 5 + ExtJS + Rest (Complex JSON structure)


    I was given the task to implement a REST interface to make our Java application (wicket interface) to render ExtJS components and feed their stores using JSONs.

    We have a infrastructure that can serialize a Java object into a JSON, but the problem is that it is really complex.

    It's something like this:
    Code:
    class Person {
    private String name;
    }
    Code:
    {
    "&type":"class","value":"full.qualified.name.Person","&type":"String","value":"SomeName"
    }
    The issue here is that we don't know how to follow. Either we change our infrastructure, create a new one, or try to do something in the Javascript side.

    Do you guys have and toughts about this?

  2. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,108
    Answers
    83
    Vote Rating
    31
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    Your server should deliver the json in the correct format that extjs can understand.

    Code:
    {
       persons: [ { name: 'somename' }, {name : 'someothername'} ]
    }
    I think you must use another serializer for your JSON objects. There are libraries for java available to do that. See http://json.org/java/ or http://www.json.org/ for good java libraries.

    And information like class and full.qualified.name.Person is not needed client side. So why send it to the browser? I think you should never send unwanted information, also bad for the performance.

  3. #3
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,341
    Answers
    498
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    Your JSON isn't valid. You have duplicate keys in your objects. It won't work correctly with any standard parser.

    ExtJS has built-in support for most common JSON formats and can be coerced into working with formats it doesn't support but you need to be using valid JSON or it has no chance.

  4. #4
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,108
    Answers
    83
    Vote Rating
    31
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    It won't work correctly with any standard parser.
    Well, duplicate keys in the JSON were never a problem for the Ext parser.
    Would be a nice feature request.

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar