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

      0  

    Default Unanswered: Jersey not able to call Put mehod

    Unanswered: Jersey not able to call Put mehod


    Hi, i am new sencha touch. I need to update some record to my database by using restful proxy.

    Here is my code
    view.js
    Code:
             var user = Ext.create('bluebutton.model.BlueButton.MemberList', 
             {
             
                 title: 'Ed Spencer', singer: 'ed@sencha.com'});
                 user.save({
                    success: function(user) {
                    alert(user);
                        user.set('title', 'sencha');
                        user.save(); //PUT /users/123
                    }
                });

    model.js
    Code:
    Ext.define('bluebutton.model.BlueButton.MemberList', {
        extend: 'Ext.data.Model',
        config: {
            idProperty: 'memberModel',
            fields: [
                { name: 'title' },
                { name: 'singer' },
    
    
            ],
    
    
            proxy: {
                type: 'rest',
                url: 'http://localhost:8080/RESTFulExample/rest/json/metallica/get',
                reader: 'json',
                actionMethods: {
                    create: 'POST',
                    read: 'GET',
                    update: 'PUT',
                    destroy: 'DELETE'
                },
    
    
                reader: {
                    type: 'json',
                    root: 'Track'
                },
    
    
                writer: {
                    type: 'json',
                  
                },
            }
    
    
            //                    proxy: {
            //                    type: 'rest',
            //                    url: 'http://192.168.0.103:8080/RESTFulExample/rest/json/metallica/post'
            //            }
    
    
    
    
    
    
    
    
    
    
        }
    
    
    });
    Jersey.java
    Code:
    	//--Update record
    	@PUT
    	@Path("/get")
    	@Produces(MediaType.APPLICATION_JSON)
    	public Track getTracktest1(@PathParam(value = "userID") String accountId) {
     
    		Track track = new Track();
    		track.setTitle("Enter Sandman");
    		track.setSinger("Metallica");
     
    		return track;
     
    	}
    But jersey.java no response. Please help

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    898
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So does your java method retrieve the request?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  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 mitchellsimoens View Post
    So does your java method retrieve the request?
    Yup. Java retrieve the request. But only get "post" request

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    898
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So change the actionMethod to POST instead of PUT
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

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

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    So change the actionMethod to POST instead of PUT
    Ok. thanks .Any difference between POST and PUT method

Thread Participants: 1

Tags for this Thread