View Poll Results: If you read it, did you find DirectJNgine User's Guide adequate?

Voters
54. You may not vote on this poll
  • Yes

    40 74.07%
  • No

    14 25.93%
  1. #111
    Ext User
    Join Date
    Sep 2009
    Posts
    6
    Vote Rating
    0
    Stsalomon90 is on a distinguished road

      0  

    Default Data not being loaded into store

    Data not being loaded into store


    Greetings,

    I have read the user manual and setup directjngine-1.0 in my web app. I am trying to load data into a grid using the DirectStore. DirectStore is succesfully querying the server but the returned result is not making it into my grid. It appears the loadRecords function is being passed false for the success parameter. Any idea what is going on here?

    Code:
    var memoryRecord = Ext.data.Record.create([{
            name: 'name',
            type: 'string',
            allowBlank: false
        },{
            name: 'status',
            type: 'int',
            allowBlank: false
        },{
            name: 'nonHeapUsed',
            type: 'float',
            allowBlank: false
        },{
            name: 'heapUsed',
            type: 'float',
            allowBlank: false
        },{
            name: 'heapMax',
            type: 'float',
            allowBlank: false
        }, {
            name: 'nonHeapMax',
            type: 'float',
            allowBlank: false
        }]);
    
    Ext.Direct.addProvider(
            Ext.app.REMOTING_API
    );
    
    
    var memoryStatsStore = new Ext.data.DirectStore({
        paramsAsHash: false,
        root: 'result',
        directFn: FrameworkMemoryBean.loadFrameworkMemoryInfo,
        idProperty: 'name',
        fields: memoryRecord,
    });
    
    memoryStatsStore.load();
    Response:

    {"result":[{"heapMax":6144.0,"heapUsed":1626.252784729004,"nonHeapMax":-1.0,"nonHeapUsed":524.9034423828125,"name":"localhost","status":0}],"tid":2,"action":"FrameworkMemoryBean","method":"loadFrameworkMemoryInfo","type":"rpc"}

  2. #112
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    Hi

    We need the Java code to get the whole picture.

    That said, take an in-depth look at the code in DirectStore.java and how it is used in djn-tests.js. DirectStores have been fully tested in DJN, and so far they have worked without a problem.

    Copy a working example/test code, make sure it works in your program, and then modify it moving towards your desired code. All too often I make little mistakes that are not easy to catch due to Javascript being way too tolerant: going step by step is a must in those cases.

    Hope this helps
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  3. #113
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    Quote Originally Posted by pagullo View Post
    Hi

    That said, take an in-depth look at the code in DirectStore.java ...
    Gotcha!

    The right file name is DirectStoreTest.java.
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  4. #114
    Ext User
    Join Date
    Sep 2009
    Posts
    10
    Vote Rating
    0
    SreevaniN is on a distinguished road

      0  

    Default New webapp using directjngine

    New webapp using directjngine


    Hi Pedro,

    I am planning to use the directjngine stack to help my project which involves calling crossdomain URLs. I must admit that I am still a beginner.

    My hello message in my javascript file is coming up, which says that my EXtjs is configured properly.

    I have followed the userguide to create a new web app. Now I have created my own class just like you have given and run my application. The Api.js is not getting created automatically. It does not seem to recognize my class!

    I will be obliged with any help.

    Thanks,
    Sreevani


    Quote Originally Posted by pagullo View Post
    Oops. Yes, those using JDKs older than 1.5 are stuck.
    We need to address this issue.

    I don't like much adding preprocessing steps to compilation, and I think that will be a must with the Apache Commons Attributes library -haven't used it though, maybe there are alternatives...

    Anyway, DirectJNgine annotations are really simple, and we can do without their parameters 99% of the time. I don't think I will add complex annotations later. No need for a full fledged substitute for 1.5 annotations.

    So, what about using a naming convention instead?

    - Methods starting with "djn_" will be considered as annotated with @DirectMethod
    For "djn_xyz" the method name will be "xyz."

    - Those starting with "djnform_" will be considered as a form post method (@DirectPostMethod).
    For "djnform_xyz" the method name will be "xyz."

    - Those starting with "djnpoll_" will be considered as @DirectPollMethod.
    For "djnpoll_xyz", the event name will be "xyz".


    This solution is simple, easy to understand and easy to implement. I think this solves the issue.

    If it is acceptable to everybody, I will consider it for inclusion in the next public release (0.7.3, due on Wednesday 15).

    What do you think?

    Regards,

    Pedro Agullo

  5. #115
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    If you are having trouble, maybe the easiest way to make sure things will work is to use the example application to start your own app.
    Just make sure you can make it work to begin with, add your own "hello world" example and then remove all unneeded functionality.

    If, after trying this, things do not work, post the web.xml and your class source code.

    By the way, I assume you are using JDK 1.5, right? I decided not to support earlier earlier JDKs: you can find the reason somewhere else in this thread.
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  6. #116
    Ext JS Premium Member minneyar's Avatar
    Join Date
    Apr 2009
    Location
    San Antonio, TX
    Posts
    35
    Vote Rating
    0
    minneyar is on a distinguished road

      0  

    Default


    This may be a silly question, but is batching supposed to work when polling multiple providers?

    That is, let's say I set up a couple of different providers like so:
    Code:
    Ext.Direct.addProvider({
        type: 'polling',
        url: Ext.app.POLLING_URLS.firstMethod
    });
    Ext.Direct.addProvider({
        type: 'polling',
        url: Ext.app.POLLING_URLS.secondMethod
    });
    Ext.Direct.on('firstMethod', function(result) {});
    Ext.Direct.on('secondMethod', function(result) {});
    When watching the console log in Firebug, I see queries going to both provider URLs at the same time. As far as I can tell, I have DirectJNgine set up properly and everything else is working fine. I had expected that those calls would be batched together. Is there something that I'm missing?

    I've got a web page that's currently doing a lot of polling via old-fashioned timers and AJAX calls, and I was hoping that this would make that process a lot nicer. I suppose I could just replace the AJAX calls with functions that call a remoting provider and keep the timers, but it seems like the polling providers should be able to replace that altogether...

  7. #117
    Ext JS Premium Member minneyar's Avatar
    Join Date
    Apr 2009
    Location
    San Antonio, TX
    Posts
    35
    Vote Rating
    0
    minneyar is on a distinguished road

      0  

    Default


    Here's another question, this one might be tricky...

    In a servlet, is there any way to get access to the HttpServletRequest that lead to that method call? I ask because I'm running Tomcat on a servet with multiple network interfaces, and I have a servlet that needs to, at runtime, determine which interface requests to Tomcat are arriving on and then use that same interface to query another server and return its status. Currently I can just call "getLocalAddr" on the HttpServletRequest to get the interface I need, but I don't see any way to do that in a method that was annotated with @DirectMethod.

  8. #118
    Ext User
    Join Date
    Aug 2009
    Posts
    20
    Vote Rating
    0
    vlagorce is on a distinguished road

      0  

    Default


    No idea for the first question..sorry

    Quote Originally Posted by minneyar View Post
    [...] is there any way to get access to the HttpServletRequest [...] in a method that was annotated with @DirectMethod.[...]
    You can't access the request when you are in a directAction. You need to override the DirectJNgineServlet and find a way to give the request or just the LocalAddr to the called method.(I didn't have the source I can't help you any more...)

    Someone needed to access the request to keep object in session. You will found the workaround here.. https://www.extjs.com/forum/showthread.php?p=368005 .

  9. #119
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    Quote Originally Posted by minneyar View Post
    This may be a silly question, but is batching supposed to work when polling multiple providers?

    That is, let's say I set up a couple of different providers like so:
    Code:
    Ext.Direct.addProvider({
        type: 'polling',
        url: Ext.app.POLLING_URLS.firstMethod
    });
    Ext.Direct.addProvider({
        type: 'polling',
        url: Ext.app.POLLING_URLS.secondMethod
    });
    Ext.Direct.on('firstMethod', function(result) {});
    Ext.Direct.on('secondMethod', function(result) {});
    When watching the console log in Firebug, I see queries going to both provider URLs at the same time. As far as I can tell, I have DirectJNgine set up properly and everything else is working fine. I had expected that those calls would be batched together. Is there something that I'm missing?

    I've got a web page that's currently doing a lot of polling via old-fashioned timers and AJAX calls, and I was hoping that this would make that process a lot nicer. I suppose I could just replace the AJAX calls with functions that call a remoting provider and keep the timers, but it seems like the polling providers should be able to replace that altogether...
    As far as I know, the provider is the "batching unit" for Ext.Direct, so I would not expect poll calls from different providers to be batched .

    You might want to consider consolidating several poll calls into a single call that returns the aggregated results of all of them -depending on your scenario.

    Regards,
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  10. #120
    Ext JS Premium Member minneyar's Avatar
    Join Date
    Apr 2009
    Location
    San Antonio, TX
    Posts
    35
    Vote Rating
    0
    minneyar is on a distinguished road

      0  

    Default


    Quote Originally Posted by vlagorce View Post
    Someone needed to access the request to keep object in session. You will found the workaround here.. https://www.extjs.com/forum/showthread.php?p=368005 .
    Ah, using a filter to catch the interface address is a great idea. That's a lot cleaner than the previous way I was doing it, too. Thanks!

    It's too bad you can't batch calls to different providers, but that makes sense... I'll probably consolidate a few of them and just have the less frequent, higher bandwidth calls use a remoting provider.

Thread Participants: 86

  1. Animal (5 Posts)
  2. barton (4 Posts)
  3. Condor (1 Post)
  4. mauro_monti (6 Posts)
  5. mbarto (1 Post)
  6. aconran (1 Post)
  7. MoShAn480 (1 Post)
  8. asgillett (2 Posts)
  9. seade (4 Posts)
  10. zaqwsxqwer (3 Posts)
  11. Sesshomurai (16 Posts)
  12. ThierryC (3 Posts)
  13. maxm165 (3 Posts)
  14. techstudios (2 Posts)
  15. sayonara (2 Posts)
  16. kschlaudt (1 Post)
  17. hschaefer123 (2 Posts)
  18. omarc (2 Posts)
  19. lxbzmy (4 Posts)
  20. mct (6 Posts)
  21. mediacept (2 Posts)
  22. dionisexorcius (1 Post)
  23. alper (1 Post)
  24. steverc (2 Posts)
  25. chrizmaster (18 Posts)
  26. J@y (21 Posts)
  27. Georgioa (6 Posts)
  28. wguan (1 Post)
  29. minneyar (16 Posts)
  30. jhoweaa (1 Post)
  31. Ramez (2 Posts)
  32. malus (1 Post)
  33. dweller (8 Posts)
  34. stdunbar (1 Post)
  35. vlagorce (20 Posts)
  36. cwilliso (1 Post)
  37. Whatty (13 Posts)
  38. Ice (1 Post)
  39. clynnh (1 Post)
  40. SreevaniN (1 Post)
  41. Stsalomon90 (1 Post)
  42. GregT (9 Posts)
  43. jcalfee (6 Posts)
  44. set_ti (1 Post)
  45. maho2nd (3 Posts)
  46. dreamtaotao (3 Posts)
  47. Toxa (4 Posts)
  48. tungchau (3 Posts)
  49. wlan0 (2 Posts)
  50. jpr (2 Posts)
  51. gianmarco (5 Posts)
  52. extjslikeit (2 Posts)
  53. harmen_wessels (1 Post)
  54. Olivercomputing2 (4 Posts)
  55. vanessa_ng (2 Posts)
  56. alois.cochard (5 Posts)
  57. kyrillos52 (2 Posts)
  58. Tod (1 Post)
  59. Alinanila (1 Post)
  60. tfannon (2 Posts)
  61. Kynao (1 Post)
  62. feiq (4 Posts)
  63. dalt (1 Post)
  64. xfolch (1 Post)
  65. avijit (1 Post)
  66. marcelsnews (2 Posts)
  67. maddhippy (1 Post)
  68. sritter (1 Post)
  69. july (2 Posts)
  70. jtkeller7983 (1 Post)
  71. lfranchini (2 Posts)
  72. 7/11 (2 Posts)
  73. yAdEs (1 Post)
  74. zazz (1 Post)
  75. waqar (5 Posts)
  76. pjain11 (1 Post)
  77. alexMobimesh (2 Posts)
  78. zachHurt (4 Posts)
  79. n0n3 (5 Posts)
  80. adavis2 (1 Post)
  81. mark.peters (1 Post)
  82. lee el (4 Posts)
  83. frengo19 (3 Posts)
  84. prakashwagle (1 Post)
  85. extejnar (2 Posts)
  86. alin@sonatype.com (1 Post)