1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    84
    Vote Rating
    0
    koolll is on a distinguished road

      0  

    Default Unanswered: Sencha touch customise rest proxy url

    Unanswered: Sencha touch customise rest proxy url


    Hi, I need to pass addition param to jersey server. But how do I submit my url like **..get/{param1}/{param2}/{param3}**


    Here is my js file


    Code:
    
    
    
          Ext.define('bluebutton.view.BlueButton.testing', {
            extend: 'Ext.form.Panel',
            xtype: 'testing',
               requires: [
          
            'bluebutton.view.BlueButton.TransactionList',
            'bluebutton.view.BlueButton.MemberPopUp',
             'bluebutton.view.BlueButton.MemberDetail',
             'bluebutton.store.BlueButton.MemberList',
               
            ],
            config: {
             id:'register',
                items :[
                   
                      {
                            xtype: 'textfield',
                            name: 'name',
                            label: 'Name'
                        },
                        {
                            xtype: 'emailfield',
                            name: 'email',
                            label: 'Email'
                        },
                      
                         {
                            xtype: 'button',
                            text: 'Send',
                            handler: function(button) {
                                var form = Ext.getCmp('register');
                                  values = form.getValues();
        
                              
                
        
                
        
        //        Select record
                //If load data , restful will using "get",  url will be /users/1
                var User = Ext.ModelMgr.getModel('bluebutton.model.BlueButton.MemberList');
                User.load(123,
                 {
                    success: function(user) {
                    alert(user.get('fullName'));
        
        
        
                      
                    }
                }
                );
        
        
                                  
                            }
                        }
        
        
                ],
        
        
           }
        
        });
    Model.js




    Code:
    Ext.define('bluebutton.model.BlueButton.MemberList', {
            extend: 'Ext.data.Model',
            config: {
                idProperty: 'memberModel',
                fields: [
                    { name: 'fullName' },
                    { name: 'singer' },
        
                ],
        
                proxy: {
                    type: 'rest',
                   url: 'http://localhost:8080/RESTFulExample/rest/json/metallica/get',
                    reader: 'json',
                    actionMethods: {
                        create: 'GET',
                        read: 'POST',
                        update: 'PUT',
                        destroy: 'DELETE'
                    },
                       
                   
               
                    reader: {
                        type: 'json',
                        
                    },
        
                    writer: {
                        type: 'json',
                      
                    },
                }
        
            }
        
        });


    But now I only able to pass my url like **..get/123** Please guide me some solution.Thanks

  2. #2
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    69
    Vote Rating
    2
    pdm is on a distinguished road

      0  

    Default


    We've done something similar by overriding the rest proxy. Here's a cut-down example:
    Code:
    Ext.define('my_app.data.proxy.Rest', {
        override: 'Ext.data.proxy.Rest',
    
    
        buildUrl: function(request) {
            var me = this, url = this.getUrl(request);
            var op = request.getOperation();
    
            Ext.each(op.getFilters(), function(filter){
                        url += filter.getProperty() + '/' + filter.getValue()+'/';
                        });
    
            request.setUrl(url);
            return me.callParent([request]);
        },
    });
    This example builds URLs out of the filters applied to a store.

    If there's an easier way to do this, please let me know!

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    84
    Vote Rating
    0
    koolll is on a distinguished road

      0  

    Default


    Quote Originally Posted by pdm View Post
    We've done something similar by overriding the rest proxy. Here's a cut-down example:
    Code:
    Ext.define('my_app.data.proxy.Rest', {
        override: 'Ext.data.proxy.Rest',
    
    
        buildUrl: function(request) {
            var me = this, url = this.getUrl(request);
            var op = request.getOperation();
    
            Ext.each(op.getFilters(), function(filter){
                        url += filter.getProperty() + '/' + filter.getValue()+'/';
                        });
    
            request.setUrl(url);
            return me.callParent([request]);
        },
    });
    This example builds URLs out of the filters applied to a store.
    Thanks for your reply. Sorry I am new for sencha touch. How do I call this function? Where do I add {param1} and {param2}? Please give me more example . Thanks

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi