Results 1 to 5 of 5

Thread: Jersey not able to call Put mehod

  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    84
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    So does your java method retrieve the request?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    So change the actionMethod to POST instead of PUT
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •